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

@@ -68,7 +68,7 @@ Test.prototype.tests = {
layer.add(circle);
stage.add(layer);
//document.body.appendChild(stage.pathCanvas.element)
document.body.appendChild(layer.bufferCanvas.element)
},
'TRANSITION - transition position and rotation': function(containerId) {
var stage = new Kinetic.Stage({

View File

@@ -102,15 +102,15 @@ Test.prototype.tests = {
// update tooltip
console.log('mouseover')
var mousePos = stage.getMousePosition();
//tooltip.setPosition(mousePos.x + 5, mousePos.y + 5);
//tooltip.setText("node: " + i + ", color: " + color);
//tooltip.show();
//tooltipLayer.draw();
tooltip.setPosition(mousePos.x + 5, mousePos.y + 5);
tooltip.setText("node: " + i + ", color: " + color);
tooltip.show();
tooltipLayer.draw();
});
circle.on("mouseout", function() {
//tooltip.hide();
//tooltipLayer.draw();
tooltip.hide();
tooltipLayer.draw();
});
circlesLayer.add(circle);
@@ -132,9 +132,9 @@ Test.prototype.tests = {
stage.add(circlesLayer);
//stage.add(tooltipLayer);
stage.add(tooltipLayer);
document.body.appendChild(stage.pathCanvas.element)
document.body.appendChild(circlesLayer.bufferCanvas.element)
},
'DRAWING - draw rect vs image from image data': function(containerId) {

View File

@@ -94,40 +94,6 @@ Test.prototype.tests = {
layer.add(group);
layer.draw();
},
'STAGE - test layer throttle': function(containerId) {
var stage = new Kinetic.Stage({
container: containerId,
width: 578,
height: 200
});
var layer = new Kinetic.Layer();
var group = new Kinetic.Group();
var circle = new Kinetic.Ellipse({
x: stage.getWidth() / 2,
y: stage.getHeight() / 2,
radius: 70,
fill: 'green',
stroke: 'black',
strokeWidth: 4,
name: 'myCircle'
});
group.add(circle);
layer.add(group);
stage.add(layer);
test(layer.lastDrawTime === 0, 'layer last draw time should be 0');
/*
* if throttling isn't working correctly, then the circle will
* flash green and then turn red
*/
circle.setFill('red');
layer.draw();
test(layer.lastDrawTime > 0, 'layer last draw time should be greather than 0');
},
'STAGE - add shape with linear gradient fill': function(containerId) {
var stage = new Kinetic.Stage({
container: containerId,