checking in first phase of new hit detection algo, which enables high performance event detections even if there are hundreds of thousands of shapes. This is a giant improvement over the previous algo, and is a fairly big architectural change. Since the Animation architecture and API is also changing, I feel that these changes are big enough to warrant a new major version, v4.0.0

This commit is contained in:
Eric Rowell
2012-08-11 16:22:01 -07:00
parent 0f1a424840
commit 468f8ef2d3
8 changed files with 93 additions and 125 deletions

View File

@@ -40,12 +40,12 @@ Kinetic.Layer = Kinetic.Container.extend({
});
this.nodeType = 'Layer';
this.lastDrawTime = 0;
this.beforeDrawFunc = undefined;
this.afterDrawFunc = undefined;
this.canvas = new Kinetic.Canvas();
this.canvas.getElement().style.position = 'absolute';
this.bufferCanvas = new Kinetic.Canvas();
this.bufferCanvas.name = 'buffer';
// call super constructor
this._super(config);
@@ -136,7 +136,6 @@ Kinetic.Layer = Kinetic.Container.extend({
* private draw children
*/
_draw: function(canvas) {
var pathCanvas = this.getStage().pathCanvas;
/*
* if canvas is not defined, then use the canvas
* tied to the layer
@@ -145,9 +144,6 @@ Kinetic.Layer = Kinetic.Container.extend({
canvas = this.getCanvas();
}
var time = new Date().getTime();
this.lastDrawTime = time;
// before draw handler
if(this.beforeDrawFunc !== undefined) {
this.beforeDrawFunc.call(this);
@@ -155,7 +151,7 @@ Kinetic.Layer = Kinetic.Container.extend({
if(this.attrs.clearBeforeDraw) {
canvas.clear();
pathCanvas.clear();
this.bufferCanvas.clear();
}
if(this.isVisible()) {
@@ -167,7 +163,7 @@ Kinetic.Layer = Kinetic.Container.extend({
// draw children on front canvas
this._drawChildren(canvas);
// draw children on back canvas
this._drawChildren(pathCanvas);
this._drawChildren(this.bufferCanvas);
}
// after draw handler