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

Allow changing the size without affecting scale #170

Closed
gnif opened this issue Jul 21, 2022 · 2 comments
Closed

Allow changing the size without affecting scale #170

gnif opened this issue Jul 21, 2022 · 2 comments
Assignees

Comments

@gnif
Copy link

gnif commented Jul 21, 2022

This is a feature request.

Currently the graph wont zoom if you resize it on the X axis, but will on the Y axis. Please provide a flag to allow resizing the node editor while maintaining the current central position without affecting the scale/zoom.

The following change performs this however Begin would need altering with a flags argument (or something similar) to opt into this feature.

imgui_node_editor.cpp:1130

auto currentVisibleRect = m_Canvas.ViewRect();
auto width   = currentVisibleRect.GetWidth();
auto height  = currentVisibleRect.GetHeight();
auto centerX = (previousVisibleRect.Max.x + previousVisibleRect.Min.x) * 0.5f;
auto centerY = (previousVisibleRect.Max.y + previousVisibleRect.Min.y) * 0.5f;

previousVisibleRect.Min.x = centerX - 0.5f * width;
previousVisibleRect.Min.y = centerY - 0.5f * height;
previousVisibleRect.Max.x = previousVisibleRect.Min.x + width;
previousVisibleRect.Max.y = previousVisibleRect.Min.y + height;
@thedmd
Copy link
Owner

thedmd commented Aug 12, 2022

Certainly. I will add such feature.

@thedmd thedmd self-assigned this Aug 12, 2022
thedmd added a commit that referenced this issue Aug 25, 2022
Config can now decide how editor should resize view when changing size.
@thedmd
Copy link
Owner

thedmd commented Aug 25, 2022

You can now set in Config::CanvasSizeMode = CanvasSizeMode::CenterOnly to get behavior you're after.

@thedmd thedmd closed this as completed Aug 25, 2022
thedmd added a commit that referenced this issue Aug 25, 2022
Config can now decide how editor should resize view when changing size.
thedmd added a commit that referenced this issue Aug 25, 2022
Config can now decide how editor should resize view when changing size.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants