1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-03-13 06:45:17 +00:00

Move Guides without moving mouse outside canvas (#647)

* guide movement enhancement

* Gave more access to pan tool

* Update Guide.gd

* Update Guide.gd

* Update Tools.gd
This commit is contained in:
Variable 2022-02-11 06:16:33 +05:00 committed by GitHub
parent 74df57ed70
commit 25fd6026be
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 1 deletions
src
Autoload
UI/Canvas/Rulers

View file

@ -22,6 +22,7 @@ var ui_tooltips := {}
# Canvas related stuff # Canvas related stuff
var layers_changed_skip := false var layers_changed_skip := false
var can_draw := false var can_draw := false
var move_guides_on_canvas := false
var has_focus := false var has_focus := false
var play_only_tags := true var play_only_tags := true

View file

@ -99,6 +99,11 @@ func set_tool(name: String, button: int) -> void:
var slot = _slots[button] var slot = _slots[button]
var panel: Node = _panels[button] var panel: Node = _panels[button]
var node: Node = _tools[name].instance() var node: Node = _tools[name].instance()
if button == BUTTON_LEFT: # As guides are only moved with left mouse
if name == "Pan": # tool you want to give more access at guides
Global.move_guides_on_canvas = true
else:
Global.move_guides_on_canvas = false
node.name = name node.name = name
node.tool_slot = slot node.tool_slot = slot
slot.tool_node = node slot.tool_node = node

View file

@ -41,7 +41,10 @@ func _input(_event: InputEvent) -> void:
and point_in_rectangle(mouse_pos, point0, point1) and point_in_rectangle(mouse_pos, point0, point1)
and Input.is_action_just_pressed("left_mouse") and Input.is_action_just_pressed("left_mouse")
): ):
if !point_in_rectangle(Global.canvas.current_pixel, Vector2.ZERO, project.size): if (
!point_in_rectangle(Global.canvas.current_pixel, Vector2.ZERO, project.size)
or Global.move_guides_on_canvas
):
has_focus = true has_focus = true
Global.has_focus = false Global.has_focus = false
update() update()