moveable icon indicating copy to clipboard operation
moveable copied to clipboard

can I scale the Moveable blue controls and lines dynamically ?

Open gabimor opened this issue 2 years ago • 3 comments

Environments

  • Framework name: react-moveable (React 18.2)
  • Framework version: 0.54.1
  • Moveable Component version: 0.54.1
  • Testable Address(optional):

Description

Is there a way to set the value of the translate: scale() for the moveable-control and moveable-line elements ? My canvas where I use my moveables is scalable and I want the blue controls and lines to be visible even when zoomed out so my solution is to scale them (i'm using react). is there an Moveable API to affect the their transform css property ? I've notice this happens on the moveable demo (using the InfiniteViewer) when you zoom in and out there the transform property for each moveable-control/line changes, but I can't find how to do that with in React (I can do it using document.querySelectorAll) but am looking for a more elegant way :)

gabimor avatar Sep 16 '23 21:09 gabimor

Try the property zoom ? <Moveable zoom={zoom}/>

HZZformGD avatar Sep 18 '23 06:09 HZZformGD

As @HZZformGD said, use zoom prop or css

.moveable-control {
width: 14px;
height: 14px;
border-radius: 50%;
border: 2px solid #fff;
box-sizing: border-box;
background: #4af;
background: var(--moveable-color);
margin-top: -7px;
margin-left: -7px;
border: 2px solid #fff;
z-index: 10;
}

daybrush avatar Sep 19 '23 15:09 daybrush

Thank you @daybrush but I am aiming at scaling only the blue selection rectangle and control circles, without scaling the actual element will this do the trick ?

gabimor avatar Sep 26 '23 17:09 gabimor