mirror of
https://github.com/penpot/penpot.git
synced 2025-06-11 12:11:39 +02:00
commit
ab5fd68689
7 changed files with 69 additions and 47 deletions
|
@ -16,7 +16,6 @@
|
|||
[app.common.pages.helpers :as cph]
|
||||
[app.common.spec :as us]
|
||||
[app.common.types.modifiers :as ctm]
|
||||
[app.common.types.shape :as cts]
|
||||
[app.common.types.shape.layout :as ctl]
|
||||
[app.main.data.workspace.changes :as dch]
|
||||
[app.main.data.workspace.comments :as-alias dwcm]
|
||||
|
@ -206,13 +205,10 @@
|
|||
[shape {:keys [width height]}]
|
||||
(cond-> shape
|
||||
(some? width)
|
||||
(assoc :width width)
|
||||
(gsh/transform-shape (ctm/change-dimensions-modifiers shape :width width {:ignore-lock? true}))
|
||||
|
||||
(some? height)
|
||||
(assoc :height height)
|
||||
|
||||
(or (some? width) (some? height))
|
||||
(cts/setup-rect-selrect)))
|
||||
(gsh/transform-shape (ctm/change-dimensions-modifiers shape :height height {:ignore-lock? true}))))
|
||||
|
||||
(defn apply-text-modifiers
|
||||
[objects text-modifiers]
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
[app.main.data.workspace.changes :as dch]
|
||||
[app.main.data.workspace.collapse :as dwc]
|
||||
[app.main.data.workspace.state-helpers :as wsh]
|
||||
[app.main.data.workspace.thumbnails :as dwt]
|
||||
[app.main.data.workspace.undo :as dwu]
|
||||
[app.main.data.workspace.zoom :as dwz]
|
||||
[app.main.refs :as refs]
|
||||
|
@ -549,13 +548,6 @@
|
|||
(map #(get-in % [:obj :id]))
|
||||
(into (d/ordered-set)))
|
||||
|
||||
dup-frames (->> changes
|
||||
:redo-changes
|
||||
(filter #(= (:type %) :add-obj))
|
||||
(filter #(selected (:old-id %)))
|
||||
(filter #(= :frame (get-in % [:obj :type])))
|
||||
(map #(vector (:old-id %) (get-in % [:obj :id]))))
|
||||
|
||||
id-duplicated (first new-selected)
|
||||
|
||||
frames (into #{}
|
||||
|
@ -563,18 +555,14 @@
|
|||
selected)
|
||||
undo-id (js/Symbol)]
|
||||
|
||||
(rx/concat
|
||||
(->> (rx/from dup-frames)
|
||||
(rx/map (fn [[old-id new-id]] (dwt/duplicate-thumbnail old-id new-id))))
|
||||
|
||||
;; Warning: This order is important for the focus mode.
|
||||
(rx/of
|
||||
;; Warning: This order is important for the focus mode.
|
||||
(rx/of
|
||||
(dwu/start-undo-transaction undo-id)
|
||||
(dch/commit-changes changes)
|
||||
(select-shapes new-selected)
|
||||
(ptk/data-event :layout/update frames)
|
||||
(memorize-duplicated id-original id-duplicated)
|
||||
(dwu/commit-undo-transaction undo-id))))))))))
|
||||
(dwu/commit-undo-transaction undo-id)))))))))
|
||||
|
||||
(defn change-hover-state
|
||||
[id value]
|
||||
|
|
|
@ -69,7 +69,8 @@
|
|||
|
||||
(rx/concat
|
||||
;; Delete the thumbnail first so if we interrupt we can regenerate after
|
||||
(rp/cmd! :upsert-file-object-thumbnail params)
|
||||
(->> (rp/cmd! :upsert-file-object-thumbnail params)
|
||||
(rx/catch #(rx/empty)))
|
||||
(->> blob-result
|
||||
(rx/merge-map
|
||||
(fn [blob]
|
||||
|
@ -84,7 +85,9 @@
|
|||
(rx/merge
|
||||
;; Update the local copy of the thumbnails so we don't need to request it again
|
||||
(rx/of #(update % :workspace-thumbnails assoc object-id data))
|
||||
(->> (rp/cmd! :upsert-file-object-thumbnail params)
|
||||
(->> (rx/timer 5000)
|
||||
(rx/flat-map #(rp/cmd! :upsert-file-object-thumbnail params))
|
||||
(rx/catch #(rx/empty))
|
||||
(rx/ignore))))
|
||||
|
||||
(rx/empty)))))))))))
|
||||
|
|
|
@ -63,7 +63,8 @@
|
|||
col? (ctl/col? shape)
|
||||
|
||||
children (->> (cph/get-immediate-children objects (:id shape))
|
||||
(remove :hidden))
|
||||
(remove :hidden)
|
||||
(map #(vector (gpo/parent-coords-bounds (:points %) (:points shape)) %)))
|
||||
layout-data (gsl/calc-layout-data shape children (:points shape))
|
||||
|
||||
layout-bounds (:layout-bounds layout-data)
|
||||
|
@ -85,7 +86,8 @@
|
|||
|
||||
(mf/defc debug-drop-zones
|
||||
"Debug component to show the auto-layout drop areas"
|
||||
{::mf/wrap-props false}
|
||||
{::mf/wrap [#(mf/memo' % (mf/check-props ["objects" "selected-shapes" "hover-top-frame-id"]))]
|
||||
::mf/wrap-props false}
|
||||
[props]
|
||||
|
||||
(let [objects (unchecked-get props "objects")
|
||||
|
@ -100,11 +102,7 @@
|
|||
shape (or selected-frame (get objects hover-top-frame-id))]
|
||||
|
||||
(when (and shape (:layout shape))
|
||||
(let [children (->> (cph/get-immediate-children objects (:id shape))
|
||||
(remove :hidden)
|
||||
(map #(vector (gpo/parent-coords-bounds (:points %) (:points shape)) %)))
|
||||
layout-data (gsl/calc-layout-data shape children (:points shape))
|
||||
drop-areas (gsl/layout-drop-areas shape layout-data children)]
|
||||
(let [drop-areas (gsl/get-drop-areas shape objects)]
|
||||
[:g.debug-layout {:pointer-events "none"
|
||||
:transform (gsh/transform-str shape)}
|
||||
(for [[idx drop-area] (d/enumerate drop-areas)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue