P.cleanPathObject = function () {
this.dirtyPathObject = false;
if (!this.noPathUpdates || !this.pathObject) {
let p = this.pathObject = new Path2D(),
rowLines = new Path2D(),
colLines = new Path2D();
let handle = this.currentStampHandlePosition,
scale = this.currentScale,
dims = this.currentDimensions;
let x = -handle[0] * scale,
y = -handle[1] * scale,
w = dims[0] * scale,
h = dims[1] * scale;
p.rect(x, y, w, h);
let cols = this.columns,
rows = this.rows,
colWidth = w / cols,
rowHeight = h / rows,
paths = this.tilePaths,
real = this.tileRealCoordinates,
virtual = this.tileVirtualCoordinates,
i, j, cx, cy;
rowLines.moveTo(x, y);
rowLines.lineTo(x + w, y);
for (i = 1; i <= rows; i++) {
let ry = y + (i * rowHeight);
rowLines.moveTo(x, ry);
rowLines.lineTo(x + w, ry);
}
this.rowLines = rowLines;
colLines.moveTo(x, y);
colLines.lineTo(x, y + h);
for (j = 1; j <= cols; j++) {
let cx = x + (j * colWidth);
colLines.moveTo(cx, y);
colLines.lineTo(cx, y + h);
}
this.columnLines = colLines;
paths.length = 0;
real.length = 0;
virtual.length = 0;
for (i = 0; i < rows; i++) {
for (j = 0; j < cols; j++) {
let path = new Path2D();
cx = j * colWidth;
cy = i * rowHeight;
path.rect(x + cx, y + cy, colWidth, rowHeight);
paths.push(path);
virtual.push([cx, cy]);
real.push([x + cx, y + cy]);
}
}
this.currentTileWidth = colWidth;
this.currentTileHeight = rowHeight;
}
};