File tree 3 files changed +22
-0
lines changed 3 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ New features:
10
10
- Added ` languages ` value for ` Navigator ` (#59 by @toastal )
11
11
- Added ` HTMLHtmlElement ` module and ` documentElement ` function ` HTMLDocument ` (#60 by @toastal )
12
12
- Added ` onLine ` value for ` Navigator ` (#61 by @toastal )
13
+ - Added ` setDragImage ` function for ` DataTransfer ` (#65 by @ajarista )
13
14
14
15
Bugfixes:
15
16
Original file line number Diff line number Diff line change @@ -26,6 +26,18 @@ exports._setData = function (format) {
26
26
} ;
27
27
} ;
28
28
29
+ exports . _setDragImage = function ( dataTransfer ) {
30
+ return function ( image ) {
31
+ return function ( x ) {
32
+ return function ( y ) {
33
+ return function ( ) {
34
+ return dataTransfer . setDragImage ( image , x , y ) ;
35
+ } ;
36
+ } ;
37
+ } ;
38
+ } ;
39
+ } ;
40
+
29
41
exports . _dropEffect = function ( dataTransfer ) {
30
42
return function ( ) {
31
43
return dataTransfer . dropEffect ;
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ module Web.HTML.Event.DataTransfer
4
4
, types
5
5
, getData
6
6
, setData
7
+ , setDragImage
7
8
, DropEffect (..)
8
9
, dropEffect
9
10
, setDropEffect
@@ -15,6 +16,7 @@ import Data.Maybe (Maybe)
15
16
import Data.MediaType (MediaType (..))
16
17
import Data.Nullable (Nullable , toMaybe )
17
18
import Effect (Effect )
19
+ import Web.DOM.Element (Element )
18
20
import Web.File.FileList (FileList )
19
21
20
22
foreign import data DataTransfer :: Type
@@ -57,6 +59,13 @@ setData
57
59
-> Effect Unit
58
60
setData (MediaType format) dat dt = _setData format dat dt
59
61
62
+ foreign import _setDragImage :: DataTransfer -> Element -> Int -> Int -> Effect Unit
63
+
64
+ -- | Sets the image to be used for dragging if a custom one is desired.
65
+ -- | The image will typically be an <image> but could be any other *visible* element.
66
+ -- | The x and y coordinates define where the image appears relative to the mouse.
67
+ setDragImage :: DataTransfer -> Element -> Int -> Int -> Effect Unit
68
+ setDragImage = _setDragImage
60
69
foreign import _dropEffect :: DataTransfer -> Effect String
61
70
62
71
data DropEffect = Copy | Link | Move | None
You can’t perform that action at this time.
0 commit comments