daybrush / selecto

Selecto.js is a component that allows you to select elements in the drag area using the mouse or touch.
https://daybrush.com/selecto
MIT License
2.04k stars 82 forks source link

If container DIV has zoom value react-selcto not working as expected #94

Open jebaemanuel opened 2 years ago

jebaemanuel commented 2 years ago

Environments

Description

If container DIV has zoom value other than 100%, after dragged inside the container, the drag position showing wrong position.

using zoom and transform property in container DIV not working as expected. If I added transform instead of zoom, the drag position working fine. but UI elements not selected.

I shared the example - in render function. return

<div className="container" style={{zoom:"50%"}}>

    <Selecto 
        .....
    />

daybrush commented 2 years ago

@jebaemanuel

okay. I'll check it.

daybrush commented 2 years ago

@jebaemanuel

I checked and selecto calculates the position and size through getBoundingClientRect, but the zoom property interferes with this and brings an incorrect value.

How about using transform: scale(0.5) instead?

Set rootConainer={document.body} if selecto is in container with transform applied.

MuhammadFadhil10 commented 1 year ago

@jebaemanuel

I checked and selecto calculates the position and size through getBoundingClientRect, but the zoom property interferes with this and brings an incorrect value.

How about using transform: scale(0.5) instead?

Set rootConainer={document.body} if selecto is in container with transform applied.

solution yet?

wangchihai commented 9 months ago

solution yet?