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 disabling canvas centering after resize #1201

Merged
merged 1 commit into from
Sep 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Source/CanvasViewport.h
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,11 @@ class CanvasViewport : public Viewport {

adjustScrollbarBounds();

if (!SettingsFile::getInstance()->getProperty<bool>("center_resized_canvas")) {
Viewport::resized();
return;
}

float scale = std::sqrt(std::abs(cnv->getTransform().getDeterminant()));

// centre canvas when resizing viewport
Expand Down
5 changes: 5 additions & 0 deletions Source/Dialogs/AdvancedSettingsPanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ class AdvancedSettingsPanel : public Component
defaultZoom.addListener(this);
otherProperties.add(new PropertiesPanel::EditableComponent<float>("Default zoom %", defaultZoom));

centerResized = settingsFile->getPropertyAsValue("center_resized_canvas");
centerResized.addListener(this);
otherProperties.add(new PropertiesPanel::BoolComponent("Center canvas when resized", centerResized, { "No", "Yes" }));

propertiesPanel.addSection("Other", otherProperties);

addAndMakeVisible(propertiesPanel);
Expand Down Expand Up @@ -104,6 +108,7 @@ class AdvancedSettingsPanel : public Component
Value reloadPatch;
Value scaleValue;
Value defaultZoom;
Value centerResized;

Value showPalettesValue;
Value autoPatchingValue;
Expand Down
1 change: 1 addition & 0 deletions Source/Utility/SettingsFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ class SettingsFile : public ValueTree::Listener
{ "global_scale", var(1.0f) },
{ "default_zoom", var(100.0f) },
{ "show_palettes", var(true) },
{ "center_resized_canvas", var(true) },
{ "show_all_audio_device_rates", var(false) },
{ "add_object_menu_pinned", var(false) },
{ "macos_buttons",
Expand Down