mirror of
https://github.com/penpot/penpot.git
synced 2025-02-14 19:19:09 -05:00
♻️ Removed unused code. Fixed problem with alt key
This commit is contained in:
parent
fb05999e9e
commit
897b3d3f39
4 changed files with 6 additions and 18 deletions
|
@ -36,11 +36,8 @@
|
||||||
(when verify?
|
(when verify?
|
||||||
(us/verify ::spec/changes items))
|
(us/verify ::spec/changes items))
|
||||||
|
|
||||||
(reduce #(do
|
(->> items
|
||||||
#_(prn "process-change" (:type %2) (:id %2))
|
(reduce #(or (process-change %1 %2) %1) data))))
|
||||||
(or (process-change %1 %2) %1))
|
|
||||||
data
|
|
||||||
items)))
|
|
||||||
|
|
||||||
(defmethod process-change :set-option
|
(defmethod process-change :set-option
|
||||||
[data {:keys [page-id option value]}]
|
[data {:keys [page-id option value]}]
|
||||||
|
|
|
@ -66,8 +66,6 @@
|
||||||
opts #js {:shape shape
|
opts #js {:shape shape
|
||||||
:frame frame}
|
: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-iref (mf/use-memo (mf/deps (:id shape)) (make-is-moving-ref (:id shape)))
|
||||||
moving? (mf/deref moving-iref)
|
moving? (mf/deref moving-iref)
|
||||||
svg-element? (and (= (:type shape) :svg-raw)
|
svg-element? (and (= (:type shape) :svg-raw)
|
||||||
|
@ -77,8 +75,7 @@
|
||||||
(when (and shape (not (:hidden shape)))
|
(when (and shape (not (:hidden shape)))
|
||||||
[:*
|
[:*
|
||||||
(if-not svg-element?
|
(if-not svg-element?
|
||||||
[:g.shape-wrapper {:style {:display (when hide-moving? "none")
|
[:g.shape-wrapper {:style {:display (when hide-moving? "none")}}
|
||||||
:cursor (if alt? cur/duplicate nil)}}
|
|
||||||
(case (:type shape)
|
(case (:type shape)
|
||||||
:path [:> path/path-wrapper opts]
|
:path [:> path/path-wrapper opts]
|
||||||
:text [:> text/text-wrapper opts]
|
:text [:> text/text-wrapper opts]
|
||||||
|
|
|
@ -153,15 +153,8 @@
|
||||||
result))]
|
result))]
|
||||||
(reduce extract-attrs [] shapes)))
|
(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/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}
|
::mf/wrap-props false}
|
||||||
[props]
|
[props]
|
||||||
(let [shapes (unchecked-get props "shapes")
|
(let [shapes (unchecked-get props "shapes")
|
||||||
|
|
|
@ -602,7 +602,7 @@
|
||||||
;; This change is in an effect to minimize the sideffects of the cursor chaning
|
;; 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
|
;; Changing a cursor will produce a "reflow" so we defer it until the component is rendered
|
||||||
(mf/use-layout-effect
|
(mf/use-layout-effect
|
||||||
(mf/deps @cursor panning drawing-tool drawing-path?)
|
(mf/deps @cursor @alt? panning drawing-tool drawing-path?)
|
||||||
(fn []
|
(fn []
|
||||||
(let [new-cursor
|
(let [new-cursor
|
||||||
(cond
|
(cond
|
||||||
|
@ -614,6 +614,7 @@
|
||||||
(or (= drawing-tool :path) drawing-path?) cur/pen
|
(or (= drawing-tool :path) drawing-path?) cur/pen
|
||||||
(= drawing-tool :curve) cur/pencil
|
(= drawing-tool :curve) cur/pencil
|
||||||
drawing-tool cur/create-shape
|
drawing-tool cur/create-shape
|
||||||
|
@alt? cur/duplicate
|
||||||
:else cur/pointer-inner)]
|
:else cur/pointer-inner)]
|
||||||
|
|
||||||
(when (not= @cursor new-cursor)
|
(when (not= @cursor new-cursor)
|
||||||
|
|
Loading…
Add table
Reference in a new issue