mirror of
https://github.com/penpot/penpot.git
synced 2025-01-09 16:30:37 -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)
|
||||
selrect (get-in state [:workspace-local :selrect])
|
||||
blocked? (fn [id] (get-in objects [id :blocked] false))]
|
||||
(rx/merge
|
||||
|
||||
(when selrect
|
||||
(->> (uw/ask! {:cmd :selection/query
|
||||
:page-id page-id
|
||||
:rect selrect
|
||||
:include-frames? true
|
||||
:full-frame? true})
|
||||
(rx/map #(cp/clean-loops objects %))
|
||||
(rx/map #(into initial-set (filter (comp not blocked?)) %))
|
||||
(rx/map select-shapes))))))))
|
||||
(when selrect
|
||||
(->> (uw/ask! {:cmd :selection/query
|
||||
:page-id page-id
|
||||
:rect selrect
|
||||
:include-frames? true
|
||||
:full-frame? true})
|
||||
(rx/map #(cp/clean-loops objects %))
|
||||
(rx/map #(into initial-set (filter (comp not blocked?)) %))
|
||||
(rx/map select-shapes)))))))
|
||||
|
||||
(defn select-inside-group
|
||||
[group-id position]
|
||||
|
|
|
@ -153,7 +153,7 @@
|
|||
(hooks/setup-cursor cursor alt? panning drawing-tool drawing-path? node-editing?)
|
||||
(hooks/setup-resize layout viewport-ref)
|
||||
(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-shortcuts node-editing? drawing-path?)
|
||||
(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-space #(reset! space? %)))
|
||||
|
||||
;; TODO: revisit the arguments, looks like `selected` is not necessary here
|
||||
(defn setup-hover-shapes [page-id move-stream _selected objects transform selected ctrl? hover hover-ids zoom]
|
||||
(defn setup-hover-shapes [page-id move-stream objects transform selected ctrl? hover hover-ids zoom]
|
||||
(let [;; We use ref so we don't recreate the stream on a change
|
||||
zoom-ref (mf/use-ref zoom)
|
||||
transform-ref (mf/use-ref nil)
|
||||
selected-ref (mf/use-ref selected)
|
||||
|
||||
query-point
|
||||
(mf/use-callback
|
||||
|
@ -127,11 +127,16 @@
|
|||
(mf/deps zoom)
|
||||
#(mf/set-ref-val! zoom-ref zoom))
|
||||
|
||||
(mf/use-effect
|
||||
(mf/deps selected)
|
||||
#(mf/set-ref-val! selected-ref selected))
|
||||
|
||||
(hooks/use-stream
|
||||
over-shapes-stream
|
||||
(mf/deps page-id objects selected @ctrl?)
|
||||
(mf/deps page-id objects @ctrl?)
|
||||
(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?
|
||||
(d/concat remove-id?
|
||||
(->> ids
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
[path on-error]
|
||||
(let [instance (js/Worker. path)
|
||||
bus (rx/subject)
|
||||
worker (Worker. instance bus)
|
||||
worker (Worker. instance (rx/to-observable bus))
|
||||
|
||||
handle-message
|
||||
(fn [event]
|
||||
|
|
Loading…
Reference in a new issue