mirror of
https://github.com/konvajs/konva.git
synced 2025-10-15 12:34:52 +08:00
garbage collecting empty arrays in _removeName method to free up space
This commit is contained in:
27
src/Shape.js
27
src/Shape.js
@@ -264,20 +264,27 @@ Kinetic.Shape.prototype = {
|
||||
context.lineJoin = this.attrs.lineJoin;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* apply shadow. return true if shadow was applied
|
||||
* and false if it was not
|
||||
*/
|
||||
_applyShadow: function() {
|
||||
var context = this.getContext();
|
||||
var s = this.attrs.shadow;
|
||||
var aa = this.getAbsoluteAlpha();
|
||||
var sa = this.attrs.shadow.alpha;
|
||||
|
||||
if(s.color !== undefined) {
|
||||
context.globalAlpha = sa * aa;
|
||||
context.shadowColor = s.color;
|
||||
context.shadowBlur = s.blur;
|
||||
context.shadowOffsetX = s.offset.x;
|
||||
context.shadowOffsetY = s.offset.y;
|
||||
this.appliedShadow = true;
|
||||
return true;
|
||||
if(s !== undefined) {
|
||||
var aa = this.getAbsoluteAlpha();
|
||||
var sa = this.attrs.shadow.alpha;
|
||||
|
||||
if(sa !== undefined && s.color !== undefined) {
|
||||
context.globalAlpha = sa * aa;
|
||||
context.shadowColor = s.color;
|
||||
context.shadowBlur = s.blur;
|
||||
context.shadowOffsetX = s.offset.x;
|
||||
context.shadowOffsetY = s.offset.y;
|
||||
this.appliedShadow = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@@ -493,7 +493,7 @@ Kinetic.Stage.prototype = {
|
||||
return true;
|
||||
}
|
||||
|
||||
else if(!isDragging && this.touchMove) {
|
||||
else if(!isDragging && this.touchMove) {
|
||||
shape._handleEvents('touchmove', evt);
|
||||
return true;
|
||||
}
|
||||
@@ -938,6 +938,9 @@ Kinetic.Stage.prototype = {
|
||||
nodes.splice(n, 1);
|
||||
}
|
||||
}
|
||||
if(nodes.length === 0) {
|
||||
this.names[node.attrs.name] = undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
Reference in New Issue
Block a user