Scripting: window size#3927
Scripting: window size#3927lampysprites wants to merge 2 commits intoaseprite:mainfrom lampysprites:window-events
Conversation
|
Thanks for this PR @lampysprites! I have to review it, but probably I'll move
|
|
Np I'll change that real quick then. For future proofing it can be wrapped
in a table like palettes[1] now, perhaps?
…On Thu, Jun 15, 2023, 4:25 AM David Capello ***@***.***> wrote:
Thanks for this PR @lampysprites <https://github.com/lampysprites>! I
have to review it, but probably I'll move app.width/height to
app.window.bounds/width/height or something similar (app.mainWindow...?).
As I'm thinking that we should be able to access the list of all windows
and identify them (Window.MAIN_WINDOW/PLUGIN/FOREGROUND_COLOR, etc.)
app.width and app.height look too generic but might work for the simplest
case (the main window current size). In the future we might have multiple
windows (e.g. if we drag a tab outside the main window) so I'm not sure
what app.width/height should be in those cases.
—
Reply to this email directly, view it on GitHub
<#3927 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ALX4NSV7JVLH62HBXDKEBMTXLI24XANCNFSM6AAAAAAZDEDSZ4>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
…e#3927) We moved the app.width/heigth to app.window.width/height and app.events.on('resize', ...) to app.window.events.on('resize', ...).
|
I've completed the PR with this commit: dacap@a2d8a08 Basically these new properties will be available in Thanks @lampysprites! I'll merge it today as it is 👍 |
Proposed changes to scripting API:
app.width,app.heightproperties to access size of the client area of the window.It was sort of possible to retrieve those as
2*x+widthof a freshly created dialog, but not very intuitive or efficient."resize"type ofapp.events, which is triggered after windows resize. Callback receives a table withwidthandheightkeys.It will allow to keep dialogs centered, or positioned relative to right/bottom edge of the window; or limit size to show a scrollbar when they're taller that the window itself.
I agree that my contributions are licensed under the Individual Contributor License Agreement V4.0 ("CLA") as stated in https://github.com/igarastudio/cla/blob/main/cla.md