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

Update canvas layer size and control after project settings changed. #93717

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

EAinsley
Copy link
Contributor

Fix #69208

update_project_settings.mp4

In canvas_item_editor_plugin: Call update_viewport() in _project_setting_changed to redraw viewport after project settings changed.

In control: Add a new private function _project_settings_changed to update the size and redraw the control. Connect/Disconnect this function to "settings_changed" of ProjectSettings when the control enters/exits the canvas.

NOTE 0: The signal name used here is string literal, but some other names are wrapped by SNAME or SceneStringName. Not sure if we have to make any modifications to keep consistency.

NOTE 1: I'm a bit worried about the performance here. We use "settings_changed" signal here, so any change unrelated to viewport will also trigger a redraw. Should the signal be more fine-grained?

@EAinsley EAinsley requested a review from a team as a code owner June 28, 2024 20:24
@Calinou Calinou added this to the 4.3 milestone Jun 28, 2024
@Calinou
Copy link
Member

Calinou commented Jun 28, 2024

We use "settings_changed" signal here, so any change unrelated to viewport will also trigger a redraw. Should the signal be more fine-grained?

If we make this editor-only, it should be fine. This is what we did for Camera2D: #92992

scene/gui/control.cpp Outdated Show resolved Hide resolved
scene/gui/control.cpp Outdated Show resolved Hide resolved
In `canvas_item_editor_plugin`: Call `update_viewport()` in
`_project_setting_changed` to redraw viewport after project
settings changed.

In `control`: Add a new private function `_project_setting_changed`
to update the size and redraw the control. Connect/Disconnet this
function to "settings_changed" of `ProjectSettings` when the control
enters/exits the canvas.
@EAinsley EAinsley requested a review from Calinou July 1, 2024 09:47
@clayjohn clayjohn modified the milestones: 4.3, 4.4 Jul 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Canvas Layer size not updating after changing Viewport Size in Project Settings
3 participants