void CodeTextEditor::_text_editor_gui_input(const Ref<InputEvent> &p_event) { Ref<InputEventMouseButton> mb = p_event; if (mb.is_valid()) { if (mb->is_pressed() && mb->get_command()) { if (mb->get_button_index() == BUTTON_WHEEL_UP) { _zoom_in(); } else if (mb->get_button_index() == BUTTON_WHEEL_DOWN) { _zoom_out(); } } } Ref<InputEventKey> k = p_event; if (k.is_valid()) { if (k->is_pressed()) { if (ED_IS_SHORTCUT("script_editor/zoom_in", p_event)) { _zoom_in(); } if (ED_IS_SHORTCUT("script_editor/zoom_out", p_event)) { _zoom_out(); } if (ED_IS_SHORTCUT("script_editor/reset_zoom", p_event)) { _reset_zoom(); } } } }
void CodeTextEditor::_text_editor_input_event(const InputEvent& p_event) { if (p_event.type==InputEvent::MOUSE_BUTTON) { const InputEventMouseButton& mb=p_event.mouse_button; if (mb.pressed && mb.mod.command) { if (mb.button_index==BUTTON_WHEEL_UP) { _zoom_in(); } else if (mb.button_index==BUTTON_WHEEL_DOWN) { _zoom_out(); } } } else if (p_event.type==InputEvent::KEY) { if (p_event.key.pressed) { if (ED_IS_SHORTCUT("script_editor/zoom_in", p_event)) { _zoom_in(); } if (ED_IS_SHORTCUT("script_editor/zoom_out", p_event)) { _zoom_out(); } if (ED_IS_SHORTCUT("script_editor/reset_zoom", p_event)) { _reset_zoom(); } } } }
void CodeTextEditor::_text_editor_gui_input(const Ref<InputEvent> &p_event) { Ref<InputEventMouseButton> mb = p_event; if (mb.is_valid()) { if (mb->is_pressed() && mb->get_command()) { if (mb->get_button_index() == BUTTON_WHEEL_UP) { _zoom_in(); } else if (mb->get_button_index() == BUTTON_WHEEL_DOWN) { _zoom_out(); } } } Ref<InputEventMagnifyGesture> magnify_gesture = p_event; if (magnify_gesture.is_valid()) { Ref<DynamicFont> font = text_editor->get_font("font"); if (font.is_valid()) { if (font->get_size() != (int)font_size) { font_size = font->get_size(); } font_size *= powf(magnify_gesture->get_factor(), 0.25); _add_font_size((int)font_size - font->get_size()); } return; } Ref<InputEventKey> k = p_event; if (k.is_valid()) { if (k->is_pressed()) { if (ED_IS_SHORTCUT("script_editor/zoom_in", p_event)) { _zoom_in(); } if (ED_IS_SHORTCUT("script_editor/zoom_out", p_event)) { _zoom_out(); } if (ED_IS_SHORTCUT("script_editor/reset_zoom", p_event)) { _reset_zoom(); } } } }