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

Dynamic icon positon depending on ui-scale #225

Merged
merged 12 commits into from
Nov 28, 2023
Merged

Dynamic icon positon depending on ui-scale #225

merged 12 commits into from
Nov 28, 2023

Conversation

Masgalor
Copy link
Contributor

This PR aims to change the position of the main button/icon according to the used ui-scale.
Nothing will be scaled or otherwise resized, all this PR does is recalculating the position.

What needs to happen to move the button/icon and the clickable are.

  • The left- and the right-margin must be changed.

    Burrito/Spatial.tscn

    Lines 74 to 75 in a344bdf

    margin_left = 323.0
    margin_right = 349.0
  • The function set_minimal_mouse_block() must be called once after changing the margins.
    func set_minimal_mouse_block():

How to calculate the margins.

Every button has a fixed width depending on the ui-scale.
If we know the width of one button we can calculate the margin of every n..th button.
So we can preset the button width for every scale, we can also preset the desired position of our button. (e.g. if the native ui has 10 buttons we want to be on position 11.)
After reading the ui-scale from the link, it can be used to select the appropriate base width and calculate the final position.

Possible conflicts.

When the function set_minimal_mouse_block() is called, the clickable area of all open windows will be deleted.
So the user will see the windows but can no longer interact with them.

@AsherGlick
Copy link
Owner

Once you have implemented everything you want to with this, are happy with the functionality, and convert this from a draft pr to a regular pr, then we will review this. It might take some time before we get to it, depending on our personal schedules and free cycles, but we are aware of it.

@Masgalor Masgalor marked this pull request as ready for review November 16, 2023 17:17
Spatial.gd Show resolved Hide resolved
Spatial.gd Outdated Show resolved Hide resolved
Spatial.gd Outdated Show resolved Hide resolved
Spatial.gd Outdated Show resolved Hide resolved
Spatial.gd Outdated Show resolved Hide resolved
Spatial.gd Outdated Show resolved Hide resolved
Spatial.gd Outdated Show resolved Hide resolved
Spatial.gd Outdated Show resolved Hide resolved
Spatial.gd Outdated Show resolved Hide resolved
To avoid code duplication the core functionality of _on_Dialog_hide was moved to an independet function.
Spatial.gd Outdated Show resolved Hide resolved
This check does not hold a real value while most components of burrito only work reliable on fullscreen anyway.
Instead of calculating the position it is now directly read from a dictionary as an absolute value.
@AsherGlick AsherGlick merged commit 55b2aeb into AsherGlick:master Nov 28, 2023
1 check passed
@Masgalor Masgalor deleted the dynamic-icon-positon branch November 29, 2023 07:42
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.

3 participants