1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-31 07:29:49 +00:00

Fixed line making with Shift and don't let color picker pick colors outside of canvas

This commit is contained in:
OverloadedOrama 2020-05-31 16:24:08 +03:00
parent 5b7d161ecf
commit 37a8ad2447
2 changed files with 18 additions and 17 deletions

View file

@ -433,7 +433,8 @@ func _input(event : InputEvent) -> void:
Global.selection_rectangle.polygon[2] = end_pos
Global.selection_rectangle.polygon[3] = Vector2(start_pos.x, end_pos.y)
Global.Tools.COLORPICKER:
if can_handle:
var canvas_rect := Rect2(location, size)
if can_handle && canvas_rect.has_point(mouse_pos):
var image_data := Image.new()
image_data.copy_from(sprite)
image_data.lock()
@ -451,7 +452,7 @@ func _input(event : InputEvent) -> void:
else:
Global.camera.zoom_camera(1)
if Global.can_draw && Global.has_focus && Input.is_action_just_pressed("shift") && (["Pencil", "Eraser", "LightenDarken"].has(Global.current_left_tool) || ["Pencil", "Eraser", "LightenDarken"].has(Global.current_right_tool)):
if Global.can_draw && Global.has_focus && Input.is_action_just_pressed("shift") && ([Global.Tools.PENCIL, Global.Tools.ERASER, Global.Tools.LIGHTENDARKEN].has(Global.current_left_tool) || [Global.Tools.PENCIL, Global.Tools.ERASER, Global.Tools.LIGHTENDARKEN].has(Global.current_right_tool)):
is_making_line = true
line_2d.set_point_position(0, previous_mouse_pos_for_lines)
elif Input.is_action_just_released("shift"):

View file

