Skip to content

Commit 4a55d63

Browse files
authored
Merge pull request #424 from ktbee/limit-mosaic-effect
Only check position against effect transform if it falls within the Drawable's space
2 parents c9c780a + 8f007c0 commit 4a55d63

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Drawable.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,10 @@ const getLocalPosition = (drawable, vec) => {
3636
// localPosition matches that transformation.
3737
localPosition[0] = 0.5 - (((v0 * m[0]) + (v1 * m[4]) + m[12]) / d);
3838
localPosition[1] = (((v0 * m[1]) + (v1 * m[5]) + m[13]) / d) + 0.5;
39-
// Apply texture effect transform.
40-
EffectTransform.transformPoint(drawable, localPosition, localPosition);
39+
// Apply texture effect transform if the localPosition is within the drawable's space.
40+
if ((localPosition[0] >= 0 && localPosition[0] < 1) && (localPosition[1] >= 0 && localPosition[1] < 1)) {
41+
EffectTransform.transformPoint(drawable, localPosition, localPosition);
42+
}
4143
return localPosition;
4244
};
4345

0 commit comments

Comments
 (0)