From fc1e28a3d8f149cc8e947d82a8a87605a27a4fe2 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Wed, 29 Apr 2020 11:03:48 +0200 Subject: [PATCH] :bug: Fixed problem with preview frames --- frontend/src/uxbox/main/exports.cljs | 4 ++-- frontend/src/uxbox/main/ui/viewer.cljs | 1 - frontend/src/uxbox/main/ui/viewer/thumbnails.cljs | 13 +++++++++++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/frontend/src/uxbox/main/exports.cljs b/frontend/src/uxbox/main/exports.cljs index 10374a3f3..c2fae66e7 100644 --- a/frontend/src/uxbox/main/exports.cljs +++ b/frontend/src/uxbox/main/exports.cljs @@ -76,7 +76,7 @@ (let [group-wrapper (mf/use-memo (mf/deps objects) #(group-wrapper objects))] (when (and shape (not (:hidden shape))) (let [shape (geom/transform-shape frame shape) - opts #js {:shape shape :frame frame}] + opts #js {:shape shape}] (case (:type shape) :curve [:> path/path-shape opts] :text [:> text/text-shape opts] @@ -85,7 +85,7 @@ :path [:> path/path-shape opts] :image [:> image/image-shape opts] :circle [:> circle/circle-shape opts] - :group [:> group-wrapper opts] + :group [:> group-wrapper {:shape shape :frame frame}] nil)))))) (mf/defc page-svg diff --git a/frontend/src/uxbox/main/ui/viewer.cljs b/frontend/src/uxbox/main/ui/viewer.cljs index 50bb46b1d..519453992 100644 --- a/frontend/src/uxbox/main/ui/viewer.cljs +++ b/frontend/src/uxbox/main/ui/viewer.cljs @@ -35,7 +35,6 @@ frames (:frames data []) objects (:objects data) frame (get frames index)] - [:section.viewer-preview (cond (empty? frames) diff --git a/frontend/src/uxbox/main/ui/viewer/thumbnails.cljs b/frontend/src/uxbox/main/ui/viewer/thumbnails.cljs index 992632c76..b18e7b0e6 100644 --- a/frontend/src/uxbox/main/ui/viewer/thumbnails.cljs +++ b/frontend/src/uxbox/main/ui/viewer/thumbnails.cljs @@ -17,6 +17,7 @@ [uxbox.common.data :as d] [uxbox.main.store :as st] [uxbox.main.data.viewer :as dv] + [uxbox.main.data.helpers :as helpers] [uxbox.main.ui.components.dropdown :refer [dropdown']] [uxbox.main.ui.shapes.frame :as frame] [uxbox.main.exports :as exports] @@ -83,6 +84,14 @@ (let [modifier (-> (gpt/point (:x frame) (:y frame)) (gpt/negate) (gmt/translate-matrix)) + + frame-id (:id frame) + modifier-ids (concat [frame-id] (helpers/get-children frame-id objects)) + + update-fn (fn [state shape-id] + (-> state + (assoc-in [shape-id :modifiers :displacement] modifier))) + objects (reduce update-fn objects modifier-ids) frame (assoc-in frame [:modifiers :displacement] modifier ) width (* (:width frame) zoom) @@ -96,9 +105,9 @@ :height height :version "1.1" :xmlnsXlink "http://www.w3.org/1999/xlink" - :xmlns "http://www.w3.org/2000/svg"} + :xmlns "http://www.w3.org/2000/svg"} [:& frame-wrapper {:shape frame - :view-box vbox}]])) + :view-box vbox}]])) (mf/defc thumbnails-summary [{:keys [on-toggle-expand on-close total] :as props}]