Skip to content

Commit 8d99b67

Browse files
committed
Add new and correct existing fns in DataTransfer
1 parent 9e7bee8 commit 8d99b67

File tree

1 file changed

+34
-3
lines changed

1 file changed

+34
-3
lines changed

src/main/scala/org/scalajs/dom/raw/lib.scala

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3759,6 +3759,15 @@ trait DataTransfer extends js.Object {
37593759
* MDN
37603760
*/
37613761
var dropEffect: String = js.native
3762+
3763+
/**
3764+
* Set the drag source. Usually you would not change this, but it will affect which node
3765+
* the drag and dragend events are fired at. The default target is the node that was dragged.
3766+
*
3767+
* MDN
3768+
*/
3769+
def addElement(element: Element): Unit = js.native
3770+
37623771
/**
37633772
* Remove the data associated with a given type. The type argument is optional. If the
37643773
* type is empty or not specified, the data associated with all types is removed. If
@@ -3767,7 +3776,7 @@ trait DataTransfer extends js.Object {
37673776
*
37683777
* MDN
37693778
*/
3770-
def clearData(format: String = js.native): Boolean = js.native
3779+
def clearData(`type`: String = js.native): Unit = js.native
37713780

37723781
/**
37733782
* Set the data for a given type. If data for the type does not exist, it is added at the
@@ -3777,15 +3786,37 @@ trait DataTransfer extends js.Object {
37773786
*
37783787
* MDN
37793788
*/
3780-
def setData(format: String, data: String): Boolean = js.native
3789+
def setData(`type`: String, data: String): Unit = js.native
3790+
3791+
/**
3792+
* Set the image to be used for dragging if a custom one is desired. Most of the time, this
3793+
* would not be set, as a default image is created from the node that was dragged.
3794+
*
3795+
* If the node is an HTML img element, an HTML canvas element or a XUL image element, the
3796+
* image data is used. Otherwise, image should be a visible node and the drag image will be
3797+
* created from this. If image is null, any custom drag image is cleared and the default is
3798+
* used instead.
3799+
*
3800+
* The coordinates specify the offset into the image where the mouse cursor should be. To
3801+
* center the image, for instance, use values that are half the width and height of the image.
3802+
*
3803+
* @param image An element to use as the drag feedback image.
3804+
* @param x Horizontal offset within the image.
3805+
* @param y Vertical offset within the image.
3806+
*/
3807+
def setDragImage(image: Element, x: Double, y: Double): Unit = js.native
37813808

37823809
/**
37833810
* Retrieves the data for a given type, or an empty string if data for that type does not
37843811
* exist or the data transfer contains no data.
37853812
*
3813+
* A security error will occur if you attempt to retrieve data during a drag that was set
3814+
* from a different domain, or the caller would otherwise not have access to. This data will
3815+
* only be available once a drop occurs during the drop event.
3816+
*
37863817
* MDN
37873818
*/
3788-
def getData(format: String): String = js.native
3819+
def getData(`type`: String): String = js.native
37893820

37903821
/**
37913822
* Holds a list of the format types of the data that is stored for the first item, in the

0 commit comments

Comments
 (0)