Skip to content

Commit

Permalink
Attempt to fix left tool preview not being shown when a right tool wi…
Browse files Browse the repository at this point in the history
…th a preview is selected

Maybe fixes #1157
  • Loading branch information
OverloadedOrama committed Dec 21, 2024
1 parent 033238b commit 59254b9
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 10 deletions.
3 changes: 1 addition & 2 deletions src/Tools/BaseShapeDrawer.gd
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ func draw_end(pos: Vector2i) -> void:
_start = Vector2i.ZERO
_dest = Vector2i.ZERO
_drawing = false
Global.canvas.previews_sprite.texture = null
_displace_origin = false
cursor_text = ""
super.draw_end(pos)
Expand All @@ -174,8 +175,6 @@ func draw_preview() -> void:
image.set_pixelv(point, Color.WHITE)
var texture := ImageTexture.create_from_image(image)
canvas.texture = texture
else:
canvas.texture = null


func _draw_shape(origin: Vector2i, dest: Vector2i) -> void:
Expand Down
3 changes: 1 addition & 2 deletions src/Tools/DesignTools/LineTool.gd
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ func draw_end(pos: Vector2i) -> void:
_start = Vector2.ZERO
_dest = Vector2.ZERO
_drawing = false
Global.canvas.previews_sprite.texture = null
_displace_origin = false
cursor_text = ""
super.draw_end(pos)
Expand All @@ -163,8 +164,6 @@ func draw_preview() -> void:
image.set_pixelv(point, Color.WHITE)
var texture := ImageTexture.create_from_image(image)
canvas.texture = texture
else:
canvas.texture = null


func _draw_shape() -> void:
Expand Down
3 changes: 1 addition & 2 deletions src/Tools/SelectionTools/EllipseSelect.gd
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ func draw_preview() -> void:
image.set_pixelv(point, Color.WHITE)
var texture := ImageTexture.create_from_image(image)
canvas.texture = texture
else:
canvas.texture = null


func apply_selection(_position: Vector2i) -> void:
Expand Down Expand Up @@ -111,6 +109,7 @@ func apply_selection(_position: Vector2i) -> void:

Global.canvas.selection.big_bounding_rectangle = project.selection_map.get_used_rect()
Global.canvas.selection.commit_undo("Select", undo_data)
Global.canvas.previews_sprite.texture = null


func set_ellipse(selection_map: SelectionMap, pos: Vector2i) -> void:
Expand Down
3 changes: 1 addition & 2 deletions src/Tools/SelectionTools/Lasso.gd
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ func draw_preview() -> void:
image.set_pixelv(draw_point, Color.WHITE)
var texture := ImageTexture.create_from_image(image)
canvas.texture = texture
else:
canvas.texture = null


func apply_selection(_position) -> void:
Expand All @@ -82,6 +80,7 @@ func apply_selection(_position) -> void:
Global.canvas.selection.commit_undo("Select", undo_data)
_draw_points.clear()
_last_position = Vector2.INF
Global.canvas.previews_sprite.texture = null


func lasso_selection(
Expand Down
3 changes: 1 addition & 2 deletions src/Tools/SelectionTools/PaintSelect.gd
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ func draw_preview() -> void:
image.set_pixelv(draw_point, Color.WHITE)
var texture := ImageTexture.create_from_image(image)
canvas.texture = texture
else:
canvas.texture = null


func apply_selection(pos: Vector2i) -> void:
Expand Down Expand Up @@ -111,6 +109,7 @@ func apply_selection(pos: Vector2i) -> void:
Global.canvas.selection.commit_undo("Select", undo_data)
_draw_points.clear()
_last_position = Vector2.INF
Global.canvas.previews_sprite.texture = null


func paint_selection(
Expand Down

0 comments on commit 59254b9

Please sign in to comment.