mirror of
https://github.com/penpot/penpot.git
synced 2025-01-23 23:18:48 -05:00
Merge remote-tracking branch 'origin/staging' into develop
This commit is contained in:
commit
8f51450f7e
4 changed files with 20 additions and 12 deletions
|
@ -76,8 +76,7 @@
|
|||
shape (-> (geom/transform-shape shape)
|
||||
(geom/translate-to-frame frame))
|
||||
opts #js {:shape shape
|
||||
:frame frame
|
||||
:pointer-events (when (:blocked shape) "none")}
|
||||
:frame frame}
|
||||
|
||||
svg-element? (and (= (:type shape) :svg-raw)
|
||||
(not= :svg (get-in shape [:content :tag])))]
|
||||
|
|
|
@ -92,7 +92,7 @@
|
|||
(and (some? drawing-obj) (= :path (:type drawing-obj))))
|
||||
text-editing? (and edition (= :text (get-in objects [edition :type])))
|
||||
|
||||
on-click (actions/on-click hover selected edition drawing-path?)
|
||||
on-click (actions/on-click hover selected edition drawing-path? drawing-tool)
|
||||
on-context-menu (actions/on-context-menu hover)
|
||||
on-double-click (actions/on-double-click hover hover-ids drawing-path? objects)
|
||||
on-drag-enter (actions/on-drag-enter)
|
||||
|
@ -117,7 +117,7 @@
|
|||
show-draw-area? drawing-obj
|
||||
show-gradient-handlers? (= (count selected) 1)
|
||||
show-grids? (contains? layout :display-grid)
|
||||
show-outlines? (and (nil? transform) (not edition) (not drawing-obj))
|
||||
show-outlines? (and (nil? transform) (not edition) (not drawing-obj) (not (#{:comments :path} drawing-tool)))
|
||||
show-pixel-grid? (>= zoom 8)
|
||||
show-presence? page-id
|
||||
show-prototypes? (= options-mode :prototype)
|
||||
|
|
|
@ -34,7 +34,8 @@
|
|||
(mf/use-callback
|
||||
(mf/deps id blocked hidden type drawing-tool text-editing? edition edit-path selected)
|
||||
(fn [bevent]
|
||||
(when (dom/class? (dom/get-target bevent) "viewport-controls")
|
||||
(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)
|
||||
|
@ -58,9 +59,9 @@
|
|||
(when (and (not= edition id) text-editing?)
|
||||
(st/emit! dw/clear-edition-mode))
|
||||
|
||||
(when (and (or (not edition) (not= edition id)) (not blocked) (not hidden))
|
||||
(when (and (or (not edition) (not= edition id)) (not blocked) (not hidden) (not (#{:comments :path} drawing-tool)))
|
||||
(cond
|
||||
(and drawing-tool (not (#{:comments :path} drawing-tool)))
|
||||
drawing-tool
|
||||
(st/emit! (dd/start-drawing drawing-tool))
|
||||
|
||||
(and edit-path (contains? edit-path edition))
|
||||
|
@ -119,11 +120,12 @@
|
|||
(reset! frame-hover nil))))
|
||||
|
||||
(defn on-click
|
||||
[hover selected edition drawing-path?]
|
||||
[hover selected edition drawing-path? drawing-tool]
|
||||
(mf/use-callback
|
||||
(mf/deps @hover selected edition drawing-path?)
|
||||
(mf/deps @hover selected edition drawing-path? drawing-tool)
|
||||
(fn [event]
|
||||
(when (dom/class? (dom/get-target event) "viewport-controls")
|
||||
(when (or (dom/class? (dom/get-target event) "viewport-controls")
|
||||
(dom/class? (dom/get-target event) "viewport-selrect"))
|
||||
(let [ctrl? (kbd/ctrl? event)
|
||||
shift? (kbd/shift? event)
|
||||
alt? (kbd/alt? event)
|
||||
|
@ -133,7 +135,13 @@
|
|||
selected? (contains? selected (:id @hover))]
|
||||
(st/emit! (ms/->MouseEvent :click ctrl? shift? alt?))
|
||||
|
||||
(when (and hovering? (not shift?) (not frame?) (not selected?) (not edition) (not drawing-path?))
|
||||
(when (and hovering?
|
||||
(not shift?)
|
||||
(not frame?)
|
||||
(not selected?)
|
||||
(not edition)
|
||||
(not drawing-path?)
|
||||
(not (#{:comments :path} drawing-tool)))
|
||||
(st/emit! (dw/select-shape (:id @hover)))))))))
|
||||
|
||||
(defn on-double-click
|
||||
|
|
|
@ -26,7 +26,8 @@
|
|||
[{:keys [shape zoom tool] :as props}]
|
||||
|
||||
[:g.draw-area
|
||||
[:& shapes/shape-wrapper {:shape shape}]
|
||||
[:g {:style {:pointer-events "none"}}
|
||||
[:& shapes/shape-wrapper {:shape shape}]]
|
||||
|
||||
(case tool
|
||||
:path [:& path-editor {:shape shape :zoom zoom}]
|
||||
|
|
Loading…
Add table
Reference in a new issue