0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-13 10:38:13 -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
"Unpacks packed page object and assocs it to the
provided state."
[state page]
(let [data (:data page)
shapes (:shapes data)
shapes-by-id (:shapes data)
[state {:keys [id data] :as page}]
(let [shapes (:shapes data)
shapes-map (:shapes-map data)
page (-> page
(dissoc page :data)
(dissoc :data)
(assoc :shapes shapes))]
(-> state
(update :shapes merge shapes-by-id)
(update :shapes merge shapes-map)
(update :pages conj page))))
(defrecord DataLoaded [data]

View file

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