From 36a73c233e569fca79d2059a50edb6bdb511aa58 Mon Sep 17 00:00:00 2001 From: casperlamboo Date: Wed, 10 Jan 2018 15:49:00 +0100 Subject: [PATCH] Fix unfilled text hit area --- src/d2/tools/BaseTool.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/d2/tools/BaseTool.js b/src/d2/tools/BaseTool.js index 3b723b5..a6f05a3 100644 --- a/src/d2/tools/BaseTool.js +++ b/src/d2/tools/BaseTool.js @@ -133,6 +133,7 @@ export default class BaseTool extends EventGroup { .filter(shapeData => { const shapeMatrix = shapeData.transform.multiplyMatrix(matrix); let shapePoints = shapeToPoints(shapeData); + let { fill } = shapeData; if (shapeData.type === 'TEXT') { if (shapeData.text.text === '') return false; @@ -143,14 +144,15 @@ export default class BaseTool extends EventGroup { new Vector(max.x, max.y), new Vector(max.x, min.y) ], holes: [] }]; + fill = true; } const isHit = shapePoints .some(({ points, holes }) => { const shape = applyMatrixOnShape([points, ...holes], shapeMatrix); - const clipperShape = new ClipperShape(shape, shapeData.fill, true, true); + const clipperShape = new ClipperShape(shape, fill, true, true); - if (shapeData.fill) { + if (fill) { return clipperShape .fixOrientation() .pointInShape(position, true, true);