Skip to content

Commit 12ddbd1

Browse files
committed
fix off-by-0.5 in convex hull calculation
1 parent 1eb066c commit 12ddbd1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/RenderWebGL.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1807,12 +1807,12 @@ class RenderWebGL extends EventEmitter {
18071807
let rr = -1;
18081808
let Q;
18091809
for (let y = 0; y < height; y++) {
1810-
_pixelPos[1] = y / height;
1810+
_pixelPos[1] = (y + 0.5) / height;
18111811
// Scan from left to right, looking for a touchable spot in the
18121812
// skin.
18131813
let x = 0;
18141814
for (; x < width; x++) {
1815-
_pixelPos[0] = x / width;
1815+
_pixelPos[0] = (x + 0.5) / width;
18161816
EffectTransform.transformPoint(drawable, _pixelPos, _effectPos);
18171817
if (drawable.skin.isTouchingLinear(_effectPos)) {
18181818
Q = [x, y];
@@ -1842,7 +1842,7 @@ class RenderWebGL extends EventEmitter {
18421842
// Scan from right to left, looking for a touchable spot in the
18431843
// skin.
18441844
for (x = width - 1; x >= 0; x--) {
1845-
_pixelPos[0] = x / width;
1845+
_pixelPos[0] = (x + 0.5) / width;
18461846
EffectTransform.transformPoint(drawable, _pixelPos, _effectPos);
18471847
if (drawable.skin.isTouchingLinear(_effectPos)) {
18481848
Q = [x, y];

0 commit comments

Comments
 (0)