From 09f7873a08d7a82ccf979a8792f0ec402ef9e124 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mihhail=20Lapu=C5=A1kin?= Date: Sun, 25 Aug 2013 12:24:20 +0300 Subject: [PATCH 1/9] Resolved compatibility issues with CocoonJS --- src/DragAndDrop.js | 2 +- src/Stage.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/DragAndDrop.js b/src/DragAndDrop.js index 8bcdfd27..ed1c1d68 100644 --- a/src/DragAndDrop.js +++ b/src/DragAndDrop.js @@ -228,7 +228,7 @@ 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('touchend', Kinetic.DD._endDragBefore, true); diff --git a/src/Stage.js b/src/Stage.js index 7bc58415..b79ad97c 100644 --- a/src/Stage.js +++ b/src/Stage.js @@ -549,7 +549,7 @@ } }, _getContentPosition: function() { - var rect = this.content.getBoundingClientRect(); + var rect = this.content.getBoundingClientRect ? this.content.getBoundingClientRect() : { top: 0, left: 0 }; return { top: rect.top, left: rect.left From 9210407ba41a357ba8f54348b76f92591c781585 Mon Sep 17 00:00:00 2001 From: Evan Hahn Date: Sun, 1 Sep 2013 11:55:52 -0400 Subject: [PATCH 2/9] Add Bower support If this is merged into `master`, it'll need to be tagged as version 4.7.0 so that Bower will work. git tag -a v4.7.0 --- .gitignore | 1 + bower.json | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 bower.json diff --git a/.gitignore b/.gitignore index 42a958f6..111fb4af 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ dist tests/js/unitTests.js analysis node_modules +bower_components phantomjs.exe # Numerous always-ignore extensions diff --git a/bower.json b/bower.json new file mode 100644 index 00000000..6ca6462a --- /dev/null +++ b/bower.json @@ -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" + ] +} From ecde9a5d840a6e8aac15043d39c50a7bf7fdea66 Mon Sep 17 00:00:00 2001 From: kzhdev Date: Thu, 3 Oct 2013 10:45:02 -0500 Subject: [PATCH 3/9] pass evt into contentMouseDown and contentMouseUp event --- src/Stage.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Stage.js b/src/Stage.js index 92b037bc..8f27e5d3 100644 --- a/src/Stage.js +++ b/src/Stage.js @@ -434,7 +434,7 @@ } // content event - this._fire(CONTENT_MOUSEDOWN); + this._fire(CONTENT_MOUSEDOWN, evt); // always call preventDefault for desktop events because some browsers // try to drag and drop the canvas element @@ -474,7 +474,7 @@ } } // content events - this._fire(CONTENT_MOUSEUP); + this._fire(CONTENT_MOUSEUP, evt); if (Kinetic.listenClickTap) { this._fire(CONTENT_CLICK, evt); if(fireDblClick) { From a246cb0de193562b880329f390466bd9b8802920 Mon Sep 17 00:00:00 2001 From: kzhdev Date: Thu, 3 Oct 2013 15:00:15 -0500 Subject: [PATCH 4/9] Fixed an issue where enableShadow/disableShadow didn't work after shap added into a layer --- src/Shape.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Shape.js b/src/Shape.js index 4391e8a9..58cce866 100644 --- a/src/Shape.js +++ b/src/Shape.js @@ -45,7 +45,7 @@ this._setDrawFuncs(); - this.on('shadowColorChange.kinetic shadowBlurChange.kinetic shadowOffsetChange.kinetic shadowOpacityChange.kinetic', _clearHasShadowCache); + this.on('shadowColorChange.kinetic shadowBlurChange.kinetic shadowOffsetChange.kinetic shadowOpacityChange.kinetic shadowEnabledChanged', _clearHasShadowCache); }, hasChildren: function() { return false; From 9758cd7b388ae8b539759c2f632f6ccff84cd14b Mon Sep 17 00:00:00 2001 From: kzhdev Date: Thu, 3 Oct 2013 19:57:45 -0500 Subject: [PATCH 5/9] Added kinetic namespace. --- src/Shape.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Shape.js b/src/Shape.js index 58cce866..9c2fbc13 100644 --- a/src/Shape.js +++ b/src/Shape.js @@ -45,7 +45,7 @@ this._setDrawFuncs(); - this.on('shadowColorChange.kinetic shadowBlurChange.kinetic shadowOffsetChange.kinetic shadowOpacityChange.kinetic shadowEnabledChanged', _clearHasShadowCache); + this.on('shadowColorChange.kinetic shadowBlurChange.kinetic shadowOffsetChange.kinetic shadowOpacityChange.kinetic shadowEnabledChanged.kinetic', _clearHasShadowCache); }, hasChildren: function() { return false; From 809b8b82e9b6be7d07a56ec108c843338f25b5b1 Mon Sep 17 00:00:00 2001 From: kzhdev Date: Fri, 4 Oct 2013 14:03:50 -0500 Subject: [PATCH 6/9] Don't use cached event listener length in node._fire because changing shape attribures in a event could remove kinetic event handler from the array which willl cause 'hander of undefined' error. --- src/Node.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Node.js b/src/Node.js index e252eb3c..91c314dc 100644 --- a/src/Node.js +++ b/src/Node.js @@ -1211,8 +1211,7 @@ len, i; if (events) { - len = events.length; - for(i = 0; i < len; i++) { + for(i = 0; i < events.length; i++) { events[i].handler.call(this, evt); } } From 0435be435980b6b356196e2bc368dfcd9193995c Mon Sep 17 00:00:00 2001 From: kzhdev Date: Fri, 4 Oct 2013 14:43:08 -0500 Subject: [PATCH 7/9] remove unused variable. --- src/Node.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Node.js b/src/Node.js index 91c314dc..5e03ff3d 100644 --- a/src/Node.js +++ b/src/Node.js @@ -1208,7 +1208,7 @@ }, _fire: function(eventType, evt) { var events = this.eventListeners[eventType], - len, i; + i; if (events) { for(i = 0; i < events.length; i++) { From 0b4a1071667d434c4b2c3cc77e3c46aa702ade91 Mon Sep 17 00:00:00 2001 From: ippo615 Date: Sun, 13 Oct 2013 15:06:15 -0400 Subject: [PATCH 8/9] Fixed #635 Added `destroy` method to the image node which deletes the reference to the DOM or canvas objects. --- src/shapes/Image.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/shapes/Image.js b/src/shapes/Image.js index 55653a0b..558789f2 100644 --- a/src/shapes/Image.js +++ b/src/shapes/Image.js @@ -231,6 +231,12 @@ getHeight: function() { var image = this.getImage(); 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); From 6e25195fb7d03a54e84e42819fa7517f2a7e25e6 Mon Sep 17 00:00:00 2001 From: ippo615 Date: Sun, 13 Oct 2013 15:35:29 -0400 Subject: [PATCH 9/9] Fixed #639 --- src/Group.js | 2 +- src/Node.js | 2 +- src/shapes/Image.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Group.js b/src/Group.js index 3b39cd62..4e15273e 100644 --- a/src/Group.js +++ b/src/Group.js @@ -10,7 +10,7 @@ if (type !== 'Group' && type !== 'Shape') { Kinetic.Util.error('You may only add groups and shapes to groups.'); } - }, + } }); Kinetic.Util.extend(Kinetic.Group, Kinetic.Container); })(); diff --git a/src/Node.js b/src/Node.js index 1e845319..12df7475 100644 --- a/src/Node.js +++ b/src/Node.js @@ -1218,7 +1218,7 @@ } } }, - /* + /** * draw both scene and hit graphs. If the node being drawn is the stage, all of the layers will be cleared and redra * @method * @memberof Kinetic.Node.prototype diff --git a/src/shapes/Image.js b/src/shapes/Image.js index 558789f2..1da6755b 100644 --- a/src/shapes/Image.js +++ b/src/shapes/Image.js @@ -136,7 +136,7 @@ filterCanvas = this.filterCanvas = new Kinetic.SceneCanvas({ width: crop.width, height: crop.height, - pixelRatio: 1, + pixelRatio: 1 }); }