From 203f36e064301b11fb89033df4bc245a18a5c216 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Mon, 4 Dec 2023 13:01:42 +0100 Subject: [PATCH] :bug: Fix negative sizes in tracks grid editor --- .../workspace/sidebar/options/menus/layout_container.cljs | 1 + .../app/main/ui/workspace/viewport/grid_layout_editor.cljs | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/main/ui/workspace/sidebar/options/menus/layout_container.cljs b/frontend/src/app/main/ui/workspace/sidebar/options/menus/layout_container.cljs index 5bcd92a532..2b44a08648 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/menus/layout_container.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/options/menus/layout_container.cljs @@ -1003,6 +1003,7 @@ :value (:value column) :on-change #(set-column-value type index %) :placeholder "--" + :min 0 :disabled (= :auto (:type column))}]] [:div {:class (stl/css :track-info-unit)} diff --git a/frontend/src/app/main/ui/workspace/viewport/grid_layout_editor.cljs b/frontend/src/app/main/ui/workspace/viewport/grid_layout_editor.cljs index 3fc1b4b599..34a6742612 100644 --- a/frontend/src/app/main/ui/workspace/viewport/grid_layout_editor.cljs +++ b/frontend/src/app/main/ui/workspace/viewport/grid_layout_editor.cljs @@ -417,12 +417,15 @@ precision (if snap-pixel? mth/round identity) delta (/ (get position axis) zoom) + new-size-before (max 0 (precision (+ @start-size-before delta))) + new-size-after (max 0 (precision (- @start-size-after delta))) + shape (-> shape (cond-> (some? track-before) - (update-in [tracks-prop (dec index)] merge {:type :fixed :value (precision (+ @start-size-before delta))})) + (update-in [tracks-prop (dec index)] merge {:type :fixed :value new-size-before})) (cond-> (some? track-after) - (update-in [tracks-prop index] merge {:type :fixed :value (precision (- @start-size-after delta))}))) + (update-in [tracks-prop index] merge {:type :fixed :value new-size-after}))) modifiers (-> (ctm/empty)