Avorion Wiki
Explore
Main Page
All Pages
Interactive Maps
navigation
Main page
Community portal
Recent changes
Random page
Admin noticeboard
Avorion Community
Official forum
Discord
Twitter
Reddit
Facebook
Steam
Gamepedia
Gamepedia support
Report a bad ad
Help Wiki
Contact us
FANDOM
Fan Central
BETA
Games
Anime
Movies
TV
Video
Wikis
Explore Wikis
Community Central
Start a Wiki
Don't have an account?
Register
Sign In
Sign In
Register
Avorion Wiki
356
pages
Explore
Main Page
All Pages
Interactive Maps
navigation
Main page
Community portal
Recent changes
Random page
Admin noticeboard
Avorion Community
Official forum
Discord
Twitter
Reddit
Facebook
Steam
Gamepedia
Gamepedia support
Report a bad ad
Help Wiki
Contact us
Editing
Modding Pitfalls
(section)
Back to page
Edit
VisualEditor
View history
Talk (0)
Edit Page
Modding Pitfalls
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Coordinates of UI Elements == When creating UI elements, you have to give them a location where they'll be placed. The <code>UIContainer:createLabel(...)</code> and other UI creation functions expect '''local''' 2D coordinates, inside the window. But when you access coordinates of UI elements, they will return '''global''' 2D screen coordinates. <source lang="lua"> local rect = Rect(0, 0, 200, 40) local button = window:createButton(rect, "Press Me", "onButtonPressed") -- this will print the global render position of the button's rect. Also changes when the window is moved around local glbl = button.rect print (tostring(glbl.lower)) print (tostring(glbl.upper)) local lcl = button.localRect print (tostring(lcl.lower)) print (tostring(lcl.upper)) </source> If you want to use coordinates of UI elements, for example for formatting, you should keep that in mind. Use <code>UIElement.localRect</code> to access the local coordinates inside the window.
Summary:
Please note that all contributions to the Avorion Wiki are considered to be released under the CC BY-SA 3.0
Cancel
Editing help
(opens in new window)
Follow on IG
TikTok
Join Fan Lab