Skip to content

Commit 73be609

Browse files
authored
Fix tileset scrollbar area changing selection (#8324)
Fix #8316
1 parent de80d0b commit 73be609

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

newIDE/app/src/InstancesEditor/TileSetVisualizer.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,19 @@ const getImageCoordinatesFromPointerEvent = (
136136
}
137137

138138
const bounds = divContainer.getBoundingClientRect();
139+
140+
// Ignore pointer events on the scrollbar area. getBoundingClientRect includes
141+
// scrollbars, but clientWidth/clientHeight exclude them, so any click beyond
142+
// clientWidth or clientHeight is on a scrollbar, not on the tile content.
143+
const relativeX = event.clientX - bounds.left;
144+
const relativeY = event.clientY - bounds.top;
145+
if (
146+
relativeX >= divContainer.clientWidth ||
147+
relativeY >= divContainer.clientHeight
148+
) {
149+
return;
150+
}
151+
139152
const mouseXWithoutScrollLeft = event.clientX - bounds.left + 1;
140153
const mouseX = mouseXWithoutScrollLeft + divContainer.scrollLeft;
141154
const mouseY = event.clientY - bounds.top + 1;

0 commit comments

Comments
 (0)