0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-10 09:08:31 -05:00

🐛 Fixes problems with paths

This commit is contained in:
alonso.torres 2020-06-04 15:07:43 +02:00
parent d33e3de8f1
commit 1c6bdb5060
5 changed files with 14 additions and 8 deletions

View file

@ -959,8 +959,9 @@
ptk/UpdateEvent
(update [_ state]
(let [page-id (:current-page-id state)]
(update-in state [:workspace-data page-id :objects id :segments index]
gpt/add delta)))))
(-> state
(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)

View file

@ -131,8 +131,9 @@
(def handle-drawing-path
(letfn [(stoper-event? [{:keys [type shift] :as event}]
(or (= event :path/end-path-drawing)
(= event :interrupt)
(and (ms/mouse-event? event)
(or (and (= type :double-click) shift)
(or (= type :double-click)
(= type :context-menu)))
(and (ms/keyboard-event? event)
(= type :down)
@ -207,6 +208,7 @@
(rx/concat
(->> stream'
(rx/take-until stoper)
(rx/map (fn [[point ctrl? index :as xxx]]
(let [point (if ctrl?
(as-> point $
@ -214,8 +216,7 @@
(align-position (gpt/angle $) $)
(gpt/add $ @last-point))
point)]
#(update-point-segment % index point))))
(rx/take-until stoper))
#(update-point-segment % index point)))))
(rx/of finish-drawing-path
handle-finish-drawing))))))))

View file

@ -12,6 +12,7 @@
[uxbox.main.data.workspace.drawing :as dd]
[uxbox.main.store :as st]
[uxbox.main.ui.workspace.shapes :as shapes]
[uxbox.common.geom.shapes :as gsh]
[uxbox.util.dom :as dom]
[uxbox.util.i18n :as i18n :refer [t]]))
@ -27,7 +28,7 @@
(mf/defc generic-draw-area
[{: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)
[:g
[:& shapes/shape-wrapper {:shape shape}]

View file

@ -25,7 +25,8 @@
[uxbox.common.geom.shapes :as geom]
[uxbox.common.geom.point :as gpt]
[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)
@ -192,6 +193,7 @@
[:& selection-rect {:rect selrect
:transform transform
:zoom zoom}]
[:& outline {:shape (geom/transform-shape shape)}]
;; Handlers
(for [{:keys [type position props]} (handlers-for-selection selrect)]

View file

@ -18,6 +18,7 @@
[uxbox.main.ui.keyboard :as kbd]
[uxbox.main.ui.shapes.path :as path]
[uxbox.main.ui.workspace.shapes.common :as common]
[uxbox.main.data.workspace.drawing :as dr]
[uxbox.util.dom :as dom]
[uxbox.util.interop :as itr]
[uxbox.main.streams :as ms]
@ -37,7 +38,7 @@
on-double-click (mf/use-callback
(mf/deps shape)
(fn [event]
(when (hover? (:id shape))
(when (and (not (::dr/initialized? shape)) (hover? (:id shape)))
(do
(dom/stop-propagation event)
(dom/prevent-default event)