1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-19 01:29:49 +00:00
Pixelorama/Scripts/Palette/PaletteButton.gd
Hugo Locurcio 386473845e
Fix GDScript warnings pertaining to unused arguments
Those warnings can be ignored by prefixing the argument with an
underscore.
2019-12-27 16:14:01 +01:00

26 lines
672 B
GDScript

extends Button
signal on_drop_data
export var index := 0;
export var color : Color = Color.white
export var draggable := false
var drag_preview_texture = preload("res://Assets/Graphics/Palette/swatch_drag_preview.png")
func get_drag_data(_position):
var data = null;
if(draggable):
#print(String(get_instance_id()) + ": Drag Start");
data = {source_index = index};
var drag_icon = TextureRect.new();
drag_icon.texture = drag_preview_texture;
drag_icon.modulate = color
set_drag_preview(drag_icon);
return data;
func can_drop_data(_position, _data):
return true;
func drop_data(_position, data):
emit_signal("on_drop_data", data.source_index, index);