Merge branch 'master' of github.com:ericdrowell/KineticJS

This commit is contained in:
Eric Rowell
2013-11-02 22:31:23 -07:00
8 changed files with 38 additions and 11 deletions

1
.gitignore vendored
View File

@@ -3,6 +3,7 @@ jsdoc-master
dist dist
analysis analysis
node_modules node_modules
bower_components
phantomjs.exe phantomjs.exe
# Numerous always-ignore extensions # Numerous always-ignore extensions

21
bower.json Normal file
View File

@@ -0,0 +1,21 @@
{
"name": "KineticJS",
"version": "4.7.0",
"homepage": "http://kineticjs.com/",
"authors": [
"Eric Rowell"
],
"description": "KineticJS is an HTML5 Canvas JavaScript framework that enables high performance animations, transitions, node nesting, layering, filtering, caching, event handling for desktop and mobile applications, and much more.",
"keywords": [
"canvas",
"animations"
],
"license": "MIT",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
]
}

View File

@@ -238,7 +238,7 @@
Kinetic.Node.prototype.isDraggable = Kinetic.Node.prototype.getDraggable; Kinetic.Node.prototype.isDraggable = Kinetic.Node.prototype.getDraggable;
var html = document.getElementsByTagName('html')[0]; var html = document.documentElement;
html.addEventListener('mouseup', Kinetic.DD._endDragBefore, true); html.addEventListener('mouseup', Kinetic.DD._endDragBefore, true);
html.addEventListener('touchend', Kinetic.DD._endDragBefore, true); html.addEventListener('touchend', Kinetic.DD._endDragBefore, true);

View File

@@ -10,7 +10,7 @@
if (type !== 'Group' && type !== 'Shape') { if (type !== 'Group' && type !== 'Shape') {
Kinetic.Util.error('You may only add groups and shapes to groups.'); Kinetic.Util.error('You may only add groups and shapes to groups.');
} }
}, }
}); });
Kinetic.Util.extend(Kinetic.Group, Kinetic.Container); Kinetic.Util.extend(Kinetic.Group, Kinetic.Container);
})(); })();

View File

@@ -1210,16 +1210,15 @@
}, },
_fire: function(eventType, evt) { _fire: function(eventType, evt) {
var events = this.eventListeners[eventType], var events = this.eventListeners[eventType],
len, i; i;
if (events) { if (events) {
len = events.length; for(i = 0; i < events.length; i++) {
for(i = 0; i < len; i++) {
events[i].handler.call(this, evt); events[i].handler.call(this, evt);
} }
} }
}, },
/* /**
* draw both scene and hit graphs. If the node being drawn is the stage, all of the layers will be cleared and redra * draw both scene and hit graphs. If the node being drawn is the stage, all of the layers will be cleared and redra
* @method * @method
* @memberof Kinetic.Node.prototype * @memberof Kinetic.Node.prototype

View File

@@ -45,7 +45,7 @@
this._setDrawFuncs(); this._setDrawFuncs();
this.on('shadowColorChange.kinetic shadowBlurChange.kinetic shadowOffsetChange.kinetic shadowOpacityChange.kinetic', _clearHasShadowCache); this.on('shadowColorChange.kinetic shadowBlurChange.kinetic shadowOffsetChange.kinetic shadowOpacityChange.kinetic shadowEnabledChanged.kinetic', _clearHasShadowCache);
}, },
hasChildren: function() { hasChildren: function() {
return false; return false;

View File

@@ -411,7 +411,7 @@
} }
// content event // content event
this._fire(CONTENT_MOUSEDOWN); this._fire(CONTENT_MOUSEDOWN, evt);
// always call preventDefault for desktop events because some browsers // always call preventDefault for desktop events because some browsers
// try to drag and drop the canvas element // try to drag and drop the canvas element
@@ -451,7 +451,7 @@
} }
} }
// content events // content events
this._fire(CONTENT_MOUSEUP); this._fire(CONTENT_MOUSEUP, evt);
if (Kinetic.listenClickTap) { if (Kinetic.listenClickTap) {
this._fire(CONTENT_CLICK, evt); this._fire(CONTENT_CLICK, evt);
if(fireDblClick) { if(fireDblClick) {
@@ -598,7 +598,7 @@
}; };
}, },
_getContentPosition: function() { _getContentPosition: function() {
var rect = this.content.getBoundingClientRect(); var rect = this.content.getBoundingClientRect ? this.content.getBoundingClientRect() : { top: 0, left: 0 };
return { return {
top: rect.top, top: rect.top,
left: rect.left left: rect.left

View File

@@ -136,7 +136,7 @@
filterCanvas = this.filterCanvas = new Kinetic.SceneCanvas({ filterCanvas = this.filterCanvas = new Kinetic.SceneCanvas({
width: crop.width, width: crop.width,
height: crop.height, height: crop.height,
pixelRatio: 1, pixelRatio: 1
}); });
} }
@@ -231,6 +231,12 @@
getHeight: function() { getHeight: function() {
var image = this.getImage(); var image = this.getImage();
return this.attrs.height || (image ? image.height : 0); return this.attrs.height || (image ? image.height : 0);
},
destroy: function(){
Kinetic.Shape.prototype.destroy.call(this);
delete this.filterCanvas;
delete this.attrs;
return this;
} }
}; };
Kinetic.Util.extend(Kinetic.Image, Kinetic.Shape); Kinetic.Util.extend(Kinetic.Image, Kinetic.Shape);