From d361b663a2cee8dec039fc64df2f734548a39e8e Mon Sep 17 00:00:00 2001 From: YuSanka Date: Wed, 17 Jul 2024 14:51:51 +0200 Subject: [PATCH] DoubleSlider: Using for the "Ctrl/Shift + MouseWhile" didn't increase move step. MacOS specific: MouseWhile issue. + Wrong tooltip for tick editing ("cmd" instead of "Ctrl" -> partially reverted d1d9a82c) Fixes are related to GH#12944 - Sliced view scrolling needs attention --- src/slic3r/GUI/DoubleSliderForLayers.cpp | 7 ++----- src/slic3r/GUI/ImGuiDoubleSlider.cpp | 11 +++++++++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/slic3r/GUI/DoubleSliderForLayers.cpp b/src/slic3r/GUI/DoubleSliderForLayers.cpp index fb7deef9ce..42e6ae85f1 100644 --- a/src/slic3r/GUI/DoubleSliderForLayers.cpp +++ b/src/slic3r/GUI/DoubleSliderForLayers.cpp @@ -20,7 +20,6 @@ #include "I18N.hpp" #include "ImGuiWrapper.hpp" #include "libslic3r/libslic3r.h" -#include "slic3r/GUI/GUI.hpp" // GUI::shortkey_ctrl_prefix() #include "slic3r/GUI/ImGuiDoubleSlider.hpp" #include "slic3r/GUI/ImGuiPureWrap.hpp" #include "slic3r/GUI/RulerForDoubleSlider.hpp" @@ -1146,8 +1145,7 @@ std::string DSForLayers::get_tooltip(int tick/*=-1*/) _u8L("Add color change - Left click") ) + " " + _u8L("or press \"+\" key") + "\n" + ( is_osx ? - // TRN %1% is shortkey Ctrl prefix in respect to the OS - format(_u8L("Add another code - %1% Left click"), Slic3r::GUI::shortkey_ctrl_prefix()) : + _u8L("Add another code - Ctrl + Left click") : _u8L("Add another code - Right click") ); } @@ -1212,8 +1210,7 @@ std::string DSForLayers::get_tooltip(int tick/*=-1*/) if (m_focus == fiActionIcon) tooltip += "\n\n" + _u8L("Delete tick mark - Left click or press \"-\" key") + "\n" + ( is_osx ? - // TRN %1% is shortkey Ctrl prefix in respect to the OS - format(_u8L("Edit tick mark - %1% Left click"), Slic3r::GUI::shortkey_ctrl_prefix()) : + _u8L("Edit tick mark - Ctrl + Left click") : _u8L("Edit tick mark - Right click") ); } diff --git a/src/slic3r/GUI/ImGuiDoubleSlider.cpp b/src/slic3r/GUI/ImGuiDoubleSlider.cpp index 7ad9dcd368..50201cad2f 100644 --- a/src/slic3r/GUI/ImGuiDoubleSlider.cpp +++ b/src/slic3r/GUI/ImGuiDoubleSlider.cpp @@ -49,8 +49,15 @@ static bool behavior(ImGuiID id, const ImRect& region, if (ImGui::ItemHoverable(mouse_wheel_responsive_region, id)) { if (change_on_mouse_move) v_new = v_min + (ImS32)(v_range * mouse_pos_ratio + 0.5f); - else - v_new = ImClamp(*out_value + (ImS32)(context.IO.MouseWheel/* * accer*/), v_min, v_max); + else { + float mw = context.IO.MouseWheel; +#if defined(__APPLE__) + if (mw > 0.f) mw = 1.f; + if (mw < 0.f) mw = -1.f; +#endif + const float accer = context.IO.KeyCtrl || context.IO.KeyShift ? 5.f : 1.f; + v_new = ImClamp(*out_value + (ImS32)(mw * accer), v_min, v_max); + } } // drag behavior