Prevent drawing selected compound path children twice.

This commit is contained in:
Jürg Lehni 2014-05-12 18:57:09 +02:00
parent ea8518c3a5
commit e1ed7f3294
3 changed files with 8 additions and 7 deletions

View file

@ -3715,7 +3715,7 @@ var Item = Base.extend(Callback, /** @lends Item# */{
return updated;
},
_drawSelection: function(ctx, matrix, size, updateVersion) {
_drawSelection: function(ctx, matrix, size, selectedItems, updateVersion) {
if ((this._drawSelected || this._boundsSelected)
&& this._isUpdated(updateVersion)) {
// Allow definition of selected color on a per item and per
@ -3726,7 +3726,7 @@ var Item = Base.extend(Callback, /** @lends Item# */{
ctx.strokeStyle = ctx.fillStyle = color
? color.toCanvasStyle(ctx) : '#009dec';
if (this._drawSelected)
this._drawSelected(ctx, mx);
this._drawSelected(ctx, mx, selectedItems);
if (this._boundsSelected) {
var half = size / 2;
coords = mx._transformCorners(this.getInternalBounds());

View file

@ -272,13 +272,14 @@ var CompoundPath = PathItem.extend(/** @lends CompoundPath# */{
}
},
_drawSelected: function(ctx, matrix) {
_drawSelected: function(ctx, matrix, selectedItems) {
var children = this._children;
for (var i = 0, l = children.length; i < l; i++) {
var child = children[i],
mx = child._matrix;
child._drawSelected(ctx, mx.isIdentity() ? matrix
: matrix.clone().concatenate(child._matrix));
if (!selectedItems[child._id])
child._drawSelected(ctx, mx.isIdentity() ? matrix
: matrix.clone().concatenate(mx));
}
}
}, new function() { // Injection scope for PostScript-like drawing functions

View file

@ -865,9 +865,9 @@ var Project = PaperScopeItem.extend(/** @lends Project# */{
ctx.strokeWidth = 1;
var items = this._selectedItems,
size = this._scope.settings.handleSize,
updateVersion = this._updateVersion;
version = this._updateVersion;
for (var id in items)
items[id]._drawSelection(ctx, matrix, size, updateVersion);
items[id]._drawSelection(ctx, matrix, size, items, version);
ctx.restore();
}
}