diff --git a/src/path/Path.js b/src/path/Path.js index 663ad644..7f8fa294 100644 --- a/src/path/Path.js +++ b/src/path/Path.js @@ -1929,19 +1929,15 @@ var Path = PathItem.extend(/** @lends Path# */{ if (state & /*#=*/ SelectionState.HANDLE_OUT) drawHandle(4); // Draw a rectangle at segment.point: - ctx.save(); - ctx.beginPath(); - ctx.rect(pX - half, pY - half, size, size); - ctx.fill(); + ctx.fillRect(pX - half, pY - half, size, size); // If the point is not selected, draw a white square that is 1 px // smaller on all sides: if (!(state & /*#=*/ SelectionState.POINT)) { - ctx.beginPath(); - ctx.rect(pX - half + 1, pY - half + 1, size - 2, size - 2); + var fillStyle = ctx.fillStyle; ctx.fillStyle = '#ffffff'; - ctx.fill(); + ctx.fillRect(pX - half + 1, pY - half + 1, size - 2, size - 2); + ctx.fillStyle = fillStyle; } - ctx.restore(); } } diff --git a/src/project/Project.js b/src/project/Project.js index 727909fc..effd3b63 100644 --- a/src/project/Project.js +++ b/src/project/Project.js @@ -450,7 +450,9 @@ var Project = PaperScopeItem.extend(/** @lends Project# */{ ctx.save(); ctx.strokeWidth = 1; for (var id in this._selectedItems) { - var item = this._selectedItems[id]; + var item = this._selectedItems[id], + size = this.options.handleSize || 4; + half = size / 2; if (item._updateVersion === this._updateVersion && (item._drawSelected || item._boundsSelected)) { // Allow definition of selected color on a per item and per @@ -473,11 +475,9 @@ var Project = PaperScopeItem.extend(/** @lends Project# */{ coords[i], coords[++i]); ctx.closePath(); ctx.stroke(); - for (var i = 0; i < 8; i++) { - ctx.beginPath(); - ctx.rect(coords[i] - 2, coords[++i] - 2, 4, 4); - ctx.fill(); - } + for (var i = 0; i < 8; i++) + ctx.fillRect(coords[i] - half, coords[++i] - half, + size, size); } } }