You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-12 13:20:55 +00:00
Adds a scale_gizmo_handles entry to the Touchscreen editor settings
When enabled, this scales the editor icons to improve usability on touchscreen devices. In addition this commit fixes touch detection for the collision_shape_2d_editor_plugin so it scales with the icons size.
This commit is contained in:
@@ -33,6 +33,7 @@
|
||||
#include "canvas_item_editor_plugin.h"
|
||||
#include "core/os/keyboard.h"
|
||||
#include "editor/editor_node.h"
|
||||
#include "editor/editor_settings.h"
|
||||
#include "editor/editor_undo_redo_manager.h"
|
||||
#include "scene/resources/capsule_shape_2d.h"
|
||||
#include "scene/resources/circle_shape_2d.h"
|
||||
@@ -44,6 +45,10 @@
|
||||
#include "scene/resources/world_boundary_shape_2d.h"
|
||||
#include "scene/scene_string_names.h"
|
||||
|
||||
CollisionShape2DEditor::CollisionShape2DEditor() {
|
||||
grab_threshold = EDITOR_GET("editors/polygon_editor/point_grab_radius");
|
||||
}
|
||||
|
||||
void CollisionShape2DEditor::_node_removed(Node *p_node) {
|
||||
if (p_node == node) {
|
||||
node = nullptr;
|
||||
@@ -307,7 +312,7 @@ bool CollisionShape2DEditor::forward_canvas_gui_input(const Ref<InputEvent> &p_e
|
||||
if (mb->get_button_index() == MouseButton::LEFT) {
|
||||
if (mb->is_pressed()) {
|
||||
for (int i = 0; i < handles.size(); i++) {
|
||||
if (xform.xform(handles[i]).distance_to(gpoint) < 8) {
|
||||
if (xform.xform(handles[i]).distance_to(gpoint) < grab_threshold) {
|
||||
edit_handle = i;
|
||||
|
||||
break;
|
||||
@@ -529,6 +534,12 @@ void CollisionShape2DEditor::_notification(int p_what) {
|
||||
_shape_changed();
|
||||
}
|
||||
} break;
|
||||
|
||||
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
|
||||
if (EditorSettings::get_singleton()->check_changed_settings_in_group("editors/polygon_editor/point_grab_radius")) {
|
||||
grab_threshold = EDITOR_GET("editors/polygon_editor/point_grab_radius");
|
||||
}
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user