setDragImage method

void setDragImage(
  1. Element image,
  2. int x,
  3. int y
)

When a drag occurs, a translucent image is generated from the drag target (the element the HTMLElement/dragstart_event event is fired at), and follows the mouse pointer during the drag. This image is created automatically, so you do not need to create it yourself. However, if a custom image is desired, the DataTransfer.setDragImage() method can be used to set the custom image to be used. The image will typically be an img element but it can also be a canvas or any other visible element.

The method's x and y coordinates define how the image should appear relative to the mouse pointer. These coordinates define the offset into the image where the mouse cursor should be. For instance, to display the image so that the pointer is at its center, use values that are half the width and height of the image.

This method must be called in the HTMLElement/dragstart_event event handler.

Implementation

external void setDragImage(
  Element image,
  int x,
  int y,
);