Skip to content

Commit 9d13f4b

Browse files
authored
Added a custom cursor icon for lasso tool (contributed by williamchange)
Add custom cursor icon for lasso tool
2 parents 95261b8 + 12148b9 commit 9d13f4b

3 files changed

Lines changed: 23 additions & 0 deletions

File tree

material_maker/icons/cross.svg

Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[remap]
2+
3+
importer="svg"
4+
type="DPITexture"
5+
uid="uid://d1ta3b838aivw"
6+
path="res://.godot/imported/cross.svg-1e1ed0f83009f7099e07bd965fe63d86.dpitex"
7+
8+
[deps]
9+
10+
source_file="res://material_maker/icons/cross.svg"
11+
dest_files=["res://.godot/imported/cross.svg-1e1ed0f83009f7099e07bd965fe63d86.dpitex"]
12+
13+
[params]
14+
15+
base_scale=0.8
16+
saturation=1.0
17+
color_map={}
18+
compress=true

material_maker/panels/graph_edit/graph_edit.gd

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ var drag_cut_line : PackedVector2Array
5757
var valid_drag_cut_entry: bool = false
5858
const CURSOR_HOT_SPOT : Vector2 = Vector2(1.02, 17.34)
5959

60+
const LASSO_CURSOR : DPITexture = preload("res://material_maker/icons/cross.svg")
61+
const LASSO_HOT_SPOT : Vector2 = Vector2(8.8, 8.8)
6062
var lasso_points : PackedVector2Array
6163

6264
var is_dragging_connection : bool = false:
@@ -207,6 +209,7 @@ func _gui_input(event) -> void:
207209
for point in node_points:
208210
node.selected = node.selected or Geometry2D.is_point_in_polygon(point, lasso_points)
209211
lasso_points.clear()
212+
Input.set_custom_mouse_cursor(null)
210213
queue_redraw()
211214
elif event.is_action_pressed("ui_hierarchy_up"):
212215
on_ButtonUp_pressed()
@@ -348,6 +351,7 @@ func _gui_input(event) -> void:
348351
# lasso selection
349352
if (event.button_mask & MOUSE_BUTTON_MASK_LEFT) != 0 and event.alt_pressed:
350353
accept_event()
354+
Input.set_custom_mouse_cursor(LASSO_CURSOR, Input.CURSOR_ARROW, LASSO_HOT_SPOT)
351355
lasso_points.append(get_local_mouse_position())
352356
queue_redraw()
353357
elif (event.button_mask & MOUSE_BUTTON_MASK_LEFT) != 0 and event.shift_pressed:

0 commit comments

Comments
 (0)