diff --git a/frontend/src/app/main/fonts.cljs b/frontend/src/app/main/fonts.cljs index dbae6943a..c63df3fc2 100644 --- a/frontend/src/app/main/fonts.cljs +++ b/frontend/src/app/main/fonts.cljs @@ -220,11 +220,13 @@ (swap! loading dissoc font-id) (resolve font-id)) - load-p (p/create - (fn [resolve _] - (-> font - (assoc ::on-loaded (partial on-load resolve)) - (load-font))))] + load-p (->> (p/create + (fn [resolve _] + (-> font + (assoc ::on-loaded (partial on-load resolve)) + (load-font)))) + ;; We need to wait for the font to be loaded + (p/delay 120))] (swap! loading assoc font-id load-p) load-p)))))) diff --git a/frontend/src/app/main/ui/workspace/shapes/text/viewport_texts_html.cljs b/frontend/src/app/main/ui/workspace/shapes/text/viewport_texts_html.cljs index 94fd08b94..864ff8d15 100644 --- a/frontend/src/app/main/ui/workspace/shapes/text/viewport_texts_html.cljs +++ b/frontend/src/app/main/ui/workspace/shapes/text/viewport_texts_html.cljs @@ -119,8 +119,8 @@ (defn text-properties-equal? [shape other] (or (identical? shape other) - (and (= (dm/get-prop shape :grow-type) (dm/get-prop other :grow-type)) - (= (dm/get-prop shape :content) (dm/get-prop other :content)) + (and (= (:grow-type shape) (:grow-type other)) + (= (:content shape) (:content other)) ;; Check if the position and size is close. If any of these changes the shape has changed ;; and if not there is no geometry relevant change (mth/close? (dm/get-prop shape :x) (dm/get-prop other :x)) @@ -132,6 +132,7 @@ {::mf/wrap-props false} [props] (let [text-shapes (unchecked-get props "text-shapes") + prev-text-shapes (hooks/use-previous text-shapes) ;; We store in the state the texts still pending to be calculated so we can @@ -295,7 +296,7 @@ (into {} (keep (fn [[id modifiers]] (when-let [shape (get text-shapes id)] - (vector id (merge shape modifiers))))) + (vector id (d/patch-object shape modifiers))))) modifiers)))] ;; We only need the effect to run on "mount" because the next fonts will be changed when the texts are diff --git a/frontend/src/app/util/text_svg_position.cljs b/frontend/src/app/util/text_svg_position.cljs index 649873284..7047413ff 100644 --- a/frontend/src/app/util/text_svg_position.cljs +++ b/frontend/src/app/util/text_svg_position.cljs @@ -53,7 +53,6 @@ font-id (dom/get-property-value styles "--font-id")] (->> (fonts/ensure-loaded! font-id) - (p/delay 125) (p/fmap (fn [] (when-not ^boolean (dom/check-font? font) (load-font font))))