diff --git a/project.godot b/project.godot index 5d3ed5db0..2c65d3aea 100644 --- a/project.godot +++ b/project.godot @@ -149,7 +149,7 @@ boot_splash/bg_color=Color( 0.145098, 0.145098, 0.164706, 1 ) config/icon="res://assets/graphics/icons/icon.png" config/macos_native_icon="res://assets/graphics/icons/icon.icns" config/windows_native_icon="res://assets/graphics/icons/icon.ico" -config/Version="v0.9.1-rc1" +config/Version="v0.9.1-rc2" run/low_processor_mode.Android=false [audio] diff --git a/src/Tools/BaseTool.gd b/src/Tools/BaseTool.gd index 8a3c288f5..09baa83fe 100644 --- a/src/Tools/BaseTool.gd +++ b/src/Tools/BaseTool.gd @@ -1,6 +1,7 @@ class_name BaseTool extends VBoxContainer +var is_moving = false var kname: String var tool_slot = null # Tools.Slot, can't have static typing due to cyclic errors var cursor_text := "" @@ -86,6 +87,21 @@ func update_config() -> void: pass +func draw_start(_position: Vector2) -> void: + is_moving = true + + +func draw_move(position: Vector2) -> void: + # This can happen if the user switches between tools with a shortcut + # while using another tool + if !is_moving: + draw_start(position) + + +func draw_end(_position: Vector2) -> void: + is_moving = false + + func cursor_move(position: Vector2) -> void: _cursor = position @@ -165,3 +181,8 @@ func _add_polylines_segment(lines: Array, start: Vector2, end: Vector2) -> void: line.append(start) return lines.append([start, end]) + + +func _exit_tree() -> void: + if is_moving: + draw_end(Global.canvas.current_pixel.floor()) diff --git a/src/Tools/Bucket.gd b/src/Tools/Bucket.gd index 98dddf3a1..b270b6b43 100644 --- a/src/Tools/Bucket.gd +++ b/src/Tools/Bucket.gd @@ -110,6 +110,7 @@ func update_pattern() -> void: func draw_start(position: Vector2) -> void: + .draw_start(position) if Input.is_action_pressed("alt"): _pick_color(position) return @@ -133,12 +134,12 @@ func draw_start(position: Vector2) -> void: commit_undo("Draw", undo_data) -func draw_move(_position: Vector2) -> void: - pass +func draw_move(position: Vector2) -> void: + .draw_move(position) -func draw_end(_position: Vector2) -> void: - pass +func draw_end(position: Vector2) -> void: + .draw_end(position) func fill_in_color(position: Vector2) -> void: diff --git a/src/Tools/ColorPicker.gd b/src/Tools/ColorPicker.gd index 0e434f1d3..febd9202d 100644 --- a/src/Tools/ColorPicker.gd +++ b/src/Tools/ColorPicker.gd @@ -38,15 +38,17 @@ func update_config() -> void: func draw_start(position: Vector2) -> void: + .draw_start(position) _pick_color(position) func draw_move(position: Vector2) -> void: + .draw_move(position) _pick_color(position) -func draw_end(_position: Vector2) -> void: - pass +func draw_end(position: Vector2) -> void: + .draw_end(position) func _pick_color(position: Vector2) -> void: diff --git a/src/Tools/Eraser.gd b/src/Tools/Eraser.gd index ff9dab4cc..338a4f8da 100644 --- a/src/Tools/Eraser.gd +++ b/src/Tools/Eraser.gd @@ -35,6 +35,7 @@ func set_config(config: Dictionary) -> void: func draw_start(position: Vector2) -> void: + .draw_start(position) if Input.is_action_pressed("alt"): _picking_color = true _pick_color(position) @@ -62,6 +63,7 @@ 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("alt"): _pick_color(position) @@ -79,7 +81,8 @@ func draw_move(position: Vector2) -> void: Global.canvas.sprite_changed_this_frame = true -func draw_end(_position: Vector2) -> void: +func draw_end(position: Vector2) -> void: + .draw_end(position) if _picking_color: return diff --git a/src/Tools/LineTool.gd b/src/Tools/LineTool.gd index 447cf3d95..61238fdfa 100644 --- a/src/Tools/LineTool.gd +++ b/src/Tools/LineTool.gd @@ -68,6 +68,7 @@ func _input(event: InputEvent) -> void: func draw_start(position: Vector2) -> void: + .draw_start(position) if Input.is_action_pressed("alt"): _picking_color = true _pick_color(position) @@ -85,6 +86,7 @@ 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("alt"): _pick_color(position) @@ -103,7 +105,8 @@ func draw_move(position: Vector2) -> void: _offset = position -func draw_end(_position: Vector2) -> void: +func draw_end(position: Vector2) -> void: + .draw_end(position) if _picking_color: return diff --git a/src/Tools/Move.gd b/src/Tools/Move.gd index b7ec99345..03221424f 100644 --- a/src/Tools/Move.gd +++ b/src/Tools/Move.gd @@ -30,6 +30,7 @@ func _input(event: InputEvent) -> void: func draw_start(position: Vector2) -> void: + .draw_start(position) if !Global.current_project.layers[Global.current_project.current_layer].can_layer_get_drawn(): return _start_pos = position @@ -41,6 +42,7 @@ func draw_start(position: Vector2) -> void: func draw_move(position: Vector2) -> void: + .draw_move(position) if !Global.current_project.layers[Global.current_project.current_layer].can_layer_get_drawn(): return # This is true if content transformation has been confirmed (pressed Enter for example) @@ -65,6 +67,7 @@ func draw_move(position: Vector2) -> void: func draw_end(position: Vector2) -> void: + .draw_end(position) if !Global.current_project.layers[Global.current_project.current_layer].can_layer_get_drawn(): return if ( diff --git a/src/Tools/Pan.gd b/src/Tools/Pan.gd index 9bb1909d9..81e68d7c6 100644 --- a/src/Tools/Pan.gd +++ b/src/Tools/Pan.gd @@ -1,15 +1,17 @@ extends BaseTool -func draw_start(_position: Vector2) -> void: +func draw_start(position: Vector2) -> void: + .draw_start(position) Global.camera.drag = true Global.camera2.drag = true -func draw_move(_position: Vector2) -> void: - pass +func draw_move(position: Vector2) -> void: + .draw_move(position) -func draw_end(_position: Vector2) -> void: +func draw_end(position: Vector2) -> void: + .draw_end(position) Global.camera.drag = false Global.camera2.drag = false diff --git a/src/Tools/Pencil.gd b/src/Tools/Pencil.gd index a2a06b031..d7cc0705f 100644 --- a/src/Tools/Pencil.gd +++ b/src/Tools/Pencil.gd @@ -70,6 +70,7 @@ func update_config() -> void: func draw_start(position: Vector2) -> void: + .draw_start(position) if Input.is_action_pressed("alt"): _picking_color = true _pick_color(position) @@ -101,6 +102,7 @@ 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("alt"): _pick_color(position) @@ -120,7 +122,8 @@ func draw_move(position: Vector2) -> void: _draw_points.append(position) -func draw_end(_position: Vector2) -> void: +func draw_end(position: Vector2) -> void: + .draw_end(position) if _picking_color: return @@ -130,7 +133,7 @@ func draw_end(_position: Vector2) -> void: _draw_line = false else: if _fill_inside: - _draw_points.append(_position) + _draw_points.append(position) if _draw_points.size() > 3: var v = Vector2() var image_size = Global.current_project.size diff --git a/src/Tools/SelectionTools/SelectionTool.gd b/src/Tools/SelectionTools/SelectionTool.gd index 152f6d957..2a2437b2f 100644 --- a/src/Tools/SelectionTools/SelectionTool.gd +++ b/src/Tools/SelectionTools/SelectionTool.gd @@ -61,6 +61,7 @@ func set_spinbox_values() -> void: func draw_start(position: Vector2) -> void: + .draw_start(position) if selection_node.arrow_key_move: return var project: Project = Global.current_project @@ -136,6 +137,7 @@ func draw_start(position: Vector2) -> void: func draw_move(position: Vector2) -> void: + .draw_move(position) if selection_node.arrow_key_move: return # This is true if content transformation has been confirmed (pressed Enter for example) @@ -162,14 +164,15 @@ func draw_move(position: Vector2) -> void: _set_cursor_text(selection_node.big_bounding_rectangle) -func draw_end(_position: Vector2) -> void: +func draw_end(position: Vector2) -> void: + .draw_end(position) if selection_node.arrow_key_move: return if _content_transformation_check == selection_node.is_moving_content: if _move: selection_node.move_borders_end() else: - apply_selection(_position) + apply_selection(position) _move = false _snap_to_grid = false diff --git a/src/Tools/Shading.gd b/src/Tools/Shading.gd index 73b076136..8f304dcdb 100644 --- a/src/Tools/Shading.gd +++ b/src/Tools/Shading.gd @@ -210,6 +210,7 @@ func update_strength() -> void: func draw_start(position: Vector2) -> void: + .draw_start(position) if Input.is_action_pressed("alt"): _picking_color = true _pick_color(position) @@ -237,6 +238,7 @@ 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("alt"): _pick_color(position) @@ -254,7 +256,8 @@ func draw_move(position: Vector2) -> void: Global.canvas.sprite_changed_this_frame = true -func draw_end(_position: Vector2) -> void: +func draw_end(position: Vector2) -> void: + .draw_end(position) if _picking_color: return diff --git a/src/Tools/ShapeDrawer.gd b/src/Tools/ShapeDrawer.gd index d76514575..ded574b20 100644 --- a/src/Tools/ShapeDrawer.gd +++ b/src/Tools/ShapeDrawer.gd @@ -83,6 +83,7 @@ func _input(event: InputEvent) -> void: func draw_start(position: Vector2) -> void: + .draw_start(position) if Input.is_action_pressed("alt"): _picking_color = true _pick_color(position) @@ -99,6 +100,7 @@ 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("alt"): _pick_color(position) @@ -113,6 +115,7 @@ func draw_move(position: Vector2) -> void: func draw_end(position: Vector2) -> void: + .draw_end(position) if _picking_color: return diff --git a/src/Tools/Zoom.gd b/src/Tools/Zoom.gd index f530ccabb..bc14baa8c 100644 --- a/src/Tools/Zoom.gd +++ b/src/Tools/Zoom.gd @@ -47,7 +47,8 @@ func update_config() -> void: $ModeOptions.selected = _zoom_mode -func draw_start(_position: Vector2) -> void: +func draw_start(position: Vector2) -> void: + .draw_start(position) var mouse_pos := get_global_mouse_position() var viewport_rect := Rect2( Global.main_viewport.rect_global_position, Global.main_viewport.rect_size @@ -62,9 +63,10 @@ func draw_start(_position: Vector2) -> void: Global.camera2.zoom_camera(_zoom_mode * 2 - 1) -func draw_move(_position: Vector2) -> void: +func draw_move(position: Vector2) -> void: + .draw_move(position) Global.camera.zoom_camera(-_relative.x / 3) -func draw_end(_position: Vector2) -> void: - pass +func draw_end(position: Vector2) -> void: + .draw_end(position)