0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-27 09:16:17 -05:00

🐛 Fixed problem with preview frames

This commit is contained in:
alonso.torres 2020-04-29 11:03:48 +02:00
parent 68164102d1
commit fc1e28a3d8
3 changed files with 13 additions and 5 deletions

View file

@ -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

View file

@ -35,7 +35,6 @@
frames (:frames data [])
objects (:objects data)
frame (get frames index)]
[:section.viewer-preview
(cond
(empty? frames)

View file

@ -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)