mirror of
https://github.com/penpot/penpot.git
synced 2025-01-23 23:18:48 -05:00
Merge pull request #2893 from penpot/palba-fix-can-move-shape-with-lens-zoom
🐛 Fix can move shape with lens zoom active
This commit is contained in:
commit
dc4aabe263
3 changed files with 48 additions and 46 deletions
|
@ -9,6 +9,7 @@
|
|||
- Fix button spacing on delete acount modal [Taiga #4762](https://tree.taiga.io/project/penpot/issue/4762)
|
||||
- Fix invitations input on team management and onboarding modal [Taiga #4760](https://tree.taiga.io/project/penpot/issue/4760)
|
||||
- Fix weird numeration creating new elements in dashboard [Taiga #4755](https://tree.taiga.io/project/penpot/issue/4755)
|
||||
- Fix can move shape with lens zoom active [Taiga #4787](https://tree.taiga.io/project/penpot/issue/4787)
|
||||
|
||||
## 1.17.0
|
||||
|
||||
|
|
|
@ -162,14 +162,14 @@
|
|||
on-drag-over (actions/on-drag-over)
|
||||
on-drop (actions/on-drop file)
|
||||
on-mouse-down (actions/on-mouse-down @hover selected edition drawing-tool text-editing? node-editing?
|
||||
drawing-path? create-comment? space? panning workspace-read-only?)
|
||||
drawing-path? create-comment? space? panning z? workspace-read-only?)
|
||||
on-mouse-up (actions/on-mouse-up disable-paste)
|
||||
on-pointer-down (actions/on-pointer-down)
|
||||
on-pointer-enter (actions/on-pointer-enter in-viewport?)
|
||||
on-pointer-leave (actions/on-pointer-leave in-viewport?)
|
||||
on-pointer-move (actions/on-pointer-move move-stream)
|
||||
on-pointer-up (actions/on-pointer-up)
|
||||
on-move-selected (actions/on-move-selected hover hover-ids selected space? workspace-read-only?)
|
||||
on-move-selected (actions/on-move-selected hover hover-ids selected space? z? workspace-read-only?)
|
||||
on-menu-selected (actions/on-menu-selected hover hover-ids selected workspace-read-only?)
|
||||
|
||||
on-frame-enter (actions/on-frame-enter frame-hover)
|
||||
|
|
|
@ -34,70 +34,71 @@
|
|||
|
||||
(defn on-mouse-down
|
||||
[{:keys [id blocked hidden type]} selected edition drawing-tool text-editing?
|
||||
node-editing? drawing-path? create-comment? space? panning workspace-read-only?]
|
||||
node-editing? drawing-path? create-comment? space? panning z? workspace-read-only?]
|
||||
(mf/use-callback
|
||||
(mf/deps id blocked hidden type selected edition drawing-tool text-editing?
|
||||
node-editing? drawing-path? create-comment? @space?
|
||||
node-editing? drawing-path? create-comment? @z? @space?
|
||||
panning workspace-read-only?)
|
||||
(fn [bevent]
|
||||
(when (or (dom/class? (dom/get-target bevent) "viewport-controls")
|
||||
(dom/class? (dom/get-target bevent) "viewport-selrect"))
|
||||
(dom/stop-propagation bevent)
|
||||
|
||||
(let [event (.-nativeEvent bevent)
|
||||
ctrl? (kbd/ctrl? event)
|
||||
meta? (kbd/meta? event)
|
||||
shift? (kbd/shift? event)
|
||||
alt? (kbd/alt? event)
|
||||
mod? (kbd/mod? event)
|
||||
(when-not @z?
|
||||
(let [event (.-nativeEvent bevent)
|
||||
ctrl? (kbd/ctrl? event)
|
||||
meta? (kbd/meta? event)
|
||||
shift? (kbd/shift? event)
|
||||
alt? (kbd/alt? event)
|
||||
mod? (kbd/mod? event)
|
||||
|
||||
left-click? (and (not panning) (= 1 (.-which event)))
|
||||
middle-click? (and (not panning) (= 2 (.-which event)))]
|
||||
left-click? (and (not panning) (= 1 (.-which event)))
|
||||
middle-click? (and (not panning) (= 2 (.-which event)))]
|
||||
|
||||
(cond
|
||||
(or middle-click? (and left-click? @space?))
|
||||
(do
|
||||
(dom/prevent-default bevent)
|
||||
(if mod?
|
||||
(let [raw-pt (dom/get-client-position event)
|
||||
pt (uwvv/point->viewport raw-pt)]
|
||||
(st/emit! (dw/start-zooming pt)))
|
||||
(st/emit! (dw/start-panning))))
|
||||
(cond
|
||||
(or middle-click? (and left-click? @space?))
|
||||
(do
|
||||
(dom/prevent-default bevent)
|
||||
(if mod?
|
||||
(let [raw-pt (dom/get-client-position event)
|
||||
pt (uwvv/point->viewport raw-pt)]
|
||||
(st/emit! (dw/start-zooming pt)))
|
||||
(st/emit! (dw/start-panning))))
|
||||
|
||||
|
||||
left-click?
|
||||
(do
|
||||
(st/emit! (ms/->MouseEvent :down ctrl? shift? alt? meta?))
|
||||
left-click?
|
||||
(do
|
||||
(st/emit! (ms/->MouseEvent :down ctrl? shift? alt? meta?))
|
||||
|
||||
(when (and (not= edition id) text-editing?)
|
||||
(st/emit! dw/clear-edition-mode))
|
||||
(when (and (not= edition id) text-editing?)
|
||||
(st/emit! dw/clear-edition-mode))
|
||||
|
||||
(when (and (not text-editing?)
|
||||
(not blocked)
|
||||
(not hidden)
|
||||
(not create-comment?)
|
||||
(not drawing-path?))
|
||||
(cond
|
||||
node-editing?
|
||||
(when (and (not text-editing?)
|
||||
(not blocked)
|
||||
(not hidden)
|
||||
(not create-comment?)
|
||||
(not drawing-path?))
|
||||
(cond
|
||||
node-editing?
|
||||
;; Handle path node area selection
|
||||
(when-not workspace-read-only?
|
||||
(st/emit! (dwdp/handle-area-selection shift?)))
|
||||
(when-not workspace-read-only?
|
||||
(st/emit! (dwdp/handle-area-selection shift?)))
|
||||
|
||||
drawing-tool
|
||||
(when-not workspace-read-only?
|
||||
(st/emit! (dd/start-drawing drawing-tool)))
|
||||
drawing-tool
|
||||
(when-not workspace-read-only?
|
||||
(st/emit! (dd/start-drawing drawing-tool)))
|
||||
|
||||
(or (not id) mod?)
|
||||
(st/emit! (dw/handle-area-selection shift? mod?))
|
||||
(or (not id) mod?)
|
||||
(st/emit! (dw/handle-area-selection shift? mod?))
|
||||
|
||||
(not drawing-tool)
|
||||
(when-not workspace-read-only?
|
||||
(st/emit! (dw/start-move-selected id shift?))))))))))))
|
||||
(not drawing-tool)
|
||||
(when-not workspace-read-only?
|
||||
(st/emit! (dw/start-move-selected id shift?)))))))))))))
|
||||
|
||||
(defn on-move-selected
|
||||
[hover hover-ids selected space? workspace-read-only?]
|
||||
[hover hover-ids selected space? z? workspace-read-only?]
|
||||
(mf/use-callback
|
||||
(mf/deps @hover @hover-ids selected @space? workspace-read-only?)
|
||||
(mf/deps @hover @hover-ids selected @space? @z? workspace-read-only?)
|
||||
(fn [bevent]
|
||||
(let [event (.-nativeEvent bevent)
|
||||
shift? (kbd/shift? event)
|
||||
|
@ -110,7 +111,7 @@
|
|||
(not @space?))
|
||||
(dom/prevent-default bevent)
|
||||
(dom/stop-propagation bevent)
|
||||
(when-not workspace-read-only?
|
||||
(when-not (or workspace-read-only? @z?)
|
||||
(st/emit! (dw/start-move-selected))))))))
|
||||
|
||||
(defn on-frame-select
|
||||
|
|
Loading…
Add table
Reference in a new issue