@ -59,7 +59,7 @@ __meta__ = {
"_edit_use_anchors_": false
}
[node name="Tools" type="VBoxContainer" parent="ToolPanel/PanelContainer"]
[node name="ToolButtons" type="VBoxContainer" parent="ToolPanel/PanelContainer"]
margin_left = 7.0
margin_top = 7.0
margin_right = 39.0
@ -69,7 +69,7 @@ __meta__ = {
"_edit_use_anchors_": false
}
[node name="RectSelect" type="Button" parent="ToolPanel/PanelContainer/Tools" groups=[
[node name="RectSelect" type="Button" parent="ToolPanel/PanelContainer/ToolButtons" groups=[
"UIButtons",
]]
margin_right = 32.0
@ -78,7 +78,7 @@ rect_min_size = Vector2( 32, 32 )
mouse_default_cursor_shape = 2
button_mask = 3
[node name="TextureRect" type="TextureRect" parent="ToolPanel/PanelContainer/Tools/RectSelect"]
[node name="TextureRect" type="TextureRect" parent="ToolPanel/PanelContainer/ToolButtons/RectSelect"]
margin_right = 32.0
margin_bottom = 32.0
texture = ExtResource( 12 )
@ -86,7 +86,7 @@ __meta__ = {
"_edit_use_anchors_": false
}
[node name="Zoom" type="Button" parent="ToolPanel/PanelContainer/Tools" groups=[
[node name="Zoom" type="Button" parent="ToolPanel/PanelContainer/ToolButtons" groups=[
"UIButtons",
]]
margin_top = 36.0
@ -96,7 +96,7 @@ rect_min_size = Vector2( 32, 32 )
mouse_default_cursor_shape = 2
button_mask = 3
[node name="TextureRect" type="TextureRect" parent="ToolPanel/PanelContainer/Tools/Zoom"]
[node name="TextureRect" type="TextureRect" parent="ToolPanel/PanelContainer/ToolButtons/Zoom"]
margin_right = 32.0
margin_bottom = 32.0
texture = ExtResource( 21 )
@ -104,7 +104,7 @@ __meta__ = {
"_edit_use_anchors_": false
}
[node name="ColorPicker" type="Button" parent="ToolPanel/PanelContainer/Tools" groups=[
[node name="ColorPicker" type="Button" parent="ToolPanel/PanelContainer/ToolButtons" groups=[
"UIButtons",
]]
margin_top = 72.0
@ -114,7 +114,7 @@ rect_min_size = Vector2( 32, 32 )
mouse_default_cursor_shape = 2
button_mask = 3
[node name="TextureRect" type="TextureRect" parent="ToolPanel/PanelContainer/Tools/ColorPicker"]
[node name="TextureRect" type="TextureRect" parent="ToolPanel/PanelContainer/ToolButtons/ColorPicker"]
margin_right = 32.0
margin_bottom = 32.0
texture = ExtResource( 11 )
@ -122,7 +122,7 @@ __meta__ = {
"_edit_use_anchors_": false
}
[node name="Pencil" type="Button" parent="ToolPanel/PanelContainer/Tools" groups=[
[node name="Pencil" type="Button" parent="ToolPanel/PanelContainer/ToolButtons" groups=[
"UIButtons",
]]
margin_top = 108.0
@ -132,7 +132,7 @@ rect_min_size = Vector2( 32, 32 )
mouse_default_cursor_shape = 2
button_mask = 3
[node name="TextureRect" type="TextureRect" parent="ToolPanel/PanelContainer/Tools/Pencil"]
[node name="TextureRect" type="TextureRect" parent="ToolPanel/PanelContainer/ToolButtons/Pencil"]
margin_right = 32.0
margin_bottom = 32.0
texture = ExtResource( 14 )
@ -140,7 +140,7 @@ __meta__ = {
"_edit_use_anchors_": false
}
[node name="Eraser" type="Button" parent="ToolPanel/PanelContainer/Tools" groups=[
[node name="Eraser" type="Button" parent="ToolPanel/PanelContainer/ToolButtons" groups=[
"UIButtons",
]]
margin_top = 144.0
@ -150,7 +150,7 @@ rect_min_size = Vector2( 32, 32 )
mouse_default_cursor_shape = 2
button_mask = 3
[node name="TextureRect" type="TextureRect" parent="ToolPanel/PanelContainer/Tools/Eraser"]
[node name="TextureRect" type="TextureRect" parent="ToolPanel/PanelContainer/ToolButtons/Eraser"]
margin_right = 32.0
margin_bottom = 32.0
texture = ExtResource( 13 )
@ -158,7 +158,7 @@ __meta__ = {
"_edit_use_anchors_": false
}
[node name="Bucket" type="Button" parent="ToolPanel/PanelContainer/Tools" groups=[
[node name="Bucket" type="Button" parent="ToolPanel/PanelContainer/ToolButtons" groups=[
"UIButtons",
]]
margin_top = 180.0
@ -168,7 +168,7 @@ rect_min_size = Vector2( 32, 32 )
mouse_default_cursor_shape = 2
button_mask = 3
[node name="TextureRect" type="TextureRect" parent="ToolPanel/PanelContainer/Tools/Bucket"]
[node name="TextureRect" type="TextureRect" parent="ToolPanel/PanelContainer/ToolButtons/Bucket"]
margin_right = 32.0
margin_bottom = 32.0
texture = ExtResource( 10 )
@ -176,7 +176,7 @@ __meta__ = {
"_edit_use_anchors_": false
}
[node name="LightenDarken" type="Button" parent="ToolPanel/PanelContainer/Tools" groups=[
[node name="LightenDarken" type="Button" parent="ToolPanel/PanelContainer/ToolButtons" groups=[
"UIButtons",
]]
margin_top = 216.0
@ -186,7 +186,7 @@ rect_min_size = Vector2( 32, 32 )
mouse_default_cursor_shape = 2
button_mask = 3
[node name="TextureRect" type="TextureRect" parent="ToolPanel/PanelContainer/Tools/LightenDarken"]
[node name="TextureRect" type="TextureRect" parent="ToolPanel/PanelContainer/ToolButtons/LightenDarken"]
margin_right = 32.0
margin_bottom = 32.0
texture = ExtResource( 15 )