The DragDropManager class is used to manage drag-and-drop operations in the UI.

DragDropManager 类用于管理 UI 中的拖放操作。

属性

agent: GLoader

A loader used to display a drag image.

用于显示一个拖动图像的加载器。

iconHeight: number = 200

The default height of the drag image.

拖动图像的默认高度。

iconWidth: number = 200

The default width of the drag image.

拖动图像的默认宽度。

访问器

方法

  • 参数

    • source: Sprite

      The source object to be dragged as a icon.

    • icon: string

      The icon resource to be used as the drag image.

    • data: any

      (Optional) The data to be passed to the event handler.

    • 可选iconWidth: number

      (Optional) The width of the drag image. Defaults to iconWidth.

    • 可选iconHeight: number

      (Optional) The height of the drag image. Defaults to iconHeight.

    返回 void

    Starts dragging an object. The object is not actually dragged, but a drag image is displayed. You can specify an icon resource or pass a sprite, in which case a screenshot is generated to create the image.

    开始拖动一个对象,对象并不会实际并拖动,而是显示一个拖动图像,这个图像可以通过制定一个图标资源,也可以传入一个sprite,这时会通过截图的方式生成一个图像。

  • 参数

    • source: Sprite

      The source object to be dragged as a icon.

    • iconSource: Sprite

      The sprite whose snapshot will be used as the drag image icon resource.

    • data: any

      (Optional) The data to be passed to the event handler.

    • 可选iconWidth: number

      (Optional) The width of the drag image. Defaults to iconWidth.

    • 可选iconHeight: number

      (Optional) The height of the drag image. Defaults to iconHeight.

    返回 void

    Starts dragging an object. The object is not actually dragged, but a drag image is displayed. You can specify an icon resource or pass a sprite, in which case a screenshot is generated to create the image.

    开始拖动一个对象,对象并不会实际并拖动,而是显示一个拖动图像,这个图像可以通过制定一个图标资源,也可以传入一个sprite,这时会通过截图的方式生成一个图像。