mirror of
https://github.com/penpot/penpot.git
synced 2025-01-21 22:22:43 -05:00
✨ Add event "create-prototype"
This commit is contained in:
parent
ede8ee6a78
commit
14c917d003
1 changed files with 6 additions and 1 deletions
|
@ -17,6 +17,7 @@
|
||||||
[app.common.types.shape.interactions :as ctsi]
|
[app.common.types.shape.interactions :as ctsi]
|
||||||
[app.common.uuid :as uuid]
|
[app.common.uuid :as uuid]
|
||||||
[app.main.data.changes :as dch]
|
[app.main.data.changes :as dch]
|
||||||
|
[app.main.data.events :as ev]
|
||||||
[app.main.data.workspace.shapes :as dwsh]
|
[app.main.data.workspace.shapes :as dwsh]
|
||||||
[app.main.data.workspace.state-helpers :as wsh]
|
[app.main.data.workspace.state-helpers :as wsh]
|
||||||
[app.main.data.workspace.undo :as dwu]
|
[app.main.data.workspace.undo :as dwu]
|
||||||
|
@ -168,6 +169,7 @@
|
||||||
objects (get page :objects)
|
objects (get page :objects)
|
||||||
frame (cfh/get-root-frame objects (:id shape))
|
frame (cfh/get-root-frame objects (:id shape))
|
||||||
|
|
||||||
|
first? (not-any? #(seq (:interactions %)) (vals objects))
|
||||||
flows (get page :flows)
|
flows (get page :flows)
|
||||||
flow (ctp/get-frame-flow flows (:id frame))]
|
flow (ctp/get-frame-flow flows (:id frame))]
|
||||||
(rx/concat
|
(rx/concat
|
||||||
|
@ -184,7 +186,10 @@
|
||||||
|
|
||||||
(when (and (not (connected-frame? objects (:id frame)))
|
(when (and (not (connected-frame? objects (:id frame)))
|
||||||
(nil? flow))
|
(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
|
(defn remove-interaction
|
||||||
([shape index]
|
([shape index]
|
||||||
|
|
Loading…
Add table
Reference in a new issue