fix-EditorSpinSlider-grabber-zoomed-position
(cherry picked from commit 919b097b9e
)
This commit is contained in:
parent
045cf246d4
commit
592c0632a1
|
@ -185,7 +185,9 @@ void EditorSpinSlider::_grabber_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
if (mousewheel_over_grabber)
|
if (mousewheel_over_grabber)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
float grabbing_ofs = (grabber->get_transform().xform(mm->get_position()).x - grabbing_from) / float(grabber_range);
|
float scale_x = get_global_transform_with_canvas().get_scale().x;
|
||||||
|
ERR_FAIL_COND(Math::is_zero_approx(scale_x));
|
||||||
|
float grabbing_ofs = (grabber->get_transform().xform(mm->get_position()).x - grabbing_from) / float(grabber_range) / scale_x;
|
||||||
set_as_ratio(grabbing_ratio + grabbing_ofs);
|
set_as_ratio(grabbing_ratio + grabbing_ofs);
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
@ -311,8 +313,10 @@ void EditorSpinSlider::_notification(int p_what) {
|
||||||
grabber->set_texture(grabber_tex);
|
grabber->set_texture(grabber_tex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Vector2 scale = get_global_transform_with_canvas().get_scale();
|
||||||
|
grabber->set_scale(scale);
|
||||||
grabber->set_size(Size2(0, 0));
|
grabber->set_size(Size2(0, 0));
|
||||||
grabber->set_position(get_global_position() + grabber_rect.position + grabber_rect.size * 0.5 - grabber->get_size() * 0.5);
|
grabber->set_position(get_global_position() + (grabber_rect.position + grabber_rect.size * 0.5 - grabber->get_size() * 0.5) * scale);
|
||||||
|
|
||||||
if (mousewheel_over_grabber) {
|
if (mousewheel_over_grabber) {
|
||||||
Input::get_singleton()->warp_mouse_position(grabber->get_position() + grabber_rect.size);
|
Input::get_singleton()->warp_mouse_position(grabber->get_position() + grabber_rect.size);
|
||||||
|
|
Loading…
Reference in New Issue