mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 07:53:26 +00:00
Cache editor setting queried in hot path in 2D editor
This commit is contained in:
parent
3d91a48298
commit
7595a9061d
2 changed files with 4 additions and 2 deletions
|
@ -2754,7 +2754,7 @@ void CanvasItemEditor::_gui_input_viewport(const Ref<InputEvent> &p_event) {
|
|||
Ref<InputEventMouseButton> mb = p_event;
|
||||
bool release_lmb = (mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT); // Required to properly release some stuff (e.g. selection box) while panning.
|
||||
|
||||
if (EDITOR_GET("editors/panning/simple_panning") || !pan_pressed || release_lmb) {
|
||||
if (simple_panning || !pan_pressed || release_lmb) {
|
||||
accepted = true;
|
||||
if (_gui_input_rulers_and_guides(p_event)) {
|
||||
// print_line("Rulers and guides");
|
||||
|
@ -4143,7 +4143,8 @@ void CanvasItemEditor::_update_editor_settings() {
|
|||
|
||||
context_toolbar_panel->add_theme_style_override(SceneStringName(panel), get_theme_stylebox(SNAME("ContextualToolbar"), EditorStringName(EditorStyles)));
|
||||
|
||||
panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/2d_editor_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EDITOR_GET("editors/panning/simple_panning")));
|
||||
simple_panning = EDITOR_GET("editors/panning/simple_panning");
|
||||
panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/2d_editor_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), simple_panning);
|
||||
panner->set_scroll_speed(EDITOR_GET("editors/panning/2d_editor_pan_speed"));
|
||||
panner->setup_warped_panning(get_viewport(), EDITOR_GET("editors/panning/warped_mouse_panning"));
|
||||
panner->set_zoom_style((ViewPanner::ZoomStyle)EDITOR_GET("editors/panning/zoom_style").operator int());
|
||||
|
|
|
@ -260,6 +260,7 @@ private:
|
|||
int ruler_font_size = 8;
|
||||
Point2 node_create_position;
|
||||
real_t grab_distance = 0.0;
|
||||
bool simple_panning = false;
|
||||
|
||||
MenuOption last_option;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue