From 2b81832b672f137f906d46a3649100934cc9f387 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Mon, 22 Jul 2019 11:03:22 +0200 Subject: [PATCH] :bug: Fix selrect renderning on move on path based shapes. Taiga Issue: https://tree.taiga.io/project/uxbox/issue/272 --- .../src/uxbox/main/ui/settings/profile.cljs | 7 +---- .../src/uxbox/main/ui/shapes/selection.cljs | 30 ++++++++++++------- frontend/tools.clj | 1 + 3 files changed, 21 insertions(+), 17 deletions(-) diff --git a/frontend/src/uxbox/main/ui/settings/profile.cljs b/frontend/src/uxbox/main/ui/settings/profile.cljs index 4d5c8d19b..e8857d2ea 100644 --- a/frontend/src/uxbox/main/ui/settings/profile.cljs +++ b/frontend/src/uxbox/main/ui/settings/profile.cljs @@ -10,20 +10,15 @@ [cljs.spec.alpha :as s] [cuerdas.core :as str] [lentes.core :as l] - [potok.core :as ptk] - [rumext.core :as mx] [rumext.alpha :as mf] [uxbox.builtins.icons :as i] [uxbox.main.data.users :as udu] [uxbox.main.store :as st] - [uxbox.main.ui.messages :refer [messages-widget]] - [uxbox.main.ui.settings.header :refer [header]] [uxbox.util.dom :as dom] [uxbox.util.data :refer [read-string]] [uxbox.util.forms :as fm] [uxbox.util.i18n :as i18n :refer [tr]] - [uxbox.util.interop :refer [iterable->seq]] - [uxbox.util.router :as r])) + [uxbox.util.interop :refer [iterable->seq]])) (def form-data (fm/focus-data :profile st/state)) diff --git a/frontend/src/uxbox/main/ui/shapes/selection.cljs b/frontend/src/uxbox/main/ui/shapes/selection.cljs index 3a3aafbb1..2abedb2b9 100644 --- a/frontend/src/uxbox/main/ui/shapes/selection.cljs +++ b/frontend/src/uxbox/main/ui/shapes/selection.cljs @@ -199,18 +199,25 @@ (rx/subscribe stream on-move)))) (mx/defc path-edition-selection-handlers - [{:keys [id segments] :as shape} zoom] + [{:keys [id segments modifiers] :as shape} zoom] (letfn [(on-mouse-down [index event] (dom/stop-propagation event) (start-path-edition id index))] - [:g.controls - (for [[index {:keys [x y]}] (map-indexed vector segments)] - [:circle {:cx x :cy y - :r (/ 6.0 zoom) - :on-mouse-down (partial on-mouse-down index) - :fill "#31e6e0" - :stroke "#28c4d4" - :style {:cursor "pointer"}}])])) + + (let [{:keys [displacement]} modifiers + segments (if displacement + (map #(gpt/transform % displacement) segments) + segments)] + + [:g.controls + (for [[index {:keys [x y]}] (map-indexed vector segments)] + [:circle {:cx x :cy y + :r (/ 6.0 zoom) + :key index + :on-mouse-down (partial on-mouse-down index) + :fill "#31e6e0" + :stroke "#28c4d4" + :style {:cursor "pointer"}}])]))) (mx/defc multiple-selection-handlers {:mixins [mx/static]} @@ -272,8 +279,9 @@ (text-edition-selection-handlers zoom)) (= type :path) - (if (= @refs/selected-edition (:id shape)) - (path-edition-selection-handlers shape zoom) + (if (= edition? (:id shape)) + (-> (assoc shape :modifiers (get modifiers id)) + (path-edition-selection-handlers zoom)) (-> (assoc shape :modifiers (get modifiers id)) (single-selection-handlers zoom))) diff --git a/frontend/tools.clj b/frontend/tools.clj index 617b5f3ee..ff41a6464 100644 --- a/frontend/tools.clj +++ b/frontend/tools.clj @@ -54,6 +54,7 @@ {:optimizations :advanced :pretty-print false :static-fns true + ;; :fn-invoke-direct true :elide-asserts true}))) (defmethod task "build"