1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-31 07:29:49 +00:00
This commit is contained in:
Manolis Papadeas 2021-12-15 01:39:24 +02:00
parent 28341a18d2
commit 92c252e22d
13 changed files with 71 additions and 22 deletions

View file

@ -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/icon="res://assets/graphics/icons/icon.png"
config/macos_native_icon="res://assets/graphics/icons/icon.icns" config/macos_native_icon="res://assets/graphics/icons/icon.icns"
config/windows_native_icon="res://assets/graphics/icons/icon.ico" 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 run/low_processor_mode.Android=false
[audio] [audio]

View file

@ -1,6 +1,7 @@
class_name BaseTool class_name BaseTool
extends VBoxContainer extends VBoxContainer
var is_moving = false
var kname: String var kname: String
var tool_slot = null # Tools.Slot, can't have static typing due to cyclic errors var tool_slot = null # Tools.Slot, can't have static typing due to cyclic errors
var cursor_text := "" var cursor_text := ""
@ -86,6 +87,21 @@ func update_config() -> void:
pass 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: func cursor_move(position: Vector2) -> void:
_cursor = position _cursor = position
@ -165,3 +181,8 @@ func _add_polylines_segment(lines: Array, start: Vector2, end: Vector2) -> void:
line.append(start) line.append(start)
return return
lines.append([start, end]) lines.append([start, end])
func _exit_tree() -> void:
if is_moving:
draw_end(Global.canvas.current_pixel.floor())

View file

@ -110,6 +110,7 @@ func update_pattern() -> void:
func draw_start(position: Vector2) -> void: func draw_start(position: Vector2) -> void:
.draw_start(position)
if Input.is_action_pressed("alt"): if Input.is_action_pressed("alt"):
_pick_color(position) _pick_color(position)
return return
@ -133,12 +134,12 @@ func draw_start(position: Vector2) -> void:
commit_undo("Draw", undo_data) commit_undo("Draw", undo_data)
func draw_move(_position: Vector2) -> void: func draw_move(position: Vector2) -> void:
pass .draw_move(position)
func draw_end(_position: Vector2) -> void: func draw_end(position: Vector2) -> void:
pass .draw_end(position)
func fill_in_color(position: Vector2) -> void: func fill_in_color(position: Vector2) -> void:

View file

@ -38,15 +38,17 @@ func update_config() -> void:
func draw_start(position: Vector2) -> void: func draw_start(position: Vector2) -> void:
.draw_start(position)
_pick_color(position) _pick_color(position)
func draw_move(position: Vector2) -> void: func draw_move(position: Vector2) -> void:
.draw_move(position)
_pick_color(position) _pick_color(position)
func draw_end(_position: Vector2) -> void: func draw_end(position: Vector2) -> void:
pass .draw_end(position)
func _pick_color(position: Vector2) -> void: func _pick_color(position: Vector2) -> void:

View file

@ -35,6 +35,7 @@ func set_config(config: Dictionary) -> void:
func draw_start(position: Vector2) -> void: func draw_start(position: Vector2) -> void:
.draw_start(position)
if Input.is_action_pressed("alt"): if Input.is_action_pressed("alt"):
_picking_color = true _picking_color = true
_pick_color(position) _pick_color(position)
@ -62,6 +63,7 @@ func draw_start(position: Vector2) -> void:
func draw_move(position: Vector2) -> void: func draw_move(position: Vector2) -> void:
.draw_move(position)
if _picking_color: # Still return even if we released Alt if _picking_color: # Still return even if we released Alt
if Input.is_action_pressed("alt"): if Input.is_action_pressed("alt"):
_pick_color(position) _pick_color(position)
@ -79,7 +81,8 @@ func draw_move(position: Vector2) -> void:
Global.canvas.sprite_changed_this_frame = true 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: if _picking_color:
return return

View file

@ -68,6 +68,7 @@ func _input(event: InputEvent) -> void:
func draw_start(position: Vector2) -> void: func draw_start(position: Vector2) -> void:
.draw_start(position)
if Input.is_action_pressed("alt"): if Input.is_action_pressed("alt"):
_picking_color = true _picking_color = true
_pick_color(position) _pick_color(position)
@ -85,6 +86,7 @@ func draw_start(position: Vector2) -> void:
func draw_move(position: Vector2) -> void: func draw_move(position: Vector2) -> void:
.draw_move(position)
if _picking_color: # Still return even if we released Alt if _picking_color: # Still return even if we released Alt
if Input.is_action_pressed("alt"): if Input.is_action_pressed("alt"):
_pick_color(position) _pick_color(position)
@ -103,7 +105,8 @@ func draw_move(position: Vector2) -> void:
_offset = position _offset = position
func draw_end(_position: Vector2) -> void: func draw_end(position: Vector2) -> void:
.draw_end(position)
if _picking_color: if _picking_color:
return return

View file

