mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
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.
This commit is contained in:
parent
a9839d7ac5
commit
fc5bcd8476
Notes:
sideshowbarker
2024-07-17 20:22:04 +09:00
Author: https://github.com/tcl3 Commit: https://github.com/SerenityOS/serenity/commit/fc5bcd8476 Pull-request: https://github.com/SerenityOS/serenity/pull/16835
2 changed files with 5 additions and 5 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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 };
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue