-
-
Notifications
You must be signed in to change notification settings - Fork 21.2k
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
Improve UV editor zoom behavior #83731
Improve UV editor zoom behavior #83731
Conversation
56ccdab
to
db8f87f
Compare
db8f87f
to
63572a6
Compare
Updated with lessons I learned when making #84353, mainly moved some stuff around to avoid some edge cases and also replaced the zoom slider with EditorZoomWidget (see godotengine/godot-proposals#8294). |
@@ -1194,40 +1249,6 @@ void Polygon2DEditor::_uv_draw() { | |||
//draw paint circle | |||
uv_edit_draw->draw_circle(bone_paint_pos, bone_paint_radius->get_value() * EDSCALE, Color(1, 1, 1, 0.1)); | |||
} | |||
|
|||
rect.position = -uv_edit_draw->get_size(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simplified and moved this scroll updating logic to _update_zoom_and_pan
, since there's no reason to update it on every redraw, only when zoom gets changed. Also helps solving problem of setting scroll position to value which gets clamped by scrollbar, then updating scrollbar limits.
Logic for hiding scrollbars isn't needed, even in this original implementation it never triggers.
For some reason the editor always opens partially off-screen: 2FTMgYlulN.mp4 |
Hmm, this is confusing. I'm not touching any of the window layout logic and didn't encounter such behavior while making this. Can you confirm this is a regression from this pr? I made some testing and noticed that there's a regression from 3.x to 4.0, that UV editor doesn't recover last window placement (maybe related to the fact that it's a native window now?). And lastly, if godotengine/godot-proposals#8209 gets approved, there'll be no window at all 😛 |
Ok it's not caused by this PR. |
63572a6
to
0270e8c
Compare
Thanks for the great feedback, updated 👌 I'll make similiar changes to #84353 soonish. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM otherwise
0270e8c
to
9bdbaae
Compare
Needs rebase, then should be ready to merge. |
Scrolling focuses towards mouse like in canvas editor. Center view on opening. Adjust scroll area to include polygons larger than texture. Change zoom slider to EditorZoomWidget.
9bdbaae
to
5bdb5f5
Compare
Rebased now, sorry for taking some time. |
Thanks! |
Implements partially godotengine/godot-proposals#4118
Also throughout the code zoom level was get by 2 different methods:
uv_zoom->get_value()
anduv_draw_zoom
. I changed them all to the latter for consistency (single source of truth).