Skip to content

Commit

Permalink
Fix wrong color picker shortcut in shape tools and remove unneeded me…
Browse files Browse the repository at this point in the history
…thod
  • Loading branch information
OverloadedOrama committed Jul 4, 2022
1 parent feb68a2 commit 55935bc
Showing 1 changed file with 4 additions and 17 deletions.
21 changes: 4 additions & 17 deletions src/Tools/ShapeDrawer.gd
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func _input(event: InputEvent) -> void:

func draw_start(position: Vector2) -> void:
.draw_start(position)
if Input.is_action_pressed("shape_displace"):
if Input.is_action_pressed("draw_color_picker"):
_picking_color = true
_pick_color(position)
return
Expand All @@ -101,8 +101,8 @@ func draw_start(position: Vector2) -> void:

func draw_move(position: Vector2) -> void:
.draw_move(position)
if _picking_color: # Still return even if we released Alt
if Input.is_action_pressed("shape_displace"):
if _picking_color: # Still return even if we released draw_color_picker (Alt)
if Input.is_action_pressed("draw_color_picker"):
_pick_color(position)
return

Expand Down Expand Up @@ -165,7 +165,7 @@ func _draw_shape(origin: Vector2, dest: Vector2) -> void:
# Given an origin point and destination point, returns a rect representing
# where the shape will be drawn and what is its size
func _get_result_rect(origin: Vector2, dest: Vector2) -> Rect2:
var rect := Rect2(Vector2.ZERO, Vector2.ZERO)
var rect := Rect2()

# Center the rect on the mouse
if Input.is_action_pressed("shape_center"):
Expand Down Expand Up @@ -198,19 +198,6 @@ func _get_points(size: Vector2) -> PoolVector2Array:
return _get_shape_points_filled(size) if _fill else _get_shape_points(size)


func _outline_point(p: Vector2, thickness: int = 1, include_p: bool = true) -> Array:
var array := []

if thickness != 1:
var t_of = thickness - 1
for x in range(-t_of, thickness):
for y in range(-t_of, thickness):
if x == 0 and y == 0 and not include_p:
continue
array.append(p + Vector2(x, y))
return array


func _set_cursor_text(rect: Rect2) -> void:
cursor_text = "%s, %s" % [rect.position.x, rect.position.y]
cursor_text += " -> %s, %s" % [rect.end.x - 1, rect.end.y - 1]
Expand Down

0 comments on commit 55935bc

Please sign in to comment.