🐛 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)) #(patch-object % changes))
([object changes] ([object changes]
(if object
(->> changes (->> changes
(reduce-kv (reduce-kv
(fn [object key value] (fn [object key value]
(cond (cond
(map? value) (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)) (and (nil? value) (record? object))
(assoc object key nil) (assoc object key nil)
@ -265,7 +267,8 @@
: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

View file

@ -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]))

View file

@ -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)

View file

@ -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]))

View file

@ -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)
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 ;; We need to remove the movement because the dynamic modifiers will have move it
deltav (gpt/to-vec (gpt/point (:selrect shape')) deltav (gpt/to-vec (gpt/point new-sr)
(gpt/point (:selrect shape)))] (gpt/point old-sr))]
(-> shape (-> shape
(gsh/transform-shape (ctm/move modifiers deltav)) (gsh/transform-shape (ctm/move modifiers deltav))
(mdwm/update-grow-type shape) (mdwm/update-grow-type shape)
(dissoc :modifiers)))) (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"