mirror of
https://github.com/penpot/penpot.git
synced 2025-05-30 00:46:12 +02:00
🎉 Add basic interaction to shapes
This commit is contained in:
parent
49023117c3
commit
1e898f94f3
32 changed files with 1024 additions and 226 deletions
|
@ -64,19 +64,23 @@
|
|||
(persistent!
|
||||
(reduce #(assoc! %1 (getter %2) %2) (transient {}) coll)))
|
||||
|
||||
(defn index-of
|
||||
[coll v]
|
||||
(defn index-of-pred
|
||||
[coll pred]
|
||||
(loop [c (first coll)
|
||||
coll (rest coll)
|
||||
index 0]
|
||||
(if (nil? c)
|
||||
nil
|
||||
(if (= c v)
|
||||
(if (pred c)
|
||||
index
|
||||
(recur (first coll)
|
||||
(rest coll)
|
||||
(inc index))))))
|
||||
|
||||
(defn index-of
|
||||
[coll v]
|
||||
(index-of-pred coll #(= % v)))
|
||||
|
||||
(defn remove-nil-vals
|
||||
"Given a map, return a map removing key-value
|
||||
pairs when value is `nil`."
|
||||
|
|
|
@ -135,6 +135,19 @@
|
|||
::grid-x
|
||||
::grid-color]))
|
||||
|
||||
;; Interactions
|
||||
|
||||
(s/def ::event-type #{:click}) ; In the future we will have more options
|
||||
(s/def ::action-type #{:navigate})
|
||||
(s/def ::destination uuid?)
|
||||
|
||||
(s/def ::interaction
|
||||
(s/keys :req-un [::event-type
|
||||
::action-type
|
||||
::destination]))
|
||||
|
||||
(s/def ::interactions (s/coll-of ::interaction :kind vector?))
|
||||
|
||||
;; Page Data related
|
||||
(s/def ::blocked boolean?)
|
||||
(s/def ::collapsed boolean?)
|
||||
|
@ -194,7 +207,8 @@
|
|||
::stroke-width
|
||||
::stroke-alignment
|
||||
::text-align
|
||||
::width ::height]))
|
||||
::width ::height
|
||||
::interactions]))
|
||||
|
||||
(s/def ::minimal-shape
|
||||
(s/keys :req-un [::type ::name]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue