From cab9e4acfc1b710bdb9c8cb536bd4fbd4e02bc3f Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 9 Nov 2016 11:24:57 +0100 Subject: [PATCH] Fix view app viewer rendering. --- src/uxbox/view/data/viewer.cljs | 11 +++++------ src/uxbox/view/ui/viewer/shapes.cljs | 4 ++++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/uxbox/view/data/viewer.cljs b/src/uxbox/view/data/viewer.cljs index 66b160102e..332163186d 100644 --- a/src/uxbox/view/data/viewer.cljs +++ b/src/uxbox/view/data/viewer.cljs @@ -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] diff --git a/src/uxbox/view/ui/viewer/shapes.cljs b/src/uxbox/view/ui/viewer/shapes.cljs index d641a01ddc..4688a24ade 100644 --- a/src/uxbox/view/ui/viewer/shapes.cljs +++ b/src/uxbox/view/ui/viewer/shapes.cljs @@ -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*)))