@@ -4691,7 +4691,6 @@ void CanvasItemEditor::_reset_drag() {
4691
4691
void CanvasItemEditor::_bind_methods () {
4692
4692
ClassDB::bind_method (" _get_editor_data" , &CanvasItemEditor::_get_editor_data);
4693
4693
4694
- ClassDB::bind_method (D_METHOD (" set_state" ), &CanvasItemEditor::set_state);
4695
4694
ClassDB::bind_method (D_METHOD (" update_viewport" ), &CanvasItemEditor::update_viewport);
4696
4695
ClassDB::bind_method (D_METHOD (" center_at" , " position" ), &CanvasItemEditor::center_at);
4697
4696
@@ -4905,6 +4904,13 @@ void CanvasItemEditor::set_state(const Dictionary &p_state) {
4905
4904
}
4906
4905
4907
4906
void CanvasItemEditor::clear () {
4907
+ zoom = 1.0 / MAX (1 , EDSCALE);
4908
+ zoom_widget->set_zoom (zoom);
4909
+
4910
+ view_offset = Point2 (-150 - RULER_WIDTH, -95 - RULER_WIDTH);
4911
+ previous_update_view_offset = view_offset; // Moves the view a little bit to the left so that (0,0) is visible. The values a relative to a 16/10 screen.
4912
+ _update_scrollbars ();
4913
+
4908
4914
grid_offset = EditorSettings::get_singleton ()->get_project_metadata (" 2d_editor" , " grid_offset" , Vector2 ());
4909
4915
grid_step = EditorSettings::get_singleton ()->get_project_metadata (" 2d_editor" , " grid_step" , Vector2 (8 , 8 ));
4910
4916
primary_grid_steps = EditorSettings::get_singleton ()->get_project_metadata (" 2d_editor" , " primary_grid_steps" , 8 );
@@ -4956,10 +4962,6 @@ void CanvasItemEditor::center_at(const Point2 &p_pos) {
4956
4962
}
4957
4963
4958
4964
CanvasItemEditor::CanvasItemEditor () {
4959
- zoom = 1.0 / MAX (1 , EDSCALE);
4960
- view_offset = Point2 (-150 - RULER_WIDTH, -95 - RULER_WIDTH);
4961
- previous_update_view_offset = view_offset; // Moves the view a little bit to the left so that (0,0) is visible. The values a relative to a 16/10 screen
4962
-
4963
4965
snap_target[0 ] = SNAP_TARGET_NONE;
4964
4966
snap_target[1 ] = SNAP_TARGET_NONE;
4965
4967
@@ -5406,8 +5408,8 @@ CanvasItemEditor::CanvasItemEditor() {
5406
5408
5407
5409
set_process_shortcut_input (true );
5408
5410
5409
- // Update the menus' checkboxes
5410
- call_deferred ( SNAME ( " set_state " ), get_state ());
5411
+ // Update the menus' checkboxes.
5412
+ callable_mp ( this , &CanvasItemEditor::set_state). bind ( get_state ()). call_deferred ( );
5411
5413
}
5412
5414
5413
5415
CanvasItemEditor *CanvasItemEditor::singleton = nullptr ;
0 commit comments