summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/editor/plugins/canvas_item_editor_plugin.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/tools/editor/plugins/canvas_item_editor_plugin.cpp b/tools/editor/plugins/canvas_item_editor_plugin.cpp
index 1a365d7f32..7914ecfd95 100644
--- a/tools/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/tools/editor/plugins/canvas_item_editor_plugin.cpp
@@ -85,8 +85,10 @@ Dictionary CanvasItemEditor::get_state() const {
Dictionary state;
state["zoom"]=zoom;
state["ofs"]=Point2(h_scroll->get_val(),v_scroll->get_val());
- state["pixel_snap"]=pixel_snap;
// state["ofs"]=-transform.get_origin();
+ state["use_snap"]=is_snap_active();
+ state["snap"]=snap;
+ state["pixel_snap"]=pixel_snap;
return state;
}
void CanvasItemEditor::set_state(const Dictionary& p_state){
@@ -103,12 +105,19 @@ void CanvasItemEditor::set_state(const Dictionary& p_state){
v_scroll->set_val(ofs.y);
}
+ if (state.has("use_snap")) {
+ int idx = edit_menu->get_popup()->get_item_index(SNAP_USE);
+ edit_menu->get_popup()->set_item_checked(idx,state["use_snap"]);
+ }
+
+ if (state.has("snap")) {
+ snap=state["snap"];
+ }
+
if (state.has("pixel_snap")) {
pixel_snap=state["pixel_snap"];
int idx = edit_menu->get_popup()->get_item_index(SNAP_USE_PIXEL);
edit_menu->get_popup()->set_item_checked(idx,pixel_snap);
-
-
}
}