Merge pull request #46943 from jmb462/fix-editor-slider-grabber-zoomed-bad-position
Fix EditorSpinSlider grabber zoom issues (Fix #46632)
This commit is contained in:
commit
55d9c31dcb
1 changed files with 6 additions and 2 deletions
|
@ -175,7 +175,9 @@ void EditorSpinSlider::_grabber_gui_input(const Ref<InputEvent> &p_event) {
|
|||
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);
|
||||
update();
|
||||
}
|
||||
|
@ -300,8 +302,10 @@ void EditorSpinSlider::_notification(int p_what) {
|
|||
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_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) {
|
||||
Input::get_singleton()->warp_mouse_position(grabber->get_position() + grabber_rect.size);
|
||||
|
|
Loading…
Reference in a new issue