mirror of
https://github.com/penpot/penpot.git
synced 2025-06-05 05:11:39 +02:00
Add move cursor when shape is displaced on viewport.
This commit is contained in:
parent
4dc728378c
commit
99f935863a
9 changed files with 50 additions and 18 deletions
|
@ -16,6 +16,7 @@
|
|||
[uxbox.main.ui.shapes.common :as common]
|
||||
[uxbox.main.ui.shapes.attrs :as attrs]
|
||||
[uxbox.util.color :as color]
|
||||
[uxbox.util.data :refer [classnames]]
|
||||
[uxbox.util.dom :as dom]
|
||||
[uxbox.util.geom.matrix :as gmt]
|
||||
[uxbox.util.mixins :as mx :include-macros true])
|
||||
|
@ -166,8 +167,10 @@
|
|||
|
||||
{:keys [x1 y1 width height] :as shape} (-> (geom/transform shape xfmt)
|
||||
(geom/size))
|
||||
moving? (boolean displacement)
|
||||
props {:x x1
|
||||
:y y1
|
||||
:class (classnames :move-cursor moving?)
|
||||
:id (str id)
|
||||
:ref "fobject"
|
||||
:width width
|
||||
|
@ -187,16 +190,19 @@
|
|||
{:mixins [mx/static]
|
||||
:did-mount text-shape-wrapper-did-mount
|
||||
:did-remount text-shape-wrapper-did-remount}
|
||||
[{:keys [id content tmp-resize-xform tmp-displacement] :as shape}]
|
||||
(let [xfmt (cond-> (gmt/matrix)
|
||||
tmp-displacement (gmt/translate tmp-displacement)
|
||||
tmp-resize-xform (gmt/multiply tmp-resize-xform))
|
||||
[{:keys [id content modifiers] :as shape}]
|
||||
(let [{:keys [displacement resize]} modifiers
|
||||
xfmt (cond-> (gmt/matrix)
|
||||
displacement (gmt/multiply displacement)
|
||||
resize (gmt/multiply resize))
|
||||
|
||||
{:keys [x1 y1 width height] :as shape} (-> (geom/transform shape xfmt)
|
||||
(geom/size))
|
||||
moving? (boolean displacement)
|
||||
style (make-style shape)]
|
||||
[:foreignObject {:x x1
|
||||
:y y1
|
||||
:class (classnames :move-cursor moving?)
|
||||
:id (str id)
|
||||
:ref "fobject"
|
||||
:width width
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue