Skip to content

Static grid option / function #336

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

h0psej0ch
Copy link

In response to the issues #310 and #257 (and my own frustration of the grid size always changing).

I added a static grid option in the appearance settings that makes the grid static such that zoom-in/out does not change the grid and notes stay in the same place relative to the grid. I mostly use Lorien for taking math notes / making exercises so having a static grid helps a lot with keeping everything ordered, though I added it as an option in the settings such that others can still use it as they are used to.

To keep the line visible I currently added a line_size as the (grid_size / 10.0), tho this could also be changed to a setting if deemed necessary. (Although the grid lines being only 1 pixel thick in general makes the lines hard to see)

I have been able to solve most issues I have except for 2

  • Translations of "Static Grid" into all the diverse languages used
  • Checkbox color being off after opening settings with static grid turned on

Both the static grid and the checkbox not being colored properly are shown in the video below.

Lorien.mp4

@h0psej0ch
Copy link
Author

I have now also added a subdivide function as mentioned in #310. The grid splits in 2 if zoomed in enough with the static grid in both the dots and lines mode, but it will never grow bigger than the set grid size. I have also edited the dots grid to be centered the same way as the lines grid such that when switching between the two types their cross-points are the exact same instead of the dots being misaligned by halve their size.

SubdivisonGrid.mp4

@tafode
Copy link
Contributor

tafode commented Mar 7, 2025

Looks like the checkbox color issue is a general one, the "Constant Pressure" checkbox on the General tab behaves the same. As soon as the checkbox is checked and you change to the tab with the checkbox it somehow gets the theme color for a pressed button. I would have expected that it would take a color from the checkbox theme. However it could be solved, by use the theme override on both checkboxes in the settings. But I guess it is not a great solution, as you would need to set it manually for the next checkbox in the settings menu.

Another thing I noticed when testing the static grid, that depending on your grid size settings it stops working in the extreme value zooms. For a Grid Size Value of 128 and Grid Pattern Line it works for Zoom 0.1 - 100. If you set the grid size to 28 and zoom in you will see no grid anymore after 60. For Grid Pattern Dots with Grid Size 28 it will already stop showing dots at Zoom 34. Is that what you meant by "...but it will never grow bigger than the set grid size"?

@h0psej0ch
Copy link
Author

For the checkbox issue, since it automatically resets to a different color in the color scheme, would this be a general Godot (4.3) bug or rather a bug in Lorien (and possibly another issue to be made)?

The grid disappearing was not intended. As I converted the grid_size to an integer, after division it would, at a high zoom value, become 0 and all the lines/dots would be placed right next to each other filling the whole screen with lines/dots. Next to this having a dot_size of 1 and a grid_size of 1 also fills up the full screen so I removed the integer conversion from the dot_size to make sure it is still visible.

Finally, what I meant with "...but it will never grow bigger than the set grid size" was that when zooming out the grid will never become larger then the set value. If the grid size is for example 100 then zooming in results in sizes of 50,25,... However zooming out to zoom 0.1 will always remain a size of 100. This was my personal view of what might be nice to have, though that might not be the same for everyone of course.

@tafode
Copy link
Contributor

tafode commented Mar 7, 2025

I guess it's just how Godot works. As CheckBox inherits from Button/BaseButton, probably it's correct that it uses the pressed color from there. I will look into it further tomorrow.

Ah, great. 🙂 Will try it again tomorrow.

Ah, now I understand. I think it's good as it is now, you cannot really see the lines, but I think in 0.2 nobody needs the lines and if they need it, they can just set the grid size very high.

Great work. 👍

@tafode
Copy link
Contributor

tafode commented Mar 8, 2025

@h0psej0ch So, I tried your last change, works now for every setting I tried for all zoom levels 👍

About the CheckBox with the wrong color. After some research and trying some things here is the conclusion. CheckBox inherits the color from BaseButton. As soon as the checkbox is checked, it's in the pressed status, this has no immediate effect, because it is and staysin the hover state which has a similar color like the "normal". As soon as you switch tabs, the check box loses the hover state and is only in the state "pressed" which has a lighter grey color. I have created another pull request(#338) with a theme that has the settings for the checkboxes inside and overrides the pressed state of the base button, so that it look the same as the other UI elements.

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.

2 participants