mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-02-13 01:03:07 +00:00
make active_button public
This commit is contained in:
parent
dcf26084df
commit
dc000f7267
|
@ -305,7 +305,6 @@ func current_palette_select_color(mouse_button: int, index: int) -> void:
|
||||||
Tools.assign_color(color, mouse_button)
|
Tools.assign_color(color, mouse_button)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
func _select_color(mouse_button: int, index: int) -> void:
|
func _select_color(mouse_button: int, index: int) -> void:
|
||||||
match mouse_button:
|
match mouse_button:
|
||||||
MOUSE_BUTTON_LEFT:
|
MOUSE_BUTTON_LEFT:
|
||||||
|
|
|
@ -12,6 +12,7 @@ enum Dynamics { NONE, PRESSURE, VELOCITY }
|
||||||
const XY_LINE := Vector2(-0.707107, 0.707107)
|
const XY_LINE := Vector2(-0.707107, 0.707107)
|
||||||
const X_MINUS_Y_LINE := Vector2(0.707107, 0.707107)
|
const X_MINUS_Y_LINE := Vector2(0.707107, 0.707107)
|
||||||
|
|
||||||
|
var active_button := -1
|
||||||
var picking_color_for := MOUSE_BUTTON_LEFT
|
var picking_color_for := MOUSE_BUTTON_LEFT
|
||||||
var horizontal_mirror := false
|
var horizontal_mirror := false
|
||||||
var vertical_mirror := false
|
var vertical_mirror := false
|
||||||
|
@ -238,7 +239,6 @@ var _right_tools_per_layer_type := {
|
||||||
Global.LayerTypes.THREE_D: "Pan",
|
Global.LayerTypes.THREE_D: "Pan",
|
||||||
}
|
}
|
||||||
var _tool_buttons: Node
|
var _tool_buttons: Node
|
||||||
var _active_button := -1
|
|
||||||
var _last_position := Vector2i(Vector2.INF)
|
var _last_position := Vector2i(Vector2.INF)
|
||||||
|
|
||||||
|
|
||||||
|
@ -627,32 +627,32 @@ func handle_draw(position: Vector2i, event: InputEvent) -> void:
|
||||||
change_layer_automatically(draw_pos)
|
change_layer_automatically(draw_pos)
|
||||||
return
|
return
|
||||||
|
|
||||||
if event.is_action_pressed(&"activate_left_tool") and _active_button == -1 and not pen_inverted:
|
if event.is_action_pressed(&"activate_left_tool") and active_button == -1 and not pen_inverted:
|
||||||
_active_button = MOUSE_BUTTON_LEFT
|
active_button = MOUSE_BUTTON_LEFT
|
||||||
_slots[_active_button].tool_node.draw_start(draw_pos)
|
_slots[active_button].tool_node.draw_start(draw_pos)
|
||||||
elif event.is_action_released(&"activate_left_tool") and _active_button == MOUSE_BUTTON_LEFT:
|
elif event.is_action_released(&"activate_left_tool") and active_button == MOUSE_BUTTON_LEFT:
|
||||||
_slots[_active_button].tool_node.draw_end(draw_pos)
|
_slots[active_button].tool_node.draw_end(draw_pos)
|
||||||
_active_button = -1
|
active_button = -1
|
||||||
elif (
|
elif (
|
||||||
(
|
(
|
||||||
event.is_action_pressed(&"activate_right_tool")
|
event.is_action_pressed(&"activate_right_tool")
|
||||||
and _active_button == -1
|
and active_button == -1
|
||||||
and not pen_inverted
|
and not pen_inverted
|
||||||
)
|
)
|
||||||
or (
|
or (
|
||||||
event.is_action_pressed(&"activate_left_tool") and _active_button == -1 and pen_inverted
|
event.is_action_pressed(&"activate_left_tool") and active_button == -1 and pen_inverted
|
||||||
)
|
)
|
||||||
):
|
):
|
||||||
_active_button = MOUSE_BUTTON_RIGHT
|
active_button = MOUSE_BUTTON_RIGHT
|
||||||
_slots[_active_button].tool_node.draw_start(draw_pos)
|
_slots[active_button].tool_node.draw_start(draw_pos)
|
||||||
elif (
|
elif (
|
||||||
(event.is_action_released(&"activate_right_tool") and _active_button == MOUSE_BUTTON_RIGHT)
|
(event.is_action_released(&"activate_right_tool") and active_button == MOUSE_BUTTON_RIGHT)
|
||||||
or (
|
or (
|
||||||
event.is_action_released(&"activate_left_tool") and _active_button == MOUSE_BUTTON_RIGHT
|
event.is_action_released(&"activate_left_tool") and active_button == MOUSE_BUTTON_RIGHT
|
||||||
)
|
)
|
||||||
):
|
):
|
||||||
_slots[_active_button].tool_node.draw_end(draw_pos)
|
_slots[active_button].tool_node.draw_end(draw_pos)
|
||||||
_active_button = -1
|
active_button = -1
|
||||||
|
|
||||||
if event is InputEventMouseMotion:
|
if event is InputEventMouseMotion:
|
||||||
pen_pressure = event.pressure
|
pen_pressure = event.pressure
|
||||||
|
@ -683,8 +683,8 @@ func handle_draw(position: Vector2i, event: InputEvent) -> void:
|
||||||
_last_position = position
|
_last_position = position
|
||||||
_slots[MOUSE_BUTTON_LEFT].tool_node.cursor_move(position)
|
_slots[MOUSE_BUTTON_LEFT].tool_node.cursor_move(position)
|
||||||
_slots[MOUSE_BUTTON_RIGHT].tool_node.cursor_move(position)
|
_slots[MOUSE_BUTTON_RIGHT].tool_node.cursor_move(position)
|
||||||
if _active_button != -1:
|
if active_button != -1:
|
||||||
_slots[_active_button].tool_node.draw_move(draw_pos)
|
_slots[active_button].tool_node.draw_move(draw_pos)
|
||||||
|
|
||||||
var project := Global.current_project
|
var project := Global.current_project
|
||||||
var text := "[%s×%s]" % [project.size.x, project.size.y]
|
var text := "[%s×%s]" % [project.size.x, project.size.y]
|
||||||
|
|
|
@ -142,6 +142,13 @@ func set_pixelv_custom(point: Vector2i, color: Color) -> void:
|
||||||
if not color.is_equal_approx(TRANSPARENT):
|
if not color.is_equal_approx(TRANSPARENT):
|
||||||
if palette.has(color):
|
if palette.has(color):
|
||||||
color_index = palette.find(color)
|
color_index = palette.find(color)
|
||||||
|
## If the color selected in the palette is the same then it should take prioity.
|
||||||
|
#var selected_index = Palettes.current_palette_get_selected_color_index(
|
||||||
|
#Tools.active_button
|
||||||
|
#)
|
||||||
|
#if selected_index != -1:
|
||||||
|
#if Palettes.current_palette_get_color(selected_index) == color:
|
||||||
|
#color_index = selected_index
|
||||||
else: # Find the most similar color
|
else: # Find the most similar color
|
||||||
var smaller_distance := color_distance(color, palette[0])
|
var smaller_distance := color_distance(color, palette[0])
|
||||||
for i in palette.size():
|
for i in palette.size():
|
||||||
|
|
Loading…
Reference in a new issue