File tree Expand file tree Collapse file tree 3 files changed +22
-0
lines changed
Expand file tree Collapse file tree 3 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ New features:
1010- Added ` languages ` value for ` Navigator ` (#59 by @toastal )
1111- Added ` HTMLHtmlElement ` module and ` documentElement ` function ` HTMLDocument ` (#60 by @toastal )
1212- Added ` onLine ` value for ` Navigator ` (#61 by @toastal )
13+ - Added ` setDragImage ` function for ` DataTransfer ` (#65 by @ajarista )
1314
1415Bugfixes:
1516
Original file line number Diff line number Diff line change @@ -26,6 +26,18 @@ exports._setData = function (format) {
2626 } ;
2727} ;
2828
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+
2941exports . _dropEffect = function ( dataTransfer ) {
3042 return function ( ) {
3143 return dataTransfer . dropEffect ;
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ module Web.HTML.Event.DataTransfer
44 , types
55 , getData
66 , setData
7+ , setDragImage
78 , DropEffect (..)
89 , dropEffect
910 , setDropEffect
@@ -15,6 +16,7 @@ import Data.Maybe (Maybe)
1516import Data.MediaType (MediaType (..))
1617import Data.Nullable (Nullable , toMaybe )
1718import Effect (Effect )
19+ import Web.DOM.Element (Element )
1820import Web.File.FileList (FileList )
1921
2022foreign import data DataTransfer :: Type
@@ -57,6 +59,13 @@ setData
5759 -> Effect Unit
5860setData (MediaType format) dat dt = _setData format dat dt
5961
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
6069foreign import _dropEffect :: DataTransfer -> Effect String
6170
6271data DropEffect = Copy | Link | Move | None
You can’t perform that action at this time.
0 commit comments