0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-23 06:58:58 -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 (d/without-nils
(case animation-type (case animation-type
:dissolve :dissolve
{:type animation-type {:animation-type animation-type
:duration (obj/get animation "duration") :duration (obj/get animation "duration")
:easing (-> (obj/get animation "easing") parse-keyword)} :easing (-> (obj/get animation "easing") parse-keyword)}
:slide :slide
{:type animation-type {:animation-type animation-type
:way (-> (obj/get animation "way") parse-keyword) :way (-> (obj/get animation "way") parse-keyword)
:direction (-> (obj/get animation "direction") parse-keyword) :direction (-> (obj/get animation "direction") parse-keyword)
:duration (obj/get animation "duration") :duration (obj/get animation "duration")
:easing (-> (obj/get animation "easing") parse-keyword) :easing (-> (obj/get animation "easing") parse-keyword)
:offset-effect (obj/get animation "offsetEffect")} :offset-effect (boolean (obj/get animation "offsetEffect"))}
:push :push
{:type animation-type {:animation-type animation-type
:direction (-> (obj/get animation "direction") parse-keyword) :direction (-> (obj/get animation "direction") parse-keyword)
:duration (obj/get animation "duration") :duration (obj/get animation "duration")
:easing (-> (obj/get animation "easing") parse-keyword)} :easing (-> (obj/get animation "easing") parse-keyword)}
@ -563,10 +563,9 @@
nil))))) nil)))))
(defn parse-interaction (defn parse-interaction
[^js interaction] [trigger ^js action delay]
(when interaction (when (and (string? trigger) (some? action))
(let [trigger (-> (obj/get interaction "trigger") parse-keyword) (let [trigger (parse-keyword trigger)
delay (obj/get interaction "trigger") action (parse-action action)]
action (-> (obj/get interaction "action") parse-action)]
(d/without-nils (d/without-nils
(d/patch-object {:event-type trigger :delay delay} action))))) (d/patch-object {:event-type trigger :delay delay} action)))))

View file

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