mirror of
https://github.com/penpot/penpot.git
synced 2025-06-03 00:31:40 +02:00
🐛 Fix problem resizing texts
This commit is contained in:
parent
b71ed9f6f2
commit
bec683d1ef
5 changed files with 31 additions and 25 deletions
|
@ -250,22 +250,25 @@
|
||||||
#(patch-object % changes))
|
#(patch-object % changes))
|
||||||
|
|
||||||
([object changes]
|
([object changes]
|
||||||
(->> changes
|
(if object
|
||||||
(reduce-kv
|
(->> changes
|
||||||
(fn [object key value]
|
(reduce-kv
|
||||||
(cond
|
(fn [object key value]
|
||||||
(map? value)
|
(cond
|
||||||
(update object key patch-object value)
|
(map? value)
|
||||||
|
(let [current (get object key)]
|
||||||
|
(assoc object key (patch-object current value)))
|
||||||
|
|
||||||
(and (nil? value) (record? object))
|
(and (nil? value) (record? object))
|
||||||
(assoc object key nil)
|
(assoc object key nil)
|
||||||
|
|
||||||
(nil? value)
|
(nil? value)
|
||||||
(dissoc object key value)
|
(dissoc object key value)
|
||||||
|
|
||||||
:else
|
:else
|
||||||
(assoc object key value)))
|
(assoc object key value)))
|
||||||
object))))
|
object))
|
||||||
|
changes)))
|
||||||
|
|
||||||
(defn remove-at-index
|
(defn remove-at-index
|
||||||
"Takes a vector and returns a vector with an element in the
|
"Takes a vector and returns a vector with an element in the
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
(ns app.common.geom.modif-tree
|
(ns app.common.geom.modif-tree
|
||||||
(:require
|
(:require
|
||||||
[app.common.data.macros :as dm]
|
[app.common.data.macros :as dm]
|
||||||
[app.common.geom.shapes.min-size-layout]
|
|
||||||
[app.common.pages.helpers :as cph]
|
[app.common.pages.helpers :as cph]
|
||||||
[app.common.types.modifiers :as ctm]))
|
[app.common.types.modifiers :as ctm]))
|
||||||
|
|
||||||
|
|
|
@ -486,7 +486,7 @@
|
||||||
(transform-shape modifiers))))
|
(transform-shape modifiers))))
|
||||||
|
|
||||||
([shape modifiers]
|
([shape modifiers]
|
||||||
(if (and (some? modifiers) (not (ctm/empty? modifiers)))
|
(if (and (some? shape) (some? modifiers) (not (ctm/empty? modifiers)))
|
||||||
(let [transform (ctm/modifiers->transform modifiers)]
|
(let [transform (ctm/modifiers->transform modifiers)]
|
||||||
(cond-> shape
|
(cond-> shape
|
||||||
(and (some? transform)
|
(and (some? transform)
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
(:require
|
(:require
|
||||||
[app.common.data :as d]
|
[app.common.data :as d]
|
||||||
[app.common.data.macros :as dm]
|
[app.common.data.macros :as dm]
|
||||||
[app.common.geom.shapes.min-size-layout]
|
|
||||||
[app.common.pages.helpers :as cph]
|
[app.common.pages.helpers :as cph]
|
||||||
[app.common.types.shape.layout :as ctl]
|
[app.common.types.shape.layout :as ctl]
|
||||||
[app.common.uuid :as uuid]))
|
[app.common.uuid :as uuid]))
|
||||||
|
|
|
@ -30,15 +30,20 @@
|
||||||
[rumext.v2 :as mf]))
|
[rumext.v2 :as mf]))
|
||||||
|
|
||||||
(defn fix-position [shape]
|
(defn fix-position [shape]
|
||||||
(let [modifiers (:modifiers shape)
|
(if-let [modifiers (:modifiers shape)]
|
||||||
shape' (gsh/transform-shape shape modifiers)
|
(let [shape' (gsh/transform-shape shape modifiers)
|
||||||
;; We need to remove the movement because the dynamic modifiers will have move it
|
|
||||||
deltav (gpt/to-vec (gpt/point (:selrect shape'))
|
old-sr (dm/get-prop shape :selrect)
|
||||||
(gpt/point (:selrect shape)))]
|
new-sr (dm/get-prop shape' :selrect)
|
||||||
(-> shape
|
|
||||||
(gsh/transform-shape (ctm/move modifiers deltav))
|
;; We need to remove the movement because the dynamic modifiers will have move it
|
||||||
(mdwm/update-grow-type shape)
|
deltav (gpt/to-vec (gpt/point new-sr)
|
||||||
(dissoc :modifiers))))
|
(gpt/point old-sr))]
|
||||||
|
(-> shape
|
||||||
|
(gsh/transform-shape (ctm/move modifiers deltav))
|
||||||
|
(mdwm/update-grow-type shape)
|
||||||
|
(dissoc :modifiers)))
|
||||||
|
shape))
|
||||||
|
|
||||||
(defn- update-with-editor-state
|
(defn- update-with-editor-state
|
||||||
"Updates the shape with the current state in the editor"
|
"Updates the shape with the current state in the editor"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue