0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-09 16:30:37 -05:00

🐛 Fix selrect renderning on move on path based shapes.

Taiga Issue: https://tree.taiga.io/project/uxbox/issue/272
This commit is contained in:
Andrey Antukh 2019-07-22 11:03:22 +02:00
parent 125e7375c0
commit 2b81832b67
3 changed files with 21 additions and 17 deletions

View file

@ -10,20 +10,15 @@
[cljs.spec.alpha :as s] [cljs.spec.alpha :as s]
[cuerdas.core :as str] [cuerdas.core :as str]
[lentes.core :as l] [lentes.core :as l]
[potok.core :as ptk]
[rumext.core :as mx]
[rumext.alpha :as mf] [rumext.alpha :as mf]
[uxbox.builtins.icons :as i] [uxbox.builtins.icons :as i]
[uxbox.main.data.users :as udu] [uxbox.main.data.users :as udu]
[uxbox.main.store :as st] [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.dom :as dom]
[uxbox.util.data :refer [read-string]] [uxbox.util.data :refer [read-string]]
[uxbox.util.forms :as fm] [uxbox.util.forms :as fm]
[uxbox.util.i18n :as i18n :refer [tr]] [uxbox.util.i18n :as i18n :refer [tr]]
[uxbox.util.interop :refer [iterable->seq]] [uxbox.util.interop :refer [iterable->seq]]))
[uxbox.util.router :as r]))
(def form-data (fm/focus-data :profile st/state)) (def form-data (fm/focus-data :profile st/state))

View file

@ -199,18 +199,25 @@
(rx/subscribe stream on-move)))) (rx/subscribe stream on-move))))
(mx/defc path-edition-selection-handlers (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] (letfn [(on-mouse-down [index event]
(dom/stop-propagation event) (dom/stop-propagation event)
(start-path-edition id index))] (start-path-edition id index))]
(let [{:keys [displacement]} modifiers
segments (if displacement
(map #(gpt/transform % displacement) segments)
segments)]
[:g.controls [:g.controls
(for [[index {:keys [x y]}] (map-indexed vector segments)] (for [[index {:keys [x y]}] (map-indexed vector segments)]
[:circle {:cx x :cy y [:circle {:cx x :cy y
:r (/ 6.0 zoom) :r (/ 6.0 zoom)
:key index
:on-mouse-down (partial on-mouse-down index) :on-mouse-down (partial on-mouse-down index)
:fill "#31e6e0" :fill "#31e6e0"
:stroke "#28c4d4" :stroke "#28c4d4"
:style {:cursor "pointer"}}])])) :style {:cursor "pointer"}}])])))
(mx/defc multiple-selection-handlers (mx/defc multiple-selection-handlers
{:mixins [mx/static]} {:mixins [mx/static]}
@ -272,8 +279,9 @@
(text-edition-selection-handlers zoom)) (text-edition-selection-handlers zoom))
(= type :path) (= type :path)
(if (= @refs/selected-edition (:id shape)) (if (= edition? (:id shape))
(path-edition-selection-handlers shape zoom) (-> (assoc shape :modifiers (get modifiers id))
(path-edition-selection-handlers zoom))
(-> (assoc shape :modifiers (get modifiers id)) (-> (assoc shape :modifiers (get modifiers id))
(single-selection-handlers zoom))) (single-selection-handlers zoom)))

View file

@ -54,6 +54,7 @@
{:optimizations :advanced {:optimizations :advanced
:pretty-print false :pretty-print false
:static-fns true :static-fns true
;; :fn-invoke-direct true
:elide-asserts true}))) :elide-asserts true})))
(defmethod task "build" (defmethod task "build"