Skip to content

Commit

Permalink
Merge pull request #99506 from Giganzo/scale-2d-selection
Browse files Browse the repository at this point in the history
Change how multi selection scale is applied to canvas item
  • Loading branch information
Repiteo committed Nov 25, 2024
2 parents 29e6ef4 + c4bb252 commit 81733e6
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions editor/plugins/canvas_item_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1995,15 +1995,14 @@ bool CanvasItemEditor::_gui_input_scale(const Ref<InputEvent> &p_event) {
}
}

Transform2D edit_transform;
bool using_temp_pivot = !Math::is_inf(temp_pivot.x) || !Math::is_inf(temp_pivot.y);
if (using_temp_pivot) {
edit_transform = Transform2D(drag_selection.front()->get()->_edit_get_rotation(), temp_pivot);
} else {
edit_transform = drag_selection.front()->get()->_edit_get_transform();
}
for (CanvasItem *ci : drag_selection) {
Transform2D edit_transform;
bool using_temp_pivot = !Math::is_inf(temp_pivot.x) || !Math::is_inf(temp_pivot.y);
if (using_temp_pivot) {
edit_transform = Transform2D(ci->_edit_get_rotation(), temp_pivot);
} else {
edit_transform = ci->_edit_get_transform();
}

Transform2D parent_xform = ci->get_global_transform_with_canvas() * ci->get_transform().affine_inverse();
Transform2D unscaled_transform = (transform * parent_xform * edit_transform).orthonormalized();
Transform2D simple_xform = (viewport->get_transform() * unscaled_transform).affine_inverse() * transform;
Expand Down

0 comments on commit 81733e6

Please sign in to comment.