mirror of
https://github.com/penpot/penpot.git
synced 2025-07-24 14:57:19 +02:00
✨ Change drag component to instantiate on enter the viewport
This commit is contained in:
parent
f75da999dc
commit
497b581576
9 changed files with 121 additions and 67 deletions
|
@ -62,6 +62,13 @@
|
|||
(.setData dt data-type data))
|
||||
e)))
|
||||
|
||||
(defn invisible-image
|
||||
[]
|
||||
(let [img (js/Image.)
|
||||
imd "data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs="]
|
||||
(set! (.-src img) imd)
|
||||
img))
|
||||
|
||||
(defn set-drag-image!
|
||||
([e image]
|
||||
(set-drag-image! e image 0 0))
|
||||
|
@ -108,11 +115,13 @@
|
|||
([e]
|
||||
(get-data e "penpot/data"))
|
||||
([e data-type]
|
||||
(let [dt (.-dataTransfer e)]
|
||||
(if (or (str/starts-with? data-type "penpot")
|
||||
(= data-type "application/json"))
|
||||
(t/decode-str (.getData dt data-type))
|
||||
(.getData dt data-type)))))
|
||||
(let [dt (.-dataTransfer e)
|
||||
data (.getData dt data-type)]
|
||||
(cond-> data
|
||||
(and (some? data) (not= data "")
|
||||
(or (str/starts-with? data-type "penpot")
|
||||
(= data-type "application/json")))
|
||||
(t/decode-str)))))
|
||||
|
||||
(defn get-files
|
||||
[e]
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
(:require
|
||||
[beicon.v2.core :as rx]))
|
||||
|
||||
(defn- throttle-fn
|
||||
(defn throttle-fn
|
||||
[delay f]
|
||||
(let [state
|
||||
#js {:lastExecTime 0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue