From 52892681561a76fd81b83beaed453cfac802ac9a Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Mon, 10 Aug 2020 12:38:26 +0200 Subject: [PATCH] :bug: Fix unwanted warnings on first shape drawing. --- common/uxbox/common/geom/shapes.cljc | 1 + frontend/src/uxbox/main/ui/workspace/drawarea.cljs | 8 ++++++-- frontend/src/uxbox/main/ui/workspace/selection.cljs | 2 +- .../src/uxbox/main/ui/workspace/sidebar/options/fill.cljs | 1 - 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/common/uxbox/common/geom/shapes.cljc b/common/uxbox/common/geom/shapes.cljc index 463d5e7b0..cb1c8ce19 100644 --- a/common/uxbox/common/geom/shapes.cljc +++ b/common/uxbox/common/geom/shapes.cljc @@ -768,6 +768,7 @@ (update $ :transform-inverse #(gmt/multiply stretch-matrix-inverse (or % (gmt/matrix)))) (assoc $ :points (shape->points $)) (assoc $ :selrect (points->selrect (:points $))) + (update $ :selrect fix-invalid-rect-values) (update $ :rotation #(mod (+ % (get-in $ [:modifiers :rotation] 0)) 360)) )] diff --git a/frontend/src/uxbox/main/ui/workspace/drawarea.cljs b/frontend/src/uxbox/main/ui/workspace/drawarea.cljs index beb518a5c..a954d0e1b 100644 --- a/frontend/src/uxbox/main/ui/workspace/drawarea.cljs +++ b/frontend/src/uxbox/main/ui/workspace/drawarea.cljs @@ -13,6 +13,7 @@ [uxbox.main.store :as st] [uxbox.main.ui.workspace.shapes :as shapes] [uxbox.common.geom.shapes :as gsh] + [uxbox.common.data :as d] [uxbox.util.dom :as dom] [uxbox.util.i18n :as i18n :refer [t]])) @@ -28,8 +29,11 @@ (mf/defc generic-draw-area [{:keys [shape zoom]}] - (let [{:keys [x y width height]} (:selrect (gsh/transform-shape shape))] - (when (and x y) + (let [{:keys [x y width height] :as kk} (:selrect (gsh/transform-shape shape))] + (when (and x y + (not (d/nan? x)) + (not (d/nan? y))) + [:g [:& shapes/shape-wrapper {:shape shape}] [:rect.main {:x x :y y diff --git a/frontend/src/uxbox/main/ui/workspace/selection.cljs b/frontend/src/uxbox/main/ui/workspace/selection.cljs index 35132f27a..661f323b8 100644 --- a/frontend/src/uxbox/main/ui/workspace/selection.cljs +++ b/frontend/src/uxbox/main/ui/workspace/selection.cljs @@ -198,7 +198,7 @@ :on-resize (partial on-resize position) :transform transform :rotation (:rotation shape)} - props (->> props (merge common-props) map->obj)] + props (map->obj (merge common-props props))] (case type :rotation (when (not= :frame (:type shape)) [:> rotation-handler props]) :resize-point [:> resize-point-handler props] diff --git a/frontend/src/uxbox/main/ui/workspace/sidebar/options/fill.cljs b/frontend/src/uxbox/main/ui/workspace/sidebar/options/fill.cljs index 10c84234a..32b84111d 100644 --- a/frontend/src/uxbox/main/ui/workspace/sidebar/options/fill.cljs +++ b/frontend/src/uxbox/main/ui/workspace/sidebar/options/fill.cljs @@ -86,7 +86,6 @@ :editor editor :attrs converted-attrs})) text-ids)))))] - (prn "fill-menu" ids values) (if show? [:div.element-set [:div.element-set-title