rewrote dynamic drag and drop layer because the old implementation had too many problems. This resolves all of the dynamic drag and drop issues in one go. draw() method can now be applied to any node, not just the Stage and Layers. drag events now bubble

This commit is contained in:
Eric Rowell
2013-03-22 00:46:41 -07:00
parent 0dbda82886
commit 0c80f6e223
8 changed files with 147 additions and 91 deletions

View File

@@ -11,20 +11,28 @@
* @param {Number} width
* @param {Number} height
*/
Kinetic.Canvas = function(width, height, pixelRatio) {
this.pixelRatio = pixelRatio || _pixelRatio;
this.width = width;
this.height = height;
this.element = document.createElement('canvas');
this.element.style.padding = 0;
this.element.style.margin = 0;
this.element.style.border = 0;
this.element.style.background = 'transparent';
this.context = this.element.getContext('2d');
this.setSize(width || 0, height || 0);
Kinetic.Canvas = function(config) {
this.init(config);
};
Kinetic.Canvas.prototype = {
init: function(config) {
var config = config || {},
width = config.width || 0,
height = config.height || 0,
pixelRatio = config.pixelRatio || _pixelRatio;
this.pixelRatio = pixelRatio;
this.width = width;
this.height = height;
this.element = document.createElement('canvas');
this.element.style.padding = 0;
this.element.style.margin = 0;
this.element.style.border = 0;
this.element.style.background = 'transparent';
this.context = this.element.getContext('2d');
this.setSize(width, height);
},
/**
* clear canvas
* @name clear