mirror of
https://github.com/penpot/penpot.git
synced 2025-03-25 06:01:46 -05:00
commit
4d106d9e15
23 changed files with 195 additions and 144 deletions
|
@ -93,6 +93,11 @@
|
|||
- Fix resize rotated shape with top&down constraints [Taiga #3167](https://tree.taiga.io/project/penpot/issue/3167)
|
||||
- Fix multi user not working [Taiga #3195](https://tree.taiga.io/project/penpot/issue/3195)
|
||||
- Fix guides are not duplicated with the artboard [Taiga #3072](https://tree.taiga.io/project/penpot/issue/3072)
|
||||
- Fix problem when changing group size with decimal values [Taiga #3203](https://tree.taiga.io/project/penpot/issue/3203)
|
||||
- Fix error when drawing curves with only one point [Taiga #3282](https://tree.taiga.io/project/penpot/issue/3282)
|
||||
- Fix issue with paste ordering sometimes not being respected [Taiga #3268](https://tree.taiga.io/project/penpot/issue/3268)
|
||||
- Fix problem when export/importing guides attached to frame [#1838](https://github.com/penpot/penpot/issues/1838)
|
||||
- Fix problem when resizing a group with texts with auto-width/height [#3171](https://tree.taiga.io/project/penpot/issue/3171)
|
||||
|
||||
### :arrow_up: Deps updates
|
||||
### :heart: Community contributions by (Thank you!)
|
||||
|
|
|
@ -103,25 +103,25 @@
|
|||
(defmethod constraint-modifier :scale
|
||||
[_ axis _ _ modifiers _]
|
||||
(let [{:keys [resize-vector resize-vector-2 displacement]} modifiers]
|
||||
(cond-> {}
|
||||
(and (some? resize-vector)
|
||||
(not (mth/close? (axis resize-vector) 1)))
|
||||
(assoc :resize-origin (:resize-origin modifiers)
|
||||
:resize-vector (if (= :x axis)
|
||||
(gpt/point (:x resize-vector) 1)
|
||||
(gpt/point 1 (:y resize-vector))))
|
||||
(cond-> {}
|
||||
(and (some? resize-vector)
|
||||
(not= (axis resize-vector) 1))
|
||||
(assoc :resize-origin (:resize-origin modifiers)
|
||||
:resize-vector (if (= :x axis)
|
||||
(gpt/point (:x resize-vector) 1)
|
||||
(gpt/point 1 (:y resize-vector))))
|
||||
|
||||
(and (= :y axis) (some? resize-vector-2)
|
||||
(not (mth/close? (:y resize-vector-2) 1)))
|
||||
(assoc :resize-origin (:resize-origin-2 modifiers)
|
||||
:resize-vector (gpt/point 1 (:y resize-vector-2)))
|
||||
(and (= :y axis) (some? resize-vector-2)
|
||||
(not (mth/close? (:y resize-vector-2) 1)))
|
||||
(assoc :resize-origin (:resize-origin-2 modifiers)
|
||||
:resize-vector (gpt/point 1 (:y resize-vector-2)))
|
||||
|
||||
(some? displacement)
|
||||
(assoc :displacement
|
||||
(get-displacement axis (-> (gpt/point 0 0)
|
||||
(gpt/transform displacement)
|
||||
(gpt/transform (:resize-transform-inverse modifiers (gmt/matrix)))
|
||||
axis))))))
|
||||
(some? displacement)
|
||||
(assoc :displacement
|
||||
(get-displacement axis (-> (gpt/point 0 0)
|
||||
(gpt/transform displacement)
|
||||
(gpt/transform (:resize-transform-inverse modifiers (gmt/matrix)))
|
||||
axis))))))
|
||||
|
||||
(defmethod constraint-modifier :default [_ _ _ _ _]
|
||||
{})
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
funcool/beicon {:mvn/version "2021.07.05-1"}
|
||||
funcool/okulary {:mvn/version "2022.04.11-16"}
|
||||
funcool/potok {:mvn/version "2021.09.20-0"}
|
||||
funcool/potok {:mvn/version "2022.04.28-67"}
|
||||
funcool/rumext {:mvn/version "2022.04.19-148"}
|
||||
funcool/tubax {:mvn/version "2021.05.20-0"}
|
||||
|
||||
|
|
|
@ -1482,12 +1482,11 @@
|
|||
(let [set-index (fn [[result index] id]
|
||||
[(assoc result id index) (inc index)])
|
||||
|
||||
map-ids (when index
|
||||
(->> (vals paste-objects)
|
||||
(filter #(not (selected (:parent-id %))))
|
||||
(map :id)
|
||||
(reduce set-index [{} (inc index)])
|
||||
first))]
|
||||
map-ids
|
||||
(->> selected
|
||||
(map #(get-in paste-objects [% :id]))
|
||||
(reduce set-index [{} (inc index)])
|
||||
first)]
|
||||
(if (and (= :add-obj (:type change))
|
||||
(contains? map-ids (:old-id change)))
|
||||
(assoc change :index (get map-ids (:old-id change)))
|
||||
|
|
|
@ -107,7 +107,8 @@
|
|||
(update [_ state]
|
||||
(assoc-in state [:workspace-local :expanded id] true))))
|
||||
|
||||
(def collapse-all
|
||||
(defn collapse-all
|
||||
[]
|
||||
(ptk/reify ::collapse-all
|
||||
ptk/UpdateEvent
|
||||
(update [_ state]
|
||||
|
|
|
@ -37,29 +37,29 @@
|
|||
|
||||
ptk/WatchEvent
|
||||
(watch [_ _ stream]
|
||||
(let [stoper (rx/filter (ptk/type? ::clear-drawing) stream)]
|
||||
(rx/merge
|
||||
(when (= tool :path)
|
||||
(rx/of (start-drawing :path)))
|
||||
(rx/merge
|
||||
(when (= tool :path)
|
||||
(rx/of (start-drawing :path)))
|
||||
|
||||
(when (= tool :curve)
|
||||
(let [stopper (->> stream (rx/filter dwc/interrupt?))]
|
||||
(->> stream
|
||||
(rx/filter (ptk/type? ::common/handle-finish-drawing))
|
||||
(rx/take 1)
|
||||
(rx/observe-on :async)
|
||||
(rx/map #(select-for-drawing tool data))
|
||||
(rx/take-until stopper))))
|
||||
(when (= tool :curve)
|
||||
(let [stopper (->> stream (rx/filter dwc/interrupt?))]
|
||||
(->> stream
|
||||
(rx/filter (ptk/type? ::common/handle-finish-drawing))
|
||||
(rx/take 1)
|
||||
(rx/observe-on :async)
|
||||
(rx/map #(select-for-drawing tool data))
|
||||
(rx/take-until stopper))))
|
||||
|
||||
;; NOTE: comments are a special case and they manage they
|
||||
;; own interrupt cycle.q
|
||||
(when (and (not= tool :comments)
|
||||
(not= tool :path))
|
||||
;; NOTE: comments are a special case and they manage they
|
||||
;; own interrupt cycle.q
|
||||
(when (and (not= tool :comments)
|
||||
(not= tool :path))
|
||||
(let [stopper (rx/filter (ptk/type? ::clear-drawing) stream)]
|
||||
(->> stream
|
||||
(rx/filter dwc/interrupt?)
|
||||
(rx/take 1)
|
||||
(rx/map (constantly common/clear-drawing))
|
||||
(rx/take-until stoper)))))))))
|
||||
(rx/map common/clear-drawing)
|
||||
(rx/take-until stopper)))))))))
|
||||
|
||||
|
||||
;; NOTE/TODO: when an exception is raised in some point of drawing the
|
||||
|
|
|
@ -101,4 +101,4 @@
|
|||
#(update-drawing % (cond-> point snap-pixel? gpt/round) shift?)))
|
||||
|
||||
(rx/take-until stoper))
|
||||
(rx/of common/handle-finish-drawing))))))
|
||||
(rx/of (common/handle-finish-drawing)))))))
|
||||
|
|
|
@ -16,13 +16,15 @@
|
|||
[beicon.core :as rx]
|
||||
[potok.core :as ptk]))
|
||||
|
||||
(def clear-drawing
|
||||
(defn clear-drawing
|
||||
[]
|
||||
(ptk/reify ::clear-drawing
|
||||
ptk/UpdateEvent
|
||||
(update [_ state]
|
||||
(update state :workspace-drawing dissoc :tool :object))))
|
||||
|
||||
(def handle-finish-drawing
|
||||
(defn handle-finish-drawing
|
||||
[]
|
||||
(ptk/reify ::handle-finish-drawing
|
||||
ptk/WatchEvent
|
||||
(watch [_ state _]
|
||||
|
@ -71,5 +73,6 @@
|
|||
(rx/empty)))))
|
||||
|
||||
;; Delay so the mouse event can read the drawing state
|
||||
(->> (rx/of clear-drawing)
|
||||
(->> (rx/of (clear-drawing))
|
||||
(rx/delay 0)))))))
|
||||
|
||||
|
|
|
@ -59,15 +59,22 @@
|
|||
(dissoc :segments)
|
||||
(assoc :content content)
|
||||
(assoc :selrect selrect)
|
||||
(assoc :points points))))
|
||||
(assoc :points points)
|
||||
|
||||
(defn finish-drawing-curve [state]
|
||||
(update-in
|
||||
state [:workspace-drawing :object]
|
||||
(fn [shape]
|
||||
(-> shape
|
||||
(update :segments #(ups/simplify % simplify-tolerance))
|
||||
(curve-to-path)))))
|
||||
(cond-> (or (empty? points) (nil? selrect) (<= (count content) 1))
|
||||
(assoc :initialized? false)))))
|
||||
|
||||
(defn finish-drawing-curve
|
||||
[]
|
||||
(ptk/reify ::finish-drawing-curve
|
||||
ptk/UpdateEvent
|
||||
(update [_ state]
|
||||
(letfn [(update-curve [shape]
|
||||
(-> shape
|
||||
(update :segments #(ups/simplify % simplify-tolerance))
|
||||
(curve-to-path)))]
|
||||
(-> state
|
||||
(update-in [:workspace-drawing :object] update-curve))))))
|
||||
|
||||
(defn handle-drawing-curve []
|
||||
(ptk/reify ::handle-drawing-curve
|
||||
|
@ -81,6 +88,6 @@
|
|||
(rx/map (fn [pt] #(insert-point-segment % pt)))
|
||||
(rx/take-until stoper))
|
||||
(rx/of (setup-frame-curve)
|
||||
finish-drawing-curve
|
||||
common/handle-finish-drawing))))))
|
||||
(finish-drawing-curve)
|
||||
(common/handle-finish-drawing)))))))
|
||||
|
||||
|
|
|
@ -275,7 +275,7 @@
|
|||
ptk/WatchEvent
|
||||
(watch [_ _ _]
|
||||
(rx/of (setup-frame-path)
|
||||
dwdc/handle-finish-drawing
|
||||
(dwdc/handle-finish-drawing)
|
||||
(dwc/start-edition-mode shape-id)
|
||||
(change-edit-mode :draw)))))
|
||||
|
||||
|
|
|
@ -246,7 +246,7 @@
|
|||
(ptk/reify ::fetch-bundle
|
||||
ptk/WatchEvent
|
||||
(watch [_ _ _]
|
||||
(->> (rx/zip (rp/query :file {:id file-id})
|
||||
(->> (rx/zip (rp/query :file-raw {:id file-id})
|
||||
(rp/query :team-users {:file-id file-id})
|
||||
(rp/query :project {:id project-id})
|
||||
(rp/query :file-libraries {:file-id file-id}))
|
||||
|
|
|
@ -384,6 +384,11 @@
|
|||
(defn commit-position-data
|
||||
[]
|
||||
(ptk/reify ::commit-position-data
|
||||
ptk/UpdateEvent
|
||||
(update [_ state]
|
||||
(let [ids (keys (::update-position-data state))]
|
||||
(update state :workspace-text-modifiers #(apply dissoc % ids))))
|
||||
|
||||
ptk/WatchEvent
|
||||
(watch [_ state _]
|
||||
(let [position-data (::update-position-data state)]
|
||||
|
@ -404,9 +409,10 @@
|
|||
(ptk/reify ::update-position-data
|
||||
ptk/UpdateEvent
|
||||
(update [_ state]
|
||||
(if (nil? (::update-position-data-debounce state))
|
||||
(assoc state ::update-position-data-debounce start)
|
||||
(assoc-in state [::update-position-data id] position-data)))
|
||||
(let [state (assoc-in state [:workspace-text-modifier id :position-data] position-data)]
|
||||
(if (nil? (::update-position-data-debounce state))
|
||||
(assoc state ::update-position-data-debounce start)
|
||||
(assoc-in state [::update-position-data id] position-data))))
|
||||
|
||||
ptk/WatchEvent
|
||||
(watch [_ state stream]
|
||||
|
|
|
@ -110,7 +110,7 @@
|
|||
;; geometric attributes of the shapes.
|
||||
|
||||
(declare clear-local-transform)
|
||||
(declare set-modifiers-recursive)
|
||||
(declare set-objects-modifiers)
|
||||
(declare get-ignore-tree)
|
||||
|
||||
(defn- set-modifiers
|
||||
|
@ -139,7 +139,7 @@
|
|||
(fn [state id]
|
||||
(let [shape (get objects id)]
|
||||
(update state :workspace-modifiers
|
||||
#(set-modifiers-recursive % objects shape modifiers ignore-constraints snap-pixel?))))]
|
||||
#(set-objects-modifiers % objects shape modifiers ignore-constraints snap-pixel?))))]
|
||||
|
||||
(reduce setup-modifiers state ids))))))
|
||||
|
||||
|
@ -166,6 +166,20 @@
|
|||
|
||||
(update state :workspace-modifiers #(reduce update-shape % shapes)))))))
|
||||
|
||||
(defn- update-grow-type
|
||||
[shape old-shape]
|
||||
(let [auto-width? (= :auto-width (:grow-type shape))
|
||||
auto-height? (= :auto-height (:grow-type shape))
|
||||
|
||||
changed-width? (not (mth/close? (:width shape) (:width old-shape)))
|
||||
changed-height? (not (mth/close? (:height shape) (:height old-shape)))
|
||||
|
||||
change-to-fixed? (or (and auto-width? (or changed-height? changed-width?))
|
||||
(and auto-height? changed-height?))]
|
||||
(cond-> shape
|
||||
change-to-fixed?
|
||||
(assoc :grow-type :fixed))))
|
||||
|
||||
(defn- apply-modifiers
|
||||
[ids]
|
||||
(us/verify (s/coll-of uuid?) ids)
|
||||
|
@ -182,27 +196,33 @@
|
|||
(rx/of (dwu/start-undo-transaction)
|
||||
(dwg/move-frame-guides ids-with-children)
|
||||
(dch/update-shapes
|
||||
ids-with-children
|
||||
(fn [shape]
|
||||
(let [modif (get object-modifiers (:id shape))]
|
||||
(gsh/transform-shape (merge shape modif))))
|
||||
{:reg-objects? true
|
||||
:ignore-tree ignore-tree
|
||||
;; Attributes that can change in the transform. This way we don't have to check
|
||||
;; all the attributes
|
||||
:attrs [:selrect
|
||||
:points
|
||||
:x
|
||||
:y
|
||||
:width
|
||||
:height
|
||||
:content
|
||||
:transform
|
||||
:transform-inverse
|
||||
:rotation
|
||||
:position-data
|
||||
:flip-x
|
||||
:flip-y]})
|
||||
ids-with-children
|
||||
(fn [shape]
|
||||
(let [modif (get object-modifiers (:id shape))
|
||||
text-shape? (cph/text-shape? shape)]
|
||||
(-> shape
|
||||
(merge modif)
|
||||
(gsh/transform-shape)
|
||||
(cond-> text-shape?
|
||||
(update-grow-type shape)))))
|
||||
{:reg-objects? true
|
||||
:ignore-tree ignore-tree
|
||||
;; Attributes that can change in the transform. This way we don't have to check
|
||||
;; all the attributes
|
||||
:attrs [:selrect
|
||||
:points
|
||||
:x
|
||||
:y
|
||||
:width
|
||||
:height
|
||||
:content
|
||||
:transform
|
||||
:transform-inverse
|
||||
:rotation
|
||||
:position-data
|
||||
:flip-x
|
||||
:flip-y
|
||||
:grow-type]})
|
||||
(clear-local-transform)
|
||||
(dwu/commit-undo-transaction))))))
|
||||
|
||||
|
@ -330,25 +350,28 @@
|
|||
(assoc :displacement (gmt/translate-matrix delta-v))))]
|
||||
modifiers)))
|
||||
|
||||
(defn- set-modifiers-recursive
|
||||
(defn- set-objects-modifiers
|
||||
[modif-tree objects shape modifiers ignore-constraints snap-pixel?]
|
||||
(letfn [(set-modifiers-rec
|
||||
[modif-tree shape modifiers]
|
||||
|
||||
(let [children (map (d/getf objects) (:shapes shape))
|
||||
modifiers (cond-> modifiers snap-pixel? (set-pixel-precision shape))
|
||||
transformed-rect (gsh/transform-selrect (:selrect shape) modifiers)
|
||||
(let [children (map (d/getf objects) (:shapes shape))
|
||||
modifiers (cond-> modifiers snap-pixel? (set-pixel-precision shape))
|
||||
transformed-rect (gsh/transform-selrect (:selrect shape) modifiers)
|
||||
|
||||
set-child
|
||||
(fn [modif-tree child]
|
||||
(let [child-modifiers (gsh/calc-child-modifiers shape child modifiers ignore-constraints transformed-rect)]
|
||||
(cond-> modif-tree
|
||||
(not (gsh/empty-modifiers? child-modifiers))
|
||||
(set-modifiers-recursive objects child child-modifiers ignore-constraints snap-pixel?))))
|
||||
set-child
|
||||
(fn [modif-tree child]
|
||||
(let [child-modifiers (gsh/calc-child-modifiers shape child modifiers ignore-constraints transformed-rect)]
|
||||
(cond-> modif-tree
|
||||
(not (gsh/empty-modifiers? child-modifiers))
|
||||
(set-modifiers-rec child child-modifiers))))
|
||||
|
||||
modif-tree
|
||||
(-> modif-tree
|
||||
(assoc-in [(:id shape) :modifiers] modifiers))]
|
||||
modif-tree
|
||||
(-> modif-tree
|
||||
(assoc-in [(:id shape) :modifiers] modifiers))]
|
||||
|
||||
(reduce set-child modif-tree children)))
|
||||
(reduce set-child modif-tree children)))]
|
||||
(set-modifiers-rec modif-tree shape modifiers)))
|
||||
|
||||
(defn- get-ignore-tree
|
||||
"Retrieves a map with the flag `ignore-geometry?` given a tree of modifiers"
|
||||
|
@ -480,12 +503,8 @@
|
|||
focus (:workspace-focus-selected state)
|
||||
zoom (get-in state [:workspace-local :zoom] 1)
|
||||
objects (wsh/lookup-page-objects state page-id)
|
||||
resizing-shapes (map #(get objects %) ids)
|
||||
text-shapes-ids (->> resizing-shapes
|
||||
(filter #(= :text (:type %)))
|
||||
(map :id))]
|
||||
resizing-shapes (map #(get objects %) ids)]
|
||||
(rx/concat
|
||||
(rx/of (dch/update-shapes text-shapes-ids #(assoc % :grow-type :fixed)))
|
||||
(->> ms/mouse-position
|
||||
(rx/with-latest-from ms/mouse-position-shift ms/mouse-position-alt)
|
||||
(rx/map normalize-proportion-lock)
|
||||
|
@ -507,15 +526,17 @@
|
|||
(ptk/reify ::update-dimensions
|
||||
ptk/UpdateEvent
|
||||
(update [_ state]
|
||||
(let [page-id (:current-page-id state)
|
||||
objects (get-in state [:workspace-data :pages-index page-id :objects])
|
||||
(let [objects (wsh/lookup-page-objects state)
|
||||
layout (get state :workspace-layout)
|
||||
snap-pixel? (contains? layout :snap-pixel-grid)
|
||||
|
||||
update-modifiers
|
||||
(fn [state id]
|
||||
(let [shape (get objects id)
|
||||
(let [shape (get objects id)
|
||||
modifiers (gsh/resize-modifiers shape attr value)]
|
||||
(update state :workspace-modifiers
|
||||
#(set-modifiers-recursive % objects shape modifiers false false))))]
|
||||
(-> state
|
||||
(update :workspace-modifiers
|
||||
#(set-objects-modifiers % objects shape modifiers false (and snap-pixel? (int? value)))))))]
|
||||
(reduce update-modifiers state ids)))
|
||||
|
||||
ptk/WatchEvent
|
||||
|
|
|
@ -82,9 +82,9 @@
|
|||
[id params]
|
||||
(send-query! id params))
|
||||
|
||||
(defmethod query :file
|
||||
[id params]
|
||||
(send-query! id params {:raw-transit? true}))
|
||||
(defmethod query :file-raw
|
||||
[_id params]
|
||||
(send-query! :file params {:raw-transit? true}))
|
||||
|
||||
(defmethod mutation :default
|
||||
[id params]
|
||||
|
|
|
@ -72,11 +72,13 @@
|
|||
|
||||
[:> (name tag) (clj->js attrs)
|
||||
[:> wrapper wrapper-props
|
||||
(for [node content] [:& svg-node {:type type
|
||||
:node node
|
||||
:prefix-id prefix-id
|
||||
:transform transform
|
||||
:bounds bounds}])]])))
|
||||
(for [[index node] (d/enumerate content)]
|
||||
[:& svg-node {:key (dm/str "node-" index)
|
||||
:type type
|
||||
:node node
|
||||
:prefix-id prefix-id
|
||||
:transform transform
|
||||
:bounds bounds}])]])))
|
||||
|
||||
(defn svg-def-bounds [svg-def shape transform]
|
||||
(let [{:keys [tag]} svg-def]
|
||||
|
@ -107,10 +109,10 @@
|
|||
(cond->> id
|
||||
(contains? svg-defs id) (str render-id "-")))]
|
||||
|
||||
;; TODO: no key?
|
||||
(when (seq svg-defs)
|
||||
(for [svg-def (vals svg-defs)]
|
||||
[:& svg-node {:type (:type shape)
|
||||
(for [[key svg-def] svg-defs]
|
||||
[:& svg-node {:key (dm/str key)
|
||||
:type (:type shape)
|
||||
:node svg-def
|
||||
:prefix-id prefix-id
|
||||
:transform transform
|
||||
|
|
|
@ -117,6 +117,7 @@
|
|||
thumb-renderer
|
||||
|
||||
[:g.frame-thumbnail
|
||||
[:> frame/frame-thumbnail {:shape (cond-> shape
|
||||
[:> frame/frame-thumbnail {:key (dm/str (:id shape))
|
||||
:shape (cond-> shape
|
||||
(some? thumbnail-data)
|
||||
(assoc :thumbnail thumbnail-data))}]]]))))
|
||||
|
|
|
@ -38,15 +38,18 @@
|
|||
(mf/use-layout-effect
|
||||
(mf/deps transforms)
|
||||
(fn []
|
||||
(when (and (empty? @prev-modifiers) (d/not-empty? modifiers))
|
||||
(utils/start-transform! node shapes))
|
||||
(let [is-prev-val? (d/not-empty? @prev-modifiers)
|
||||
is-cur-val? (d/not-empty? modifiers)]
|
||||
|
||||
(when (d/not-empty? modifiers)
|
||||
(utils/update-transform! node shapes transforms modifiers))
|
||||
(when (and (not is-prev-val?) is-cur-val?)
|
||||
(utils/start-transform! node shapes))
|
||||
|
||||
(when (and (d/not-empty? @prev-modifiers) (empty? modifiers))
|
||||
(utils/remove-transform! node @prev-shapes))
|
||||
(when is-cur-val?
|
||||
(utils/update-transform! node shapes transforms modifiers))
|
||||
|
||||
(reset! prev-modifiers modifiers)
|
||||
(reset! prev-transforms transforms)
|
||||
(reset! prev-shapes shapes)))))
|
||||
(when (and is-prev-val? (not is-cur-val?))
|
||||
(utils/remove-transform! node @prev-shapes))
|
||||
|
||||
(reset! prev-modifiers modifiers)
|
||||
(reset! prev-transforms transforms)
|
||||
(reset! prev-shapes shapes))))))
|
||||
|
|
|
@ -48,11 +48,10 @@
|
|||
(mf/use-callback
|
||||
(fn []
|
||||
(let [canvas-node (mf/ref-val frame-canvas-ref)
|
||||
img-node (mf/ref-val frame-image-ref)]
|
||||
(ts/raf
|
||||
#(let [thumb-data (draw-thumbnail-canvas canvas-node img-node)]
|
||||
(st/emit! (dw/update-thumbnail id thumb-data))
|
||||
(reset! image-url nil))))))
|
||||
img-node (mf/ref-val frame-image-ref)
|
||||
thumb-data (draw-thumbnail-canvas canvas-node img-node)]
|
||||
(st/emit! (dw/update-thumbnail id thumb-data))
|
||||
(reset! image-url nil))))
|
||||
|
||||
on-change
|
||||
(mf/use-callback
|
||||
|
@ -70,7 +69,6 @@
|
|||
(dom/set-property! "height" height)
|
||||
(dom/set-property! "fill" "none")
|
||||
(obj/set! "innerHTML" frame-html))
|
||||
|
||||
img-src (-> svg-node dom/node->xml dom/svg->data-uri)]
|
||||
(reset! image-url img-src)))))))
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@
|
|||
(fn [event]
|
||||
(dom/stop-propagation event)
|
||||
(if (and expanded? (kbd/shift? event))
|
||||
(st/emit! dwc/collapse-all)
|
||||
(st/emit! (dwc/collapse-all))
|
||||
(st/emit! (dwc/toggle-collapse id))))
|
||||
|
||||
toggle-blocking
|
||||
|
|
|
@ -158,9 +158,10 @@
|
|||
show-outlines? (and (nil? transform) (not edition) (not drawing-obj) (not (#{:comments :path :curve} drawing-tool)))
|
||||
show-pixel-grid? (and (contains? layout :show-pixel-grid)
|
||||
(>= zoom 8))
|
||||
show-text-editor? (and editing-shape (= :text (:type editing-shape)))
|
||||
show-presence? page-id
|
||||
show-prototypes? (= options-mode :prototype)
|
||||
show-selection-handlers? (and (seq selected) (not edition))
|
||||
show-selection-handlers? (and (seq selected) (not show-text-editor?))
|
||||
show-snap-distance? (and (contains? layout :dynamic-alignment)
|
||||
(= transform :move)
|
||||
(seq selected))
|
||||
|
@ -172,7 +173,6 @@
|
|||
show-artboard-names? (contains? layout :display-artboard-names)
|
||||
show-rules? (and (contains? layout :rules) (not (contains? layout :hide-ui)))
|
||||
|
||||
show-text-editor? (and editing-shape (= :text (:type editing-shape)))
|
||||
|
||||
disabled-guides? (or drawing-tool transform)]
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@
|
|||
|
||||
on-mouse-move
|
||||
(mf/use-callback
|
||||
(mf/deps zoom v-scrolling?)
|
||||
(mf/deps zoom @v-scrolling? @h-scrolling?)
|
||||
(fn [event axis]
|
||||
(when-let [_ (or @v-scrolling? @h-scrolling?)]
|
||||
(let [viewport (mf/ref-val viewport-ref)
|
||||
|
|
|
@ -91,7 +91,7 @@
|
|||
(cond
|
||||
frame?
|
||||
[thumb-node
|
||||
(dom/query shape-node ".frame-background")
|
||||
(dom/get-parent (dom/query shape-node ".frame-background"))
|
||||
(dom/query shape-node ".frame-clip")]
|
||||
|
||||
;; For groups we don't want to transform the whole group but only
|
||||
|
@ -223,8 +223,7 @@
|
|||
:else
|
||||
(let [old-transform (dom/get-attribute node "data-old-transform")]
|
||||
(if (some? old-transform)
|
||||
(do (dom/remove-attribute! node "data-old-transform")
|
||||
(dom/set-attribute! node "transform" old-transform))
|
||||
(dom/remove-attribute! node "data-old-transform")
|
||||
(dom/remove-attribute! node "transform")))))))))
|
||||
|
||||
(defn format-viewbox [vbox]
|
||||
|
|
|
@ -344,7 +344,13 @@
|
|||
(assoc :id (resolve page-id)))
|
||||
flows (->> (get-in page-data [:options :flows])
|
||||
(mapv #(update % :starting-frame resolve)))
|
||||
page-data (d/assoc-in-when page-data [:options :flows] flows)
|
||||
|
||||
guides (-> (get-in page-data [:options :guides])
|
||||
(d/update-vals #(update % :frame-id resolve)))
|
||||
|
||||
page-data (-> page-data
|
||||
(d/assoc-in-when [:options :flows] flows)
|
||||
(d/assoc-in-when [:options :guides] guides))
|
||||
file (-> file (fb/add-page page-data))
|
||||
|
||||
;; Preprocess nodes to parallel upload the images. Store the result in a table
|
||||
|
|
Loading…
Add table
Reference in a new issue