Click or drag to resize

ControlSetDragPreview Method

Shows the given control at the mouse pointer. A good time to call this method is in GetDragData(Vector2). The control must not be in the scene tree. You should not free the control, and you should not keep a reference to the control beyond the duration of the drag. It will be deleted automatically after the drag has ended.

export (Color, RGBA) var color = Color(1, 0, 0, 1)

func get_drag_data(position):
    # Use a control that is not in the tree
    var cpb = ColorPickerButton.new()
    cpb.color = color
    cpb.rect_size = Vector2(50, 50)
    set_drag_preview(cpb)
    return color

Namespace:  Godot
Assembly:  GodotSharp (in GodotSharp.dll) Version: 1.0.0
Syntax
C#
public void SetDragPreview(
	Control control
)

Parameters

control
Type: GodotControl

[Missing <param name="control"/> documentation for "M:Godot.Control.SetDragPreview(Godot.Control)"]

See Also