Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scripting: window size #3927

Closed
wants to merge 2 commits into from
Closed

Scripting: window size #3927

wants to merge 2 commits into from

Conversation

lampysprites
Copy link
Contributor

Proposed changes to scripting API:

  • app.width, app.height properties to access size of the client area of the window.
    It was sort of possible to retrieve those as 2*x+width of a freshly created dialog, but not very intuitive or efficient.
  • "resize" type of app.events, which is triggered after windows resize. Callback receives a table with width and height keys.

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

@lampysprites lampysprites requested a review from dacap as a code owner June 12, 2023 10:02
@dacap dacap self-assigned this Jun 14, 2023
@dacap
Copy link
Member

dacap commented Jun 14, 2023

Thanks for this PR @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.

@lampysprites
Copy link
Contributor Author

lampysprites commented Jun 14, 2023 via email

@lampysprites lampysprites marked this pull request as draft June 26, 2023 14:58
dacap added a commit to dacap/aseprite that referenced this pull request Jul 18, 2023
…e#3927)

We moved the app.width/heigth to app.window.width/height and
app.events.on('resize', ...) to app.window.events.on('resize', ...).
@dacap
Copy link
Member

dacap commented Jul 18, 2023

I've completed the PR with this commit: dacap@a2d8a08

Basically these new properties will be available in app.window.width/height and the 'resize' event in app.window.events.

Thanks @lampysprites! I'll merge it today as it is 👍

@dacap
Copy link
Member

dacap commented Jul 18, 2023

Merged in 30b858d + 7ee8666 + a2d8a08

@dacap dacap closed this Jul 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants