0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-07 15:39:42 -05:00

🐛 Fix plugins add interaction

This commit is contained in:
alonso.torres 2024-09-05 16:00:04 +02:00
parent b4e6f8bc73
commit 396cbb27b2
2 changed files with 10 additions and 11 deletions

View file

@ -450,20 +450,20 @@
(d/without-nils
(case animation-type
:dissolve
{:type animation-type
{:animation-type animation-type
:duration (obj/get animation "duration")
:easing (-> (obj/get animation "easing") parse-keyword)}
:slide
{:type animation-type
{:animation-type animation-type
:way (-> (obj/get animation "way") parse-keyword)
:direction (-> (obj/get animation "direction") parse-keyword)
:duration (obj/get animation "duration")
:easing (-> (obj/get animation "easing") parse-keyword)
:offset-effect (obj/get animation "offsetEffect")}
:offset-effect (boolean (obj/get animation "offsetEffect"))}
:push
{:type animation-type
{:animation-type animation-type
:direction (-> (obj/get animation "direction") parse-keyword)
:duration (obj/get animation "duration")
:easing (-> (obj/get animation "easing") parse-keyword)}
@ -563,10 +563,9 @@
nil)))))
(defn parse-interaction
[^js interaction]
(when interaction
(let [trigger (-> (obj/get interaction "trigger") parse-keyword)
delay (obj/get interaction "trigger")
action (-> (obj/get interaction "action") parse-action)]
[trigger ^js action delay]
(when (and (string? trigger) (some? action))
(let [trigger (parse-keyword trigger)
action (parse-action action)]
(d/without-nils
(d/patch-object {:event-type trigger :delay delay} action)))))

View file

@ -551,10 +551,10 @@
;; Interactions
(addInteraction
[self interaction]
[self trigger action delay]
(let [interaction
(-> ctsi/default-interaction
(d/patch-object (parser/parse-interaction interaction)))]
(d/patch-object (parser/parse-interaction trigger action delay)))]
(cond
(not (sm/validate ::ctsi/interaction interaction))
(u/display-not-valid :addInteraction interaction)