added drawScene() method which only redraws the scene and not the buffer

This commit is contained in:
Eric Rowell 2012-08-16 23:22:07 -07:00
parent e6e488025e
commit f53c43d4f7
4 changed files with 22 additions and 5 deletions

View File

@ -3635,6 +3635,15 @@ Kinetic.Layer = Kinetic.Container.extend({
drawBuffer: function() {
this.draw(this.bufferCanvas);
},
/**
* draw children nodes on scene. this includes any groups
* or shapes
* @name drawScene
* @methodOf Kinetic.Layer.prototype
*/
drawScene: function() {
this.draw(this.getCanvas());
},
/**
* set before draw handler
* @name beforeDraw

File diff suppressed because one or more lines are too long

View File

@ -68,6 +68,15 @@ Kinetic.Layer = Kinetic.Container.extend({
drawBuffer: function() {
this.draw(this.bufferCanvas);
},
/**
* draw children nodes on scene. this includes any groups
* or shapes
* @name drawScene
* @methodOf Kinetic.Layer.prototype
*/
drawScene: function() {
this.draw(this.getCanvas());
},
/**
* set before draw handler
* @name beforeDraw

View File

@ -4738,8 +4738,7 @@ Test.prototype.tests = {
y: 10
});
var mapLayer = new Kinetic.Layer();
var mapCanvas = mapLayer.getCanvas();
for(var key in worldMap.shapes) {
var c = worldMap.shapes[key];
@ -4755,12 +4754,12 @@ Test.prototype.tests = {
path.on('mouseover', function() {
this.setFill('red');
mapLayer.draw(mapCanvas);
mapLayer.drawScene();
});
path.on('mouseout', function() {
this.setFill('#ccc');
mapLayer.draw(mapCanvas);
mapLayer.drawScene();
});
mapLayer.add(path);