drag_drop_script.gd 364 B

12345678910111213141516171819
  1. extends ColorPickerButton
  2. func get_drag_data(_pos):
  3. # Use another colorpicker as drag preview.
  4. var cpb = ColorPickerButton.new()
  5. cpb.color = color
  6. cpb.rect_size = Vector2(50, 50)
  7. set_drag_preview(cpb)
  8. # Return color as drag data.
  9. return color
  10. func can_drop_data(_pos, data):
  11. return typeof(data) == TYPE_COLOR
  12. func drop_data(_pos, data):
  13. color = data