zoomin'
This commit is contained in:
@@ -23,6 +23,7 @@ namespace anm2ed
|
|||||||
static constexpr auto DASH_OFFSET = 1.0f;
|
static constexpr auto DASH_OFFSET = 1.0f;
|
||||||
static constexpr auto STEP = 1.0f;
|
static constexpr auto STEP = 1.0f;
|
||||||
static constexpr auto STEP_FAST = 5.0f;
|
static constexpr auto STEP_FAST = 5.0f;
|
||||||
|
static constexpr auto ZOOM_STEP_FAST_MULTIPLIER = 5.0f;
|
||||||
static constexpr auto GRID_SIZE_MIN = 1;
|
static constexpr auto GRID_SIZE_MIN = 1;
|
||||||
static constexpr auto GRID_SIZE_MAX = 10000;
|
static constexpr auto GRID_SIZE_MAX = 10000;
|
||||||
static constexpr auto GRID_OFFSET_MIN = 0;
|
static constexpr auto GRID_OFFSET_MIN = 0;
|
||||||
|
|||||||
@@ -1350,8 +1350,11 @@ namespace anm2ed::imgui
|
|||||||
|
|
||||||
if (mouseWheel != 0 || isZoomIn || isZoomOut)
|
if (mouseWheel != 0 || isZoomIn || isZoomOut)
|
||||||
{
|
{
|
||||||
|
auto wheelZoomStep = mouseWheel != 0 && ImGui::IsKeyDown(ImGuiMod_Ctrl)
|
||||||
|
? zoomStep * ZOOM_STEP_FAST_MULTIPLIER
|
||||||
|
: zoomStep;
|
||||||
auto previousZoom = zoom;
|
auto previousZoom = zoom;
|
||||||
zoom_set(zoom, pan, vec2(mousePos), (mouseWheel > 0 || isZoomIn) ? zoomStep : -zoomStep);
|
zoom_set(zoom, pan, vec2(mousePos), (mouseWheel > 0 || isZoomIn) ? wheelZoomStep : -wheelZoomStep);
|
||||||
if (zoom != previousZoom) hasPendingZoomPanAdjust = true;
|
if (zoom != previousZoom) hasPendingZoomPanAdjust = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -954,8 +954,11 @@ namespace anm2ed::imgui
|
|||||||
auto focus = mouseWheel != 0 ? vec2(mousePos) : vec2();
|
auto focus = mouseWheel != 0 ? vec2(mousePos) : vec2();
|
||||||
if (texture && mouseWheel == 0) focus = texture->size / 2;
|
if (texture && mouseWheel == 0) focus = texture->size / 2;
|
||||||
|
|
||||||
|
auto wheelZoomStep = mouseWheel != 0 && ImGui::IsKeyDown(ImGuiMod_Ctrl)
|
||||||
|
? zoomStep * ZOOM_STEP_FAST_MULTIPLIER
|
||||||
|
: zoomStep;
|
||||||
auto previousZoom = zoom;
|
auto previousZoom = zoom;
|
||||||
zoom_set(zoom, pan, focus, (mouseWheel > 0 || isZoomIn) ? zoomStep : -zoomStep);
|
zoom_set(zoom, pan, focus, (mouseWheel > 0 || isZoomIn) ? wheelZoomStep : -wheelZoomStep);
|
||||||
if (zoom != previousZoom) hasPendingZoomPanAdjust = true;
|
if (zoom != previousZoom) hasPendingZoomPanAdjust = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user