From 621f267789f46a11bee46d0da8274fbda4935062 Mon Sep 17 00:00:00 2001 From: Jelle Bakker Date: Fri, 22 Sep 2023 10:37:03 +0200 Subject: [PATCH] Add move item to graph dropdown --- .../Source/Windows/Graphs/GraphWindow.cpp | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/x-IMU3-GUI/Source/Windows/Graphs/GraphWindow.cpp b/x-IMU3-GUI/Source/Windows/Graphs/GraphWindow.cpp index cf6b4e25..d1a4999f 100644 --- a/x-IMU3-GUI/Source/Windows/Graphs/GraphWindow.cpp +++ b/x-IMU3-GUI/Source/Windows/Graphs/GraphWindow.cpp @@ -252,6 +252,22 @@ juce::PopupMenu GraphWindow::getMenu() settings.horizontalAutoscale = !settings.horizontalAutoscale; writeToValueTree(settings); }); + menu.addItem("Move Left (Mouse Drag)", graph.getSettings().horizontalAutoscale == false, false, [this] + { + auto settings = graph.getSettings(); + const auto offset = settings.axesLimits.x.getRange() / 2; + settings.axesLimits.x.min -= offset; + settings.axesLimits.x.max -= offset; + writeToValueTree(settings); + }); + menu.addItem("Move Right (Mouse Drag)", graph.getSettings().horizontalAutoscale == false, false, [this] + { + auto settings = graph.getSettings(); + const auto offset = settings.axesLimits.x.getRange() / 2; + settings.axesLimits.x.min += offset; + settings.axesLimits.x.max += offset; + writeToValueTree(settings); + }); menu.addItem("Zoom In (Scroll)", graph.getSettings().horizontalAutoscale == false, false, [this] { zoomHorizontal(0.5f); @@ -269,6 +285,22 @@ juce::PopupMenu GraphWindow::getMenu() settings.verticalAutoscale = !settings.verticalAutoscale; writeToValueTree(settings); }); + menu.addItem("Move Up (Mouse Drag)", graph.getSettings().verticalAutoscale == false, false, [this] + { + auto settings = graph.getSettings(); + const auto offset = settings.axesLimits.y.getRange() / 2; + settings.axesLimits.y.min += offset; + settings.axesLimits.y.max += offset; + writeToValueTree(settings); + }); + menu.addItem("Move Down (Mouse Drag)", graph.getSettings().verticalAutoscale == false, false, [this] + { + auto settings = graph.getSettings(); + const auto offset = settings.axesLimits.y.getRange() / 2; + settings.axesLimits.y.min -= offset; + settings.axesLimits.y.max -= offset; + writeToValueTree(settings); + }); menu.addItem("Zoom In (Alt+Scroll)", graph.getSettings().verticalAutoscale == false, false, [this] { zoomVertical(0.5f);