0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-12 18:18:24 -05:00

♻️ Removed unused code. Fixed problem with alt key

This commit is contained in:
alonso.torres 2021-01-26 21:27:24 +01:00
parent fb05999e9e
commit 897b3d3f39
4 changed files with 6 additions and 18 deletions

View file

@ -36,11 +36,8 @@
(when verify?
(us/verify ::spec/changes items))
(reduce #(do
#_(prn "process-change" (:type %2) (:id %2))
(or (process-change %1 %2) %1))
data
items)))
(->> items
(reduce #(or (process-change %1 %2) %1) data))))
(defmethod process-change :set-option
[data {:keys [page-id option value]}]

View file

@ -66,8 +66,6 @@
opts #js {:shape shape
:frame frame}
alt? (hooks/use-rxsub ms/keyboard-alt)
moving-iref (mf/use-memo (mf/deps (:id shape)) (make-is-moving-ref (:id shape)))
moving? (mf/deref moving-iref)
svg-element? (and (= (:type shape) :svg-raw)
@ -77,8 +75,7 @@
(when (and shape (not (:hidden shape)))
[:*
(if-not svg-element?
[:g.shape-wrapper {:style {:display (when hide-moving? "none")
:cursor (if alt? cur/duplicate nil)}}
[:g.shape-wrapper {:style {:display (when hide-moving? "none")}}
(case (:type shape)
:path [:> path/path-wrapper opts]
:text [:> text/text-wrapper opts]

View file

@ -153,15 +153,8 @@
result))]
(reduce extract-attrs [] shapes)))
;; TODO: Remove when added to rumext
(defn check-props
([props] (check-props props =))
([props eqfn?]
(fn [np op]
(every? #(eqfn? (unchecked-get np %) (unchecked-get op %)) props))))
(mf/defc options
{::mf/wrap [#(mf/memo' % (check-props ["shape" "shapes-with-children"]))]
{::mf/wrap [#(mf/memo' % (mf/check-props ["shape" "shapes-with-children"]))]
::mf/wrap-props false}
[props]
(let [shapes (unchecked-get props "shapes")

View file

@ -602,7 +602,7 @@
;; This change is in an effect to minimize the sideffects of the cursor chaning
;; Changing a cursor will produce a "reflow" so we defer it until the component is rendered
(mf/use-layout-effect
(mf/deps @cursor panning drawing-tool drawing-path?)
(mf/deps @cursor @alt? panning drawing-tool drawing-path?)
(fn []
(let [new-cursor
(cond
@ -614,6 +614,7 @@
(or (= drawing-tool :path) drawing-path?) cur/pen
(= drawing-tool :curve) cur/pencil
drawing-tool cur/create-shape
@alt? cur/duplicate
:else cur/pointer-inner)]
(when (not= @cursor new-cursor)