🐛 Fix problem resizing texts

This commit is contained in:
alonso.torres 2023-11-07 11:26:01 +01:00
parent b71ed9f6f2
commit bec683d1ef
5 changed files with 31 additions and 25 deletions

View file

@ -250,12 +250,14 @@
#(patch-object % changes))
([object changes]
(if object
(->> changes
(reduce-kv
(fn [object key value]
(cond
(map? value)
(update object key patch-object value)
(let [current (get object key)]
(assoc object key (patch-object current value)))
(and (nil? value) (record? object))
(assoc object key nil)
@ -265,7 +267,8 @@
:else
(assoc object key value)))
object))))
object))
changes)))
(defn remove-at-index
"Takes a vector and returns a vector with an element in the

View file

@ -7,7 +7,6 @@
(ns app.common.geom.modif-tree
(:require
[app.common.data.macros :as dm]
[app.common.geom.shapes.min-size-layout]
[app.common.pages.helpers :as cph]
[app.common.types.modifiers :as ctm]))

View file

@ -486,7 +486,7 @@
(transform-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)]
(cond-> shape
(and (some? transform)

View file

@ -8,7 +8,6 @@
(:require
[app.common.data :as d]
[app.common.data.macros :as dm]
[app.common.geom.shapes.min-size-layout]
[app.common.pages.helpers :as cph]
[app.common.types.shape.layout :as ctl]
[app.common.uuid :as uuid]))

View file

@ -30,15 +30,20 @@
[rumext.v2 :as mf]))
(defn fix-position [shape]
(let [modifiers (:modifiers shape)
shape' (gsh/transform-shape shape modifiers)
(if-let [modifiers (:modifiers shape)]
(let [shape' (gsh/transform-shape shape modifiers)
old-sr (dm/get-prop shape :selrect)
new-sr (dm/get-prop shape' :selrect)
;; We need to remove the movement because the dynamic modifiers will have move it
deltav (gpt/to-vec (gpt/point (:selrect shape'))
(gpt/point (:selrect shape)))]
deltav (gpt/to-vec (gpt/point new-sr)
(gpt/point old-sr))]
(-> shape
(gsh/transform-shape (ctm/move modifiers deltav))
(mdwm/update-grow-type shape)
(dissoc :modifiers))))
(dissoc :modifiers)))
shape))
(defn- update-with-editor-state
"Updates the shape with the current state in the editor"