mirror of
https://github.com/penpot/penpot.git
synced 2025-02-14 11:09:04 -05:00
🐛 Fixes problems with paths
This commit is contained in:
parent
d33e3de8f1
commit
1c6bdb5060
5 changed files with 14 additions and 8 deletions
|
@ -959,8 +959,9 @@
|
||||||
ptk/UpdateEvent
|
ptk/UpdateEvent
|
||||||
(update [_ state]
|
(update [_ state]
|
||||||
(let [page-id (:current-page-id state)]
|
(let [page-id (:current-page-id state)]
|
||||||
(update-in state [:workspace-data page-id :objects id :segments index]
|
(-> state
|
||||||
gpt/add delta)))))
|
(update-in [:workspace-data page-id :objects id :segments index] gpt/add delta)
|
||||||
|
(update-in [:workspace-data page-id :objects id] geom/update-path-selrect))))))
|
||||||
|
|
||||||
;; --- Shape attrs (Layers Sidebar)
|
;; --- Shape attrs (Layers Sidebar)
|
||||||
|
|
||||||
|
|
|
@ -131,8 +131,9 @@
|
||||||
(def handle-drawing-path
|
(def handle-drawing-path
|
||||||
(letfn [(stoper-event? [{:keys [type shift] :as event}]
|
(letfn [(stoper-event? [{:keys [type shift] :as event}]
|
||||||
(or (= event :path/end-path-drawing)
|
(or (= event :path/end-path-drawing)
|
||||||
|
(= event :interrupt)
|
||||||
(and (ms/mouse-event? event)
|
(and (ms/mouse-event? event)
|
||||||
(or (and (= type :double-click) shift)
|
(or (= type :double-click)
|
||||||
(= type :context-menu)))
|
(= type :context-menu)))
|
||||||
(and (ms/keyboard-event? event)
|
(and (ms/keyboard-event? event)
|
||||||
(= type :down)
|
(= type :down)
|
||||||
|
@ -207,6 +208,7 @@
|
||||||
|
|
||||||
(rx/concat
|
(rx/concat
|
||||||
(->> stream'
|
(->> stream'
|
||||||
|
(rx/take-until stoper)
|
||||||
(rx/map (fn [[point ctrl? index :as xxx]]
|
(rx/map (fn [[point ctrl? index :as xxx]]
|
||||||
(let [point (if ctrl?
|
(let [point (if ctrl?
|
||||||
(as-> point $
|
(as-> point $
|
||||||
|
@ -214,8 +216,7 @@
|
||||||
(align-position (gpt/angle $) $)
|
(align-position (gpt/angle $) $)
|
||||||
(gpt/add $ @last-point))
|
(gpt/add $ @last-point))
|
||||||
point)]
|
point)]
|
||||||
#(update-point-segment % index point))))
|
#(update-point-segment % index point)))))
|
||||||
(rx/take-until stoper))
|
|
||||||
(rx/of finish-drawing-path
|
(rx/of finish-drawing-path
|
||||||
handle-finish-drawing))))))))
|
handle-finish-drawing))))))))
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
[uxbox.main.data.workspace.drawing :as dd]
|
[uxbox.main.data.workspace.drawing :as dd]
|
||||||
[uxbox.main.store :as st]
|
[uxbox.main.store :as st]
|
||||||
[uxbox.main.ui.workspace.shapes :as shapes]
|
[uxbox.main.ui.workspace.shapes :as shapes]
|
||||||
|
[uxbox.common.geom.shapes :as gsh]
|
||||||
[uxbox.util.dom :as dom]
|
[uxbox.util.dom :as dom]
|
||||||
[uxbox.util.i18n :as i18n :refer [t]]))
|
[uxbox.util.i18n :as i18n :refer [t]]))
|
||||||
|
|
||||||
|
@ -27,7 +28,7 @@
|
||||||
|
|
||||||
(mf/defc generic-draw-area
|
(mf/defc generic-draw-area
|
||||||
[{:keys [shape zoom]}]
|
[{:keys [shape zoom]}]
|
||||||
(let [{:keys [x y width height]} (:selrect shape)]
|
(let [{:keys [x y width height]} (:selrect (gsh/transform-shape shape))]
|
||||||
(when (and x y)
|
(when (and x y)
|
||||||
[:g
|
[:g
|
||||||
[:& shapes/shape-wrapper {:shape shape}]
|
[:& shapes/shape-wrapper {:shape shape}]
|
||||||
|
|
|
@ -25,7 +25,8 @@
|
||||||
[uxbox.common.geom.shapes :as geom]
|
[uxbox.common.geom.shapes :as geom]
|
||||||
[uxbox.common.geom.point :as gpt]
|
[uxbox.common.geom.point :as gpt]
|
||||||
[uxbox.common.geom.matrix :as gmt]
|
[uxbox.common.geom.matrix :as gmt]
|
||||||
[uxbox.util.debug :refer [debug?]]))
|
[uxbox.util.debug :refer [debug?]]
|
||||||
|
[uxbox.main.ui.workspace.shapes.outline :refer [outline]]))
|
||||||
|
|
||||||
|
|
||||||
(def rotation-handler-size 25)
|
(def rotation-handler-size 25)
|
||||||
|
@ -192,6 +193,7 @@
|
||||||
[:& selection-rect {:rect selrect
|
[:& selection-rect {:rect selrect
|
||||||
:transform transform
|
:transform transform
|
||||||
:zoom zoom}]
|
:zoom zoom}]
|
||||||
|
[:& outline {:shape (geom/transform-shape shape)}]
|
||||||
|
|
||||||
;; Handlers
|
;; Handlers
|
||||||
(for [{:keys [type position props]} (handlers-for-selection selrect)]
|
(for [{:keys [type position props]} (handlers-for-selection selrect)]
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
[uxbox.main.ui.keyboard :as kbd]
|
[uxbox.main.ui.keyboard :as kbd]
|
||||||
[uxbox.main.ui.shapes.path :as path]
|
[uxbox.main.ui.shapes.path :as path]
|
||||||
[uxbox.main.ui.workspace.shapes.common :as common]
|
[uxbox.main.ui.workspace.shapes.common :as common]
|
||||||
|
[uxbox.main.data.workspace.drawing :as dr]
|
||||||
[uxbox.util.dom :as dom]
|
[uxbox.util.dom :as dom]
|
||||||
[uxbox.util.interop :as itr]
|
[uxbox.util.interop :as itr]
|
||||||
[uxbox.main.streams :as ms]
|
[uxbox.main.streams :as ms]
|
||||||
|
@ -37,7 +38,7 @@
|
||||||
on-double-click (mf/use-callback
|
on-double-click (mf/use-callback
|
||||||
(mf/deps shape)
|
(mf/deps shape)
|
||||||
(fn [event]
|
(fn [event]
|
||||||
(when (hover? (:id shape))
|
(when (and (not (::dr/initialized? shape)) (hover? (:id shape)))
|
||||||
(do
|
(do
|
||||||
(dom/stop-propagation event)
|
(dom/stop-propagation event)
|
||||||
(dom/prevent-default event)
|
(dom/prevent-default event)
|
||||||
|
|
Loading…
Add table
Reference in a new issue