diff options
author | Tim Ledbetter <timledbetter@gmail.com> | 2023-01-05 15:35:07 +0000 |
---|---|---|
committer | Jelle Raaijmakers <jelle@gmta.nl> | 2023-01-06 00:34:38 +0100 |
commit | fc5bcd84764d60ae18a74a3918d3d0ee6d6a913e (patch) | |
tree | 1f9d06b7fd0952efedbad612ebc3a9a7f3ad867e /Userland | |
parent | a9839d7ac51445af874689c1c293ac597862dcbb (diff) | |
download | serenity-fc5bcd84764d60ae18a74a3918d3d0ee6d6a913e.zip |
PixelPaint: Allow repeated zooming with the zoom tool
Previously, the zoom tool only allowed the user to zoom in or out
once, as it didn't take account of the current zoom level.
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Applications/PixelPaint/Tools/ZoomTool.cpp | 6 | ||||
-rw-r--r-- | Userland/Applications/PixelPaint/Tools/ZoomTool.h | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/Userland/Applications/PixelPaint/Tools/ZoomTool.cpp b/Userland/Applications/PixelPaint/Tools/ZoomTool.cpp index 88b52725a5..f0e4b61995 100644 --- a/Userland/Applications/PixelPaint/Tools/ZoomTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/ZoomTool.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022, the SerenityOS developers. + * Copyright (c) 2021-2023, the SerenityOS developers. * * SPDX-License-Identifier: BSD-2-Clause */ @@ -19,7 +19,7 @@ void ZoomTool::on_mousedown(Layer*, MouseEvent& event) return; auto scale_factor = (raw_event.button() == GUI::MouseButton::Primary) ? m_sensitivity : -m_sensitivity; - auto new_scale = AK::exp2(scale_factor); + auto new_scale = m_editor->scale() * AK::exp2(scale_factor); m_editor->scale_centered(new_scale, raw_event.position()); } @@ -42,7 +42,7 @@ GUI::Widget* ZoomTool::get_properties_widget() sensitivity_slider.set_value(100 * m_sensitivity); sensitivity_slider.on_change = [&](int value) { - m_sensitivity = (double)value / 100.0; + m_sensitivity = value / 100.0f; }; set_primary_slider(&sensitivity_slider); } diff --git a/Userland/Applications/PixelPaint/Tools/ZoomTool.h b/Userland/Applications/PixelPaint/Tools/ZoomTool.h index 472ea5036c..cdc068adc2 100644 --- a/Userland/Applications/PixelPaint/Tools/ZoomTool.h +++ b/Userland/Applications/PixelPaint/Tools/ZoomTool.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022, the SerenityOS developers. + * Copyright (c) 2021-2023, the SerenityOS developers. * * SPDX-License-Identifier: BSD-2-Clause */ @@ -25,7 +25,7 @@ private: virtual StringView tool_name() const override { return "Zoom Tool"sv; } RefPtr<GUI::Widget> m_properties_widget; - double m_sensitivity { 0.5 }; + float m_sensitivity { 0.5f }; }; } |