Merge pull request #22247 from groud/fix_polygon_editor
Fixes polygon editor blocking other editor actions (move, scale...)
This commit is contained in:
commit
9c2986abda
2 changed files with 12 additions and 4 deletions
|
@ -275,6 +275,10 @@ bool AbstractPolygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event)
|
|||
return (mb.is_valid() && mb->get_button_index() == 1);
|
||||
}
|
||||
|
||||
CanvasItemEditor::Tool tool = CanvasItemEditor::get_singleton()->get_current_tool();
|
||||
if (tool != CanvasItemEditor::TOOL_SELECT)
|
||||
return false;
|
||||
|
||||
if (mb.is_valid()) {
|
||||
|
||||
Transform2D xform = canvas_item_editor->get_canvas_transform() * _get_node()->get_global_transform();
|
||||
|
@ -283,10 +287,10 @@ bool AbstractPolygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event)
|
|||
Vector2 cpoint = _get_node()->get_global_transform().affine_inverse().xform(canvas_item_editor->snap_point(canvas_item_editor->get_canvas_transform().affine_inverse().xform(mb->get_position())));
|
||||
|
||||
if (mode == MODE_EDIT || (_is_line() && mode == MODE_CREATE)) {
|
||||
|
||||
if (mb->get_button_index() == BUTTON_LEFT) {
|
||||
|
||||
if (mb->is_pressed()) {
|
||||
if (mb->get_control() || mb->get_shift() || mb->get_alt())
|
||||
return false;
|
||||
|
||||
const PosVertex insert = closest_edge_point(gpoint);
|
||||
|
||||
|
|
|
@ -71,8 +71,7 @@ class CanvasItemEditor : public VBoxContainer {
|
|||
|
||||
GDCLASS(CanvasItemEditor, VBoxContainer);
|
||||
|
||||
EditorNode *editor;
|
||||
|
||||
public:
|
||||
enum Tool {
|
||||
TOOL_SELECT,
|
||||
TOOL_LIST_SELECT,
|
||||
|
@ -84,6 +83,9 @@ class CanvasItemEditor : public VBoxContainer {
|
|||
TOOL_MAX
|
||||
};
|
||||
|
||||
private:
|
||||
EditorNode *editor;
|
||||
|
||||
enum MenuOption {
|
||||
SNAP_USE,
|
||||
SNAP_USE_NODE_PARENT,
|
||||
|
@ -535,6 +537,8 @@ public:
|
|||
|
||||
Control *get_viewport_control() { return viewport; }
|
||||
|
||||
Tool get_current_tool() { return tool; }
|
||||
|
||||
void set_undo_redo(UndoRedo *p_undo_redo) { undo_redo = p_undo_redo; }
|
||||
void edit(CanvasItem *p_canvas_item);
|
||||
|
||||
|
|
Loading…
Reference in a new issue