mirror of
https://github.com/penpot/penpot.git
synced 2025-01-10 00:40:30 -05:00
🐛 Fix problem with multiple selection conflicting with hover
This commit is contained in:
parent
ba0f7416bb
commit
b5b97f7626
4 changed files with 20 additions and 17 deletions
|
@ -219,17 +219,15 @@
|
||||||
lks/empty-linked-set)
|
lks/empty-linked-set)
|
||||||
selrect (get-in state [:workspace-local :selrect])
|
selrect (get-in state [:workspace-local :selrect])
|
||||||
blocked? (fn [id] (get-in objects [id :blocked] false))]
|
blocked? (fn [id] (get-in objects [id :blocked] false))]
|
||||||
(rx/merge
|
(when selrect
|
||||||
|
(->> (uw/ask! {:cmd :selection/query
|
||||||
(when selrect
|
:page-id page-id
|
||||||
(->> (uw/ask! {:cmd :selection/query
|
:rect selrect
|
||||||
:page-id page-id
|
:include-frames? true
|
||||||
:rect selrect
|
:full-frame? true})
|
||||||
:include-frames? true
|
(rx/map #(cp/clean-loops objects %))
|
||||||
:full-frame? true})
|
(rx/map #(into initial-set (filter (comp not blocked?)) %))
|
||||||
(rx/map #(cp/clean-loops objects %))
|
(rx/map select-shapes)))))))
|
||||||
(rx/map #(into initial-set (filter (comp not blocked?)) %))
|
|
||||||
(rx/map select-shapes))))))))
|
|
||||||
|
|
||||||
(defn select-inside-group
|
(defn select-inside-group
|
||||||
[group-id position]
|
[group-id position]
|
||||||
|
|
|
@ -153,7 +153,7 @@
|
||||||
(hooks/setup-cursor cursor alt? panning drawing-tool drawing-path? node-editing?)
|
(hooks/setup-cursor cursor alt? panning drawing-tool drawing-path? node-editing?)
|
||||||
(hooks/setup-resize layout viewport-ref)
|
(hooks/setup-resize layout viewport-ref)
|
||||||
(hooks/setup-keyboard alt? ctrl? space?)
|
(hooks/setup-keyboard alt? ctrl? space?)
|
||||||
(hooks/setup-hover-shapes page-id move-stream selected objects transform selected ctrl? hover hover-ids zoom)
|
(hooks/setup-hover-shapes page-id move-stream objects transform selected ctrl? hover hover-ids zoom)
|
||||||
(hooks/setup-viewport-modifiers modifiers selected objects render-ref)
|
(hooks/setup-viewport-modifiers modifiers selected objects render-ref)
|
||||||
(hooks/setup-shortcuts node-editing? drawing-path?)
|
(hooks/setup-shortcuts node-editing? drawing-path?)
|
||||||
(hooks/setup-active-frames objects vbox hover active-frames)
|
(hooks/setup-active-frames objects vbox hover active-frames)
|
||||||
|
|
|
@ -89,11 +89,11 @@
|
||||||
(hooks/use-stream ms/keyboard-ctrl #(reset! ctrl? %))
|
(hooks/use-stream ms/keyboard-ctrl #(reset! ctrl? %))
|
||||||
(hooks/use-stream ms/keyboard-space #(reset! space? %)))
|
(hooks/use-stream ms/keyboard-space #(reset! space? %)))
|
||||||
|
|
||||||
;; TODO: revisit the arguments, looks like `selected` is not necessary here
|
(defn setup-hover-shapes [page-id move-stream objects transform selected ctrl? hover hover-ids zoom]
|
||||||
(defn setup-hover-shapes [page-id move-stream _selected objects transform selected ctrl? hover hover-ids zoom]
|
|
||||||
(let [;; We use ref so we don't recreate the stream on a change
|
(let [;; We use ref so we don't recreate the stream on a change
|
||||||
zoom-ref (mf/use-ref zoom)
|
zoom-ref (mf/use-ref zoom)
|
||||||
transform-ref (mf/use-ref nil)
|
transform-ref (mf/use-ref nil)
|
||||||
|
selected-ref (mf/use-ref selected)
|
||||||
|
|
||||||
query-point
|
query-point
|
||||||
(mf/use-callback
|
(mf/use-callback
|
||||||
|
@ -127,11 +127,16 @@
|
||||||
(mf/deps zoom)
|
(mf/deps zoom)
|
||||||
#(mf/set-ref-val! zoom-ref zoom))
|
#(mf/set-ref-val! zoom-ref zoom))
|
||||||
|
|
||||||
|
(mf/use-effect
|
||||||
|
(mf/deps selected)
|
||||||
|
#(mf/set-ref-val! selected-ref selected))
|
||||||
|
|
||||||
(hooks/use-stream
|
(hooks/use-stream
|
||||||
over-shapes-stream
|
over-shapes-stream
|
||||||
(mf/deps page-id objects selected @ctrl?)
|
(mf/deps page-id objects @ctrl?)
|
||||||
(fn [ids]
|
(fn [ids]
|
||||||
(let [remove-id? (into #{} (mapcat #(cp/get-parents % objects)) selected)
|
(let [selected (mf/ref-val selected-ref)
|
||||||
|
remove-id? (into #{} (mapcat #(cp/get-parents % objects)) selected)
|
||||||
remove-id? (if @ctrl?
|
remove-id? (if @ctrl?
|
||||||
(d/concat remove-id?
|
(d/concat remove-id?
|
||||||
(->> ids
|
(->> ids
|
||||||
|
|
|
@ -62,7 +62,7 @@
|
||||||
[path on-error]
|
[path on-error]
|
||||||
(let [instance (js/Worker. path)
|
(let [instance (js/Worker. path)
|
||||||
bus (rx/subject)
|
bus (rx/subject)
|
||||||
worker (Worker. instance bus)
|
worker (Worker. instance (rx/to-observable bus))
|
||||||
|
|
||||||
handle-message
|
handle-message
|
||||||
(fn [event]
|
(fn [event]
|
||||||
|
|
Loading…
Reference in a new issue