Skip to content

Commit e6a2c82

Browse files
committed
Merge pull request scala-js#144 from japgolly/dataTransfer
Add new and correct existing fns in DataTransfer
2 parents 9e7bee8 + 10bba0c commit e6a2c82

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

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

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3759,6 +3759,7 @@ trait DataTransfer extends js.Object {
37593759
* MDN
37603760
*/
37613761
var dropEffect: String = js.native
3762+
37623763
/**
37633764
* Remove the data associated with a given type. The type argument is optional. If the
37643765
* type is empty or not specified, the data associated with all types is removed. If
@@ -3767,7 +3768,7 @@ trait DataTransfer extends js.Object {
37673768
*
37683769
* MDN
37693770
*/
3770-
def clearData(format: String = js.native): Boolean = js.native
3771+
def clearData(format: String = js.native): Unit = js.native
37713772

37723773
/**
37733774
* Set the data for a given type. If data for the type does not exist, it is added at the
@@ -3777,12 +3778,34 @@ trait DataTransfer extends js.Object {
37773778
*
37783779
* MDN
37793780
*/
3780-
def setData(format: String, data: String): Boolean = js.native
3781+
def setData(format: String, data: String): Unit = js.native
3782+
3783+
/**
3784+
* Set the image to be used for dragging if a custom one is desired. Most of the time, this
3785+
* would not be set, as a default image is created from the node that was dragged.
3786+
*
3787+
* If the node is an HTML img element, an HTML canvas element or a XUL image element, the
3788+
* image data is used. Otherwise, image should be a visible node and the drag image will be
3789+
* created from this. If image is null, any custom drag image is cleared and the default is
3790+
* used instead.
3791+
*
3792+
* The coordinates specify the offset into the image where the mouse cursor should be. To
3793+
* center the image, for instance, use values that are half the width and height of the image.
3794+
*
3795+
* @param image An element to use as the drag feedback image.
3796+
* @param x Horizontal offset within the image.
3797+
* @param y Vertical offset within the image.
3798+
*/
3799+
def setDragImage(image: Element, x: Double, y: Double): Unit = js.native
37813800

37823801
/**
37833802
* Retrieves the data for a given type, or an empty string if data for that type does not
37843803
* exist or the data transfer contains no data.
37853804
*
3805+
* A security error will occur if you attempt to retrieve data during a drag that was set
3806+
* from a different domain, or the caller would otherwise not have access to. This data will
3807+
* only be available once a drop occurs during the drop event.
3808+
*
37863809
* MDN
37873810
*/
37883811
def getData(format: String): String = js.native

0 commit comments

Comments
 (0)