mirror of
https://github.com/penpot/penpot.git
synced 2025-02-03 04:49:03 -05:00
🐛 Fixes issue with lock proportions
This commit is contained in:
parent
69b4968578
commit
0ea8e9e750
1 changed files with 21 additions and 12 deletions
|
@ -95,7 +95,14 @@
|
||||||
;; Resize vector
|
;; Resize vector
|
||||||
scalev (gpt/divide (gpt/add shapev deltav) shapev)
|
scalev (gpt/divide (gpt/add shapev deltav) shapev)
|
||||||
|
|
||||||
scalev (if lock? (let [v (max (:x scalev) (:y scalev))] (gpt/point v v)) scalev)
|
scalev (if lock?
|
||||||
|
(let [v (cond
|
||||||
|
(#{:right :left} handler) (:x scalev)
|
||||||
|
(#{:top :bottom} handler) (:y scalev)
|
||||||
|
:else (max (:x scalev) (:y scalev)))]
|
||||||
|
(gpt/point v v))
|
||||||
|
|
||||||
|
scalev)
|
||||||
|
|
||||||
shape-transform (:transform shape (gmt/matrix))
|
shape-transform (:transform shape (gmt/matrix))
|
||||||
shape-transform-inverse (:transform-inverse shape (gmt/matrix))
|
shape-transform-inverse (:transform-inverse shape (gmt/matrix))
|
||||||
|
@ -294,18 +301,20 @@
|
||||||
|
|
||||||
snap-delta (->> position
|
snap-delta (->> position
|
||||||
(rx/switch-map #(snap/closest-snap-move page-id shapes objects layout zoom %)))]
|
(rx/switch-map #(snap/closest-snap-move page-id shapes objects layout zoom %)))]
|
||||||
(rx/concat
|
(if (empty? shapes)
|
||||||
(->> snap-delta
|
(rx/empty)
|
||||||
(rx/with-latest vector position)
|
(rx/concat
|
||||||
(rx/map (fn [[delta pos]] (-> (gpt/add pos delta) (gpt/round 0))))
|
(->> snap-delta
|
||||||
(rx/map gmt/translate-matrix)
|
(rx/with-latest vector position)
|
||||||
(rx/map #(fn [state] (assoc-in state [:workspace-local :modifiers] {:displacement %}))))
|
(rx/map (fn [[delta pos]] (-> (gpt/add pos delta) (gpt/round 0))))
|
||||||
|
(rx/map gmt/translate-matrix)
|
||||||
|
(rx/map #(fn [state] (assoc-in state [:workspace-local :modifiers] {:displacement %}))))
|
||||||
|
|
||||||
(rx/of (set-modifiers ids)
|
(rx/of (set-modifiers ids)
|
||||||
(apply-modifiers ids)
|
(apply-modifiers ids)
|
||||||
(calculate-frame-for-move ids)
|
(calculate-frame-for-move ids)
|
||||||
(fn [state] (update state :workspace-local dissoc :modifiers))
|
(fn [state] (update state :workspace-local dissoc :modifiers))
|
||||||
finish-transform)))))))
|
finish-transform))))))))
|
||||||
|
|
||||||
(defn- get-displacement-with-grid
|
(defn- get-displacement-with-grid
|
||||||
"Retrieve the correct displacement delta point for the
|
"Retrieve the correct displacement delta point for the
|
||||||
|
|
Loading…
Add table
Reference in a new issue