From a2a9672bfa33cf5eff1b83404216c485fe3bb657 Mon Sep 17 00:00:00 2001 From: adroitwhiz Date: Mon, 6 Jul 2020 16:51:43 -0400 Subject: [PATCH] Document what's going on with convex hull points --- src/RenderWebGL.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/RenderWebGL.js b/src/RenderWebGL.js index 80d2a1a9c..56fe6ea9d 100644 --- a/src/RenderWebGL.js +++ b/src/RenderWebGL.js @@ -1883,6 +1883,10 @@ class RenderWebGL extends EventEmitter { // *Not* Scratch Space-- +y is bottom // Loop over all rows of pixels, starting at the top for (let y = 0; y < height; y++) { + // See comment in Drawable.getLocalPosition for why we're adding 0.5 here. + // Essentially, _pixelPos is supposed to be in "texture space", and "texture space" positions are offset + // by 0.5. Notice that we're calling drawable.skin.isTouchingLinear (operates in texture space) + // and not drawable.isTouching (operates in Scratch space). _pixelPos[1] = (y + 0.5) / height; // We start at the leftmost point, then go rightwards until we hit an opaque pixel