From 4dac2221e778d5f8e59c0d7849020d71ccbb91b9 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Tue, 26 Mar 2024 15:29:12 +0100 Subject: [PATCH] :bug: Fix problem with proportional scaling --- .../src/app/common/geom/shapes/effects.cljc | 6 ++++ .../src/app/common/geom/shapes/strokes.cljc | 6 ++++ common/src/app/common/types/modifiers.cljc | 36 ++++++++++--------- 3 files changed, 31 insertions(+), 17 deletions(-) diff --git a/common/src/app/common/geom/shapes/effects.cljc b/common/src/app/common/geom/shapes/effects.cljc index 912b2de6c..8cac7e25b 100644 --- a/common/src/app/common/geom/shapes/effects.cljc +++ b/common/src/app/common/geom/shapes/effects.cljc @@ -1,3 +1,9 @@ +;; This Source Code Form is subject to the terms of the Mozilla Public +;; License, v. 2.0. If a copy of the MPL was not distributed with this +;; file, You can obtain one at http://mozilla.org/MPL/2.0/. +;; +;; Copyright (c) KALEIDOS INC + (ns app.common.geom.shapes.effects) (defn update-shadow-scale diff --git a/common/src/app/common/geom/shapes/strokes.cljc b/common/src/app/common/geom/shapes/strokes.cljc index 272e5e12b..905aac030 100644 --- a/common/src/app/common/geom/shapes/strokes.cljc +++ b/common/src/app/common/geom/shapes/strokes.cljc @@ -1,3 +1,9 @@ +;; This Source Code Form is subject to the terms of the Mozilla Public +;; License, v. 2.0. If a copy of the MPL was not distributed with this +;; file, You can obtain one at http://mozilla.org/MPL/2.0/. +;; +;; Copyright (c) KALEIDOS INC + (ns app.common.geom.shapes.strokes) (defn update-stroke-width diff --git a/common/src/app/common/types/modifiers.cljc b/common/src/app/common/types/modifiers.cljc index 7967d0379..d0669a024 100644 --- a/common/src/app/common/types/modifiers.cljc +++ b/common/src/app/common/types/modifiers.cljc @@ -737,30 +737,32 @@ (apply-scale-content [shape value] - (cond-> shape - (cfh/text-shape? shape) - (update-text-content scale-text-content value) + ;; Scale can only be positive + (let [value (mth/abs value)] + (cond-> shape + (cfh/text-shape? shape) + (update-text-content scale-text-content value) - :always - (gsc/update-corners-scale value) + :always + (gsc/update-corners-scale value) - (d/not-empty? (:strokes shape)) - (gss/update-strokes-width value) + (d/not-empty? (:strokes shape)) + (gss/update-strokes-width value) - (d/not-empty? (:shadow shape)) - (gse/update-shadows-scale value) + (d/not-empty? (:shadow shape)) + (gse/update-shadows-scale value) - (some? (:blur shape)) - (gse/update-blur-scale value) + (some? (:blur shape)) + (gse/update-blur-scale value) - (ctl/flex-layout? shape) - (ctl/update-flex-scale value) + (ctl/flex-layout? shape) + (ctl/update-flex-scale value) - (ctl/grid-layout? shape) - (ctl/update-grid-scale value) + (ctl/grid-layout? shape) + (ctl/update-grid-scale value) - :always - (ctl/update-flex-child value)))] + :always + (ctl/update-flex-child value))))] (let [remove-children (fn [shapes children-to-remove]