Fix unfilled text hit area

This commit is contained in:
casperlamboo 2018-01-10 15:49:00 +01:00
parent 1b66fc21e0
commit 36a73c233e

View File

@ -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);