0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-15 11:38:24 -05:00

Fix view app viewer rendering.

This commit is contained in:
Andrey Antukh 2016-11-09 11:24:57 +01:00
parent 9fb13ba73d
commit cab9e4acfc
No known key found for this signature in database
GPG key ID: 4DFEBCB8316A8B95
2 changed files with 9 additions and 6 deletions

View file

@ -33,15 +33,14 @@
(defn- unpack-page (defn- unpack-page
"Unpacks packed page object and assocs it to the "Unpacks packed page object and assocs it to the
provided state." provided state."
[state page] [state {:keys [id data] :as page}]
(let [data (:data page) (let [shapes (:shapes data)
shapes (:shapes data) shapes-map (:shapes-map data)
shapes-by-id (:shapes data)
page (-> page page (-> page
(dissoc page :data) (dissoc :data)
(assoc :shapes shapes))] (assoc :shapes shapes))]
(-> state (-> state
(update :shapes merge shapes-by-id) (update :shapes merge shapes-map)
(update :pages conj page)))) (update :pages conj page))))
(defrecord DataLoaded [data] (defrecord DataLoaded [data]

View file

@ -16,6 +16,7 @@
[uxbox.main.ui.shapes.group :refer (group-shape)] [uxbox.main.ui.shapes.group :refer (group-shape)]
[uxbox.main.ui.shapes.path :refer (path-shape)] [uxbox.main.ui.shapes.path :refer (path-shape)]
[uxbox.main.ui.shapes.circle :refer (circle-shape)] [uxbox.main.ui.shapes.circle :refer (circle-shape)]
[uxbox.main.ui.shapes.image :refer (image-shape)]
[uxbox.main.ui.icons :as i] [uxbox.main.ui.icons :as i]
[uxbox.view.ui.viewer.interactions :as itx]) [uxbox.view.ui.viewer.interactions :as itx])
(:import goog.events.EventType)) (:import goog.events.EventType))
@ -48,6 +49,7 @@
:will-unmount interactions-wrapper-will-unmount :will-unmount interactions-wrapper-will-unmount
:mixins [mx/reactive mx/static]} :mixins [mx/reactive mx/static]}
[shape factory] [shape factory]
{:pre [(map? shape)]}
(let [show-itx? (mx/react itx-flag-ref) (let [show-itx? (mx/react itx-flag-ref)
rect (geom/inner-rect shape)] rect (geom/inner-rect shape)]
[:g {:id (str "itx-" (:id shape))} [:g {:id (str "itx-" (:id shape))}
@ -68,6 +70,7 @@
[{:keys [type] :as item}] [{:keys [type] :as item}]
(case type (case type
:group (group-shape item shape) :group (group-shape item shape)
:image (image-shape item)
:text (text-shape item) :text (text-shape item)
:icon (icon-shape item) :icon (icon-shape item)
:rect (rect-shape item) :rect (rect-shape item)
@ -76,5 +79,6 @@
(mx/defc shape (mx/defc shape
[sid] [sid]
{:pre [(uuid? sid)]}
(let [item (get-in @st/state [:shapes sid])] (let [item (get-in @st/state [:shapes sid])]
(interactions-wrapper item shape*))) (interactions-wrapper item shape*)))