mirror of
https://github.com/penpot/penpot.git
synced 2025-06-17 10:02:18 +02:00
✨ Flex layout small fixes
This commit is contained in:
parent
c86d88834e
commit
861eb283e8
9 changed files with 132 additions and 102 deletions
|
@ -10,7 +10,6 @@
|
|||
[app.common.data :as d]
|
||||
[app.common.geom.point :as gpt]
|
||||
[app.common.geom.shapes :as gsh]
|
||||
[app.common.geom.shapes.flex-layout :as gsl]
|
||||
[app.common.math :as mth]
|
||||
[app.common.pages.common :as cpc]
|
||||
[app.common.pages.helpers :as cph]
|
||||
|
|
|
@ -460,9 +460,7 @@
|
|||
(rx/switch-map
|
||||
(fn [pos]
|
||||
(->> (snap/closest-snap-move page-id shapes objects layout zoom focus pos)
|
||||
(rx/map #(vector pos %)))))))
|
||||
|
||||
drop-frame (atom nil)]
|
||||
(rx/map #(vector pos %)))))))]
|
||||
(if (empty? shapes)
|
||||
(rx/of (finish-transform))
|
||||
(let [move-stream
|
||||
|
@ -496,7 +494,7 @@
|
|||
(->> move-stream
|
||||
(rx/last)
|
||||
(rx/mapcat
|
||||
(fn [[move-vector target-frame drop-index]]
|
||||
(fn [[_ target-frame drop-index]]
|
||||
(rx/of (dwu/start-undo-transaction)
|
||||
(move-shapes-to-frame ids target-frame drop-index)
|
||||
(dwm/apply-modifiers {:undo-transation? false})
|
||||
|
@ -606,7 +604,7 @@
|
|||
(pcb/with-objects objects)
|
||||
(pcb/change-parent frame-id moving-shapes drop-index))]
|
||||
|
||||
(when (and (some? frame-id) (not (empty? changes)))
|
||||
(when (and (some? frame-id) (d/not-empty? changes))
|
||||
(rx/of (dch/commit-changes changes)
|
||||
(dwc/expand-collapse frame-id)))))))
|
||||
|
||||
|
@ -637,7 +635,7 @@
|
|||
selected
|
||||
(-> (ctm/empty-modifiers)
|
||||
(ctm/set-resize (gpt/point -1.0 1.0) origin)
|
||||
(ctm/move (gpt/point (:width selrect) 0))))]
|
||||
(ctm/set-move (gpt/point (:width selrect) 0))))]
|
||||
|
||||
(rx/of (dwm/set-modifiers modif-tree true)
|
||||
(dwm/apply-modifiers))))))
|
||||
|
@ -656,7 +654,7 @@
|
|||
selected
|
||||
(-> (ctm/empty-modifiers)
|
||||
(ctm/set-resize (gpt/point 1.0 -1.0) origin)
|
||||
(ctm/move (gpt/point 0 (:height selrect)))))]
|
||||
(ctm/set-move (gpt/point 0 (:height selrect)))))]
|
||||
|
||||
(rx/of (dwm/set-modifiers modif-tree true)
|
||||
(dwm/apply-modifiers))))))
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
|
||||
(ns app.main.ui.workspace.shapes.path.editor
|
||||
(:require
|
||||
[app.common.data :as d]
|
||||
[app.common.data.macros :as dm]
|
||||
[app.common.geom.point :as gpt]
|
||||
[app.common.geom.shapes.path :as gsp]
|
||||
[app.common.path.commands :as upc]
|
||||
|
@ -308,7 +310,7 @@
|
|||
:start-path? start-p?
|
||||
:zoom zoom}]])
|
||||
|
||||
(for [position points]
|
||||
(for [[index position] (d/enumerate points)]
|
||||
(let [show-handler?
|
||||
(fn [[index prefix]]
|
||||
(let [handler-position (upc/handler->point content index prefix)]
|
||||
|
@ -322,7 +324,7 @@
|
|||
pos-handlers (->> pos-handlers (filter show-handler?))
|
||||
curve? (boolean (seq pos-handlers))]
|
||||
|
||||
[:g.path-node
|
||||
[:g.path-node {:key (dm/str index "-" (:x position) "-" (:y position))}
|
||||
[:g.point-handlers {:pointer-events (when (= edit-mode :draw) "none")}
|
||||
(for [[index prefix] pos-handlers]
|
||||
(let [handler-position (upc/handler->point content index prefix)
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
[app.main.ui.workspace.viewport.path-actions :refer [path-actions]]
|
||||
[app.main.ui.workspace.viewport.utils :as vwu]
|
||||
[app.util.dom :as dom]
|
||||
[debug :refer [debug?]]
|
||||
[rumext.v2 :as mf]))
|
||||
|
||||
(mf/defc pixel-grid
|
||||
|
@ -34,8 +35,8 @@
|
|||
:pattern-units "userSpaceOnUse"}
|
||||
[:path {:d "M 1 0 L 0 0 0 1"
|
||||
:style {:fill "none"
|
||||
:stroke "var(--color-info)"
|
||||
:stroke-opacity "0.2"
|
||||
:stroke (if (debug? :pixel-grid) "red" "var(--color-info)")
|
||||
:stroke-opacity (if (debug? :pixel-grid) 1 "0.2")
|
||||
:stroke-width (str (/ 1 zoom))}}]]]
|
||||
[:rect {:x (:x vbox)
|
||||
:y (:y vbox)
|
||||
|
|
|
@ -70,6 +70,9 @@
|
|||
|
||||
;; Enable a widget to show the auto-layout drop-zones
|
||||
:layout-drop-zones
|
||||
|
||||
;; Makes the pixel grid red so its more visibile
|
||||
:pixel-grid
|
||||
})
|
||||
|
||||
;; These events are excluded when we activate the :events flag
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue