0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-21 06:02:32 -05:00

Add event "create-prototype"

This commit is contained in:
Pablo Alba 2024-11-25 16:12:43 +01:00
parent ede8ee6a78
commit 14c917d003

View file

@ -17,6 +17,7 @@
[app.common.types.shape.interactions :as ctsi]
[app.common.uuid :as uuid]
[app.main.data.changes :as dch]
[app.main.data.events :as ev]
[app.main.data.workspace.shapes :as dwsh]
[app.main.data.workspace.state-helpers :as wsh]
[app.main.data.workspace.undo :as dwu]
@ -168,6 +169,7 @@
objects (get page :objects)
frame (cfh/get-root-frame objects (:id shape))
first? (not-any? #(seq (:interactions %)) (vals objects))
flows (get page :flows)
flow (ctp/get-frame-flow flows (:id frame))]
(rx/concat
@ -184,7 +186,10 @@
(when (and (not (connected-frame? objects (:id frame)))
(nil? flow))
(rx/of (add-flow (:id frame))))))))))
(rx/of (add-flow (:id frame))))
(when first?
;; When the first interaction of the page is created we emit the event "create-prototype"
(rx/of (ptk/event ::ev/event {::ev/name "create-prototype"})))))))))
(defn remove-interaction
([shape index]