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

will-change: transform 导致选择框位置错误 #78

Open fanterxissss opened 2 years ago

fanterxissss commented 2 years ago

@daybrush container包含的元素,不能使用css : will-change: transform; 加了这个css属性就会选择框位置translate计算错误。 # #

daybrush commented 2 years ago

@fanterxissss

Use rootContainer option for no transformed parent container. (ex: document.body)

fanterxissss commented 2 years ago

rootContainer 不能解决这个问题,直到我删除了这个css属性,才得以解决,

daybrush commented 2 years ago

@fanterxissss

https://codesandbox.io/s/vigorous-kare-dh09jo?file=/src/index.ts

I feel like this, is there any difference with your code?

If so, can you show me your html structure? And what is the container to which the transform is applied and the container set as the rootContainer?

meibin08 commented 2 years ago

@daybrush container包含的元素,不能使用css : will-change: transform; 加了这个css属性就会选择框位置translate计算错误。 # #

检查一下,你的container 是否有包含transform-style: preserve-3d,或transform相关的属性,demo就是有 transform-style 才有问题的

hqiaozhang commented 11 months ago

请问你最后问题解决了吗?我的父容器加了transform: scale,框选时位置就计算错误了