fix: avoid passive wheel preventDefault warnings in canvas
This commit is contained in:
parent
056514f167
commit
1cf7f2c1f1
@ -85,7 +85,9 @@ export function CanvasWorkspace() {
|
||||
if (!container) return;
|
||||
|
||||
const preventTrackpadHistorySwipe = (event: WheelEvent) => {
|
||||
event.preventDefault();
|
||||
if (event.cancelable) {
|
||||
event.preventDefault();
|
||||
}
|
||||
};
|
||||
|
||||
container.addEventListener("wheel", preventTrackpadHistorySwipe, { passive: false });
|
||||
@ -312,7 +314,9 @@ export function CanvasWorkspace() {
|
||||
// 处理滚轮缩放
|
||||
const handleWheel = useCallback((e: React.WheelEvent) => {
|
||||
if (!isEventFromCanvasContainer(e.target)) return;
|
||||
e.preventDefault();
|
||||
if (e.cancelable) {
|
||||
e.preventDefault();
|
||||
}
|
||||
e.stopPropagation();
|
||||
|
||||
// mac: 双指滚动默认平移,Cmd/Ctrl+滚轮才缩放(保留触控板体验)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user