@ -30,6 +30,7 @@ func _input(event: InputEvent) -> void:
func draw_start(position: Vector2) -> void: func draw_start(position: Vector2) -> void:
.draw_start(position)
if !Global.current_project.layers[Global.current_project.current_layer].can_layer_get_drawn(): if !Global.current_project.layers[Global.current_project.current_layer].can_layer_get_drawn():
return return
_start_pos = position _start_pos = position
@ -41,6 +42,7 @@ func draw_start(position: Vector2) -> void:
func draw_move(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(): if !Global.current_project.layers[Global.current_project.current_layer].can_layer_get_drawn():
return return
# This is true if content transformation has been confirmed (pressed Enter for example) # 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: func draw_end(position: Vector2) -> void:
.draw_end(position)
if !Global.current_project.layers[Global.current_project.current_layer].can_layer_get_drawn(): if !Global.current_project.layers[Global.current_project.current_layer].can_layer_get_drawn():
return return
if ( if (

View file

@ -1,15 +1,17 @@
extends BaseTool extends BaseTool
func draw_start(_position: Vector2) -> void: func draw_start(position: Vector2) -> void:
.draw_start(position)
Global.camera.drag = true Global.camera.drag = true
Global.camera2.drag = true Global.camera2.drag = true
func draw_move(_position: Vector2) -> void: func draw_move(position: Vector2) -> void:
pass .draw_move(position)
func draw_end(_position: Vector2) -> void: func draw_end(position: Vector2) -> void:
.draw_end(position)
Global.camera.drag = false Global.camera.drag = false
Global.camera2.drag = false Global.camera2.drag = false

View file

@ -70,6 +70,7 @@ func update_config() -> void:
func draw_start(position: Vector2) -> void: func draw_start(position: Vector2) -> void:
.draw_start(position)
if Input.is_action_pressed("alt"): if Input.is_action_pressed("alt"):
_picking_color = true _picking_color = true
_pick_color(position) _pick_color(position)
@ -101,6 +102,7 @@ func draw_start(position: Vector2) -> void:
func draw_move(position: Vector2) -> void: func draw_move(position: Vector2) -> void:
.draw_move(position)
if _picking_color: # Still return even if we released Alt if _picking_color: # Still return even if we released Alt
if Input.is_action_pressed("alt"): if Input.is_action_pressed("alt"):
_pick_color(position) _pick_color(position)
@ -120,7 +122,8 @@ func draw_move(position: Vector2) -> void:
_draw_points.append(position) _draw_points.append(position)
func draw_end(_position: Vector2) -> void: func draw_end(position: Vector2) -> void:
.draw_end(position)
if _picking_color: if _picking_color:
return return
@ -130,7 +133,7 @@ func draw_end(_position: Vector2) -> void:
_draw_line = false _draw_line = false
else: else:
if _fill_inside: if _fill_inside:
_draw_points.append(_position) _draw_points.append(position)
if _draw_points.size() > 3: if _draw_points.size() > 3:
var v = Vector2() var v = Vector2()
var image_size = Global.current_project.size var image_size = Global.current_project.size

View file

@ -61,6 +61,7 @@ func set_spinbox_values() -> void:
func draw_start(position: Vector2) -> void: func draw_start(position: Vector2) -> void:
.draw_start(position)
if selection_node.arrow_key_move: if selection_node.arrow_key_move:
return return
var project: Project = Global.current_project var project: Project = Global.current_project
@ -136,6 +137,7 @@ func draw_start(position: Vector2) -> void:
func draw_move(position: Vector2) -> void: func draw_move(position: Vector2) -> void:
.draw_move(position)
if selection_node.arrow_key_move: if selection_node.arrow_key_move:
return return
# This is true if content transformation has been confirmed (pressed Enter for example) # 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) _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: if selection_node.arrow_key_move:
return return
if _content_transformation_check == selection_node.is_moving_content: if _content_transformation_check == selection_node.is_moving_content:
if _move: if _move:
selection_node.move_borders_end() selection_node.move_borders_end()
else: else:
apply_selection(_position) apply_selection(position)
_move = false _move = false
_snap_to_grid = false _snap_to_grid = false

View file

@ -210,6 +210,7 @@ func update_strength() -> void:
func draw_start(position: Vector2) -> void: func draw_start(position: Vector2) -> void:
.draw_start(position)
if Input.is_action_pressed("alt"): if Input.is_action_pressed("alt"):
_picking_color = true _picking_color = true
_pick_color(position) _pick_color(position)
@ -237,6 +238,7 @@ func draw_start(position: Vector2) -> void:
func draw_move(position: Vector2) -> void: func draw_move(position: Vector2) -> void:
.draw_move(position)
if _picking_color: # Still return even if we released Alt if _picking_color: # Still return even if we released Alt
if Input.is_action_pressed("alt"): if Input.is_action_pressed("alt"):
_pick_color(position) _pick_color(position)
@ -254,7 +256,8 @@ func draw_move(position: Vector2) -> void:
Global.canvas.sprite_changed_this_frame = true 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: if _picking_color:
return return

View file

@ -83,6 +83,7 @@ func _input(event: InputEvent) -> void:
func draw_start(position: Vector2) -> void: func draw_start(position: Vector2) -> void:
.draw_start(position)
if Input.is_action_pressed("alt"): if Input.is_action_pressed("alt"):
_picking_color = true _picking_color = true
_pick_color(position) _pick_color(position)
@ -99,6 +100,7 @@ func draw_start(position: Vector2) -> void:
func draw_move(position: Vector2) -> void: func draw_move(position: Vector2) -> void:
.draw_move(position)
if _picking_color: # Still return even if we released Alt if _picking_color: # Still return even if we released Alt
if Input.is_action_pressed("alt"): if Input.is_action_pressed("alt"):
_pick_color(position) _pick_color(position)
@ -113,6 +115,7 @@ func draw_move(position: Vector2) -> void:
func draw_end(position: Vector2) -> void: func draw_end(position: Vector2) -> void:
.draw_end(position)
if _picking_color: if _picking_color:
return return

View file

@ -47,7 +47,8 @@ func update_config() -> void:
$ModeOptions.selected = _zoom_mode $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 mouse_pos := get_global_mouse_position()
var viewport_rect := Rect2( var viewport_rect := Rect2(
Global.main_viewport.rect_global_position, Global.main_viewport.rect_size 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) 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) Global.camera.zoom_camera(-_relative.x / 3)
func draw_end(_position: Vector2) -> void: func draw_end(position: Vector2) -> void:
pass .draw_end(position)