diff --git a/Gruntfile.js b/Gruntfile.js index 1613b194..6f8cb7cb 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -4,6 +4,7 @@ module.exports = function(grunt) { 'src/Global.js', 'src/Util.js', 'src/Canvas.js', + 'src/Factory.js', 'src/Node.js', 'src/Animation.js', 'src/Tween.js', diff --git a/src/Container.js b/src/Container.js index a0f787f5..eeb1ff11 100644 --- a/src/Container.js +++ b/src/Container.js @@ -299,7 +299,7 @@ Kinetic.Util.extend(Kinetic.Container, Kinetic.Node); // add getters setters - Kinetic.Node.addGetterSetter(Kinetic.Container, 'clipFunc'); + Kinetic.Factory.addGetterSetter(Kinetic.Container, 'clipFunc'); /** * set clipping function diff --git a/src/DragAndDrop.js b/src/DragAndDrop.js index b0ad17ef..14acb139 100644 --- a/src/DragAndDrop.js +++ b/src/DragAndDrop.js @@ -188,7 +188,7 @@ this.off('touchstart.kinetic'); }; - Kinetic.Node.addGetterSetter(Kinetic.Node, 'dragBoundFunc'); + Kinetic.Factory.addGetterSetter(Kinetic.Node, 'dragBoundFunc'); /** * set drag bound function. This is used to override the default @@ -206,7 +206,7 @@ * @memberof Kinetic.Node.prototype */ - Kinetic.Node.addGetter(Kinetic.Node, 'draggable', false); + Kinetic.Factory.addGetter(Kinetic.Node, 'draggable', false); /** * get draggable diff --git a/src/Factory.js b/src/Factory.js new file mode 100644 index 00000000..cb06acb9 --- /dev/null +++ b/src/Factory.js @@ -0,0 +1,309 @@ + (function() { + // CONSTANTS + var ABSOLUTE_OPACITY = 'absoluteOpacity', + ABSOLUTE_TRANSFORM = 'absoluteTransform', + ADD = 'add', + B = 'b', + BEFORE = 'before', + BLACK = 'black', + CHANGE = 'Change', + CHILDREN = 'children', + DEG = 'Deg', + DOT = '.', + EMPTY_STRING = '', + G = 'g', + GET = 'get', + HASH = '#', + ID = 'id', + KINETIC = 'kinetic', + LISTENING = 'listening', + MOUSEENTER = 'mouseenter', + MOUSELEAVE = 'mouseleave', + NAME = 'name', + OFF = 'off', + ON = 'on', + PRIVATE_GET = '_get', + R = 'r', + RGB = 'RGB', + SET = 'set', + SHAPE = 'Shape', + SPACE = ' ', + STAGE = 'Stage', + TRANSFORM = 'transform', + UPPER_B = 'B', + UPPER_G = 'G', + UPPER_HEIGHT = 'Height', + UPPER_R = 'R', + UPPER_WIDTH = 'Width', + UPPER_X = 'X', + UPPER_Y = 'Y', + VISIBLE = 'visible', + X = 'x', + Y = 'y'; + + Kinetic.Factory = { + // getter setter adders + addGetterSetter: function(constructor, attr, def) { + this.addGetter(constructor, attr, def); + this.addSetter(constructor, attr); + }, + addPointGetterSetter: function(constructor, attr, def) { + this.addPointGetter(constructor, attr, def); + this.addPointSetter(constructor, attr); + + // add invdividual component getters and setters + this.addGetter(constructor, attr + UPPER_X, def); + this.addGetter(constructor, attr + UPPER_Y, def); + this.addSetter(constructor, attr + UPPER_X); + this.addSetter(constructor, attr + UPPER_Y); + }, + addBoxGetterSetter: function(constructor, attr, def) { + this.addBoxGetter(constructor, attr, def); + this.addBoxSetter(constructor, attr); + + // add invdividual component getters and setters + this.addGetter(constructor, attr + UPPER_X, def); + this.addGetter(constructor, attr + UPPER_Y, def); + this.addGetter(constructor, attr + UPPER_WIDTH, def); + this.addGetter(constructor, attr + UPPER_HEIGHT, def); + + this.addSetter(constructor, attr + UPPER_X); + this.addSetter(constructor, attr + UPPER_Y); + this.addSetter(constructor, attr + UPPER_WIDTH); + this.addSetter(constructor, attr + UPPER_HEIGHT); + }, + addPointsGetterSetter: function(constructor, attr) { + this.addPointsGetter(constructor, attr); + this.addPointsSetter(constructor, attr); + this.addPointAdder(constructor, attr); + }, + addRotationGetterSetter: function(constructor, attr, def) { + this.addRotationGetter(constructor, attr, def); + this.addRotationSetter(constructor, attr); + }, + addColorGetterSetter: function(constructor, attr) { + this.addGetter(constructor, attr); + this.addSetter(constructor, attr); + + // component getters + this.addColorRGBGetter(constructor, attr); + this.addColorComponentGetter(constructor, attr, R); + this.addColorComponentGetter(constructor, attr, G); + this.addColorComponentGetter(constructor, attr, B); + + // component setters + this.addColorRGBSetter(constructor, attr); + this.addColorComponentSetter(constructor, attr, R); + this.addColorComponentSetter(constructor, attr, G); + this.addColorComponentSetter(constructor, attr, B); + }, + + // getter adders + addColorRGBGetter: function(constructor, attr) { + var method = GET + Kinetic.Util._capitalize(attr) + RGB; + constructor.prototype[method] = function() { + return Kinetic.Util.getRGB(this.attrs[attr]); + }; + }, + + addColorComponentGetter: function(constructor, attr, c) { + var prefix = GET + Kinetic.Util._capitalize(attr), + method = prefix + Kinetic.Util._capitalize(c); + constructor.prototype[method] = function() { + return this[prefix + RGB]()[c]; + }; + }, + addPointsGetter: function(constructor, attr) { + var that = this, + method = GET + Kinetic.Util._capitalize(attr); + + constructor.prototype[method] = function() { + var val = this.attrs[attr]; + return val === undefined ? [] : val; + }; + }, + addGetter: function(constructor, attr, def) { + var that = this, + method = GET + Kinetic.Util._capitalize(attr); + + constructor.prototype[method] = function() { + var val = this.attrs[attr]; + return val === undefined ? def : val; + }; + }, + addPointGetter: function(constructor, attr) { + var that = this, + baseMethod = GET + Kinetic.Util._capitalize(attr); + + constructor.prototype[baseMethod] = function() { + var that = this; + return { + x: that[baseMethod + UPPER_X](), + y: that[baseMethod + UPPER_Y]() + }; + }; + }, + addBoxGetter: function(constructor, attr) { + var that = this, + baseMethod = GET + Kinetic.Util._capitalize(attr); + + constructor.prototype[baseMethod] = function() { + var that = this; + return { + x: that[baseMethod + UPPER_X](), + y: that[baseMethod + UPPER_Y](), + width: that[baseMethod + UPPER_WIDTH](), + height: that[baseMethod + UPPER_HEIGHT]() + }; + }; + }, + addRotationGetter: function(constructor, attr, def) { + var that = this, + method = GET + Kinetic.Util._capitalize(attr); + + // radians + constructor.prototype[method] = function() { + var val = this.attrs[attr]; + if (val === undefined) { + val = def; + } + return val; + }; + // degrees + constructor.prototype[method + DEG] = function() { + var val = this.attrs[attr]; + if (val === undefined) { + val = def; + } + return Kinetic.Util._radToDeg(val); + }; + }, + + // setter adders + addColorRGBSetter: function(constructor, attr) { + var method = SET + Kinetic.Util._capitalize(attr) + RGB; + + constructor.prototype[method] = function(obj) { + var r = obj && obj.r !== undefined ? obj.r | 0 : this.getAttr(attr + UPPER_R), + g = obj && obj.g !== undefined ? obj.g | 0 : this.getAttr(attr + UPPER_G), + b = obj && obj.b !== undefined ? obj.b | 0 : this.getAttr(attr + UPPER_B); + + this._setAttr(attr, HASH + Kinetic.Util._rgbToHex(r, g, b)); + }; + }, + + addColorComponentSetter: function(constructor, attr, c) { + var prefix = SET + Kinetic.Util._capitalize(attr), + method = prefix + Kinetic.Util._capitalize(c); + constructor.prototype[method] = function(val) { + var obj = {}; + obj[c] = val; + this[prefix + RGB](obj); + }; + }, + addPointsSetter: function(constructor, attr) { + var method = SET + Kinetic.Util._capitalize(attr); + constructor.prototype[method] = function(val) { + var points = Kinetic.Util._getPoints(val); + this._setAttr('points', points); + }; + }, + addSetter: function(constructor, attr) { + var method = SET + Kinetic.Util._capitalize(attr); + + constructor.prototype[method] = function(val) { + this._setAttr(attr, val); + }; + }, + addPointSetter: function(constructor, attr) { + var that = this, + baseMethod = SET + Kinetic.Util._capitalize(attr); + + constructor.prototype[baseMethod] = function() { + var pos = Kinetic.Util._getXY([].slice.call(arguments)), + oldVal = this.attrs[attr], + x = 0, + y = 0; + + if (pos) { + x = pos.x; + y = pos.y; + + this._fireBeforeChangeEvent(attr, oldVal, pos); + if (x !== undefined) { + this[baseMethod + UPPER_X](x); + } + if (y !== undefined) { + this[baseMethod + UPPER_Y](y); + } + this._fireChangeEvent(attr, oldVal, pos); + } + }; + }, + addBoxSetter: function(constructor, attr) { + var that = this, + baseMethod = SET + Kinetic.Util._capitalize(attr); + + constructor.prototype[baseMethod] = function() { + var config = [].slice.call(arguments), + pos = Kinetic.Util._getXY(config), + size = Kinetic.Util._getSize(config), + both = Kinetic.Util._merge(pos, size), + oldVal = this.attrs[attr], + x, y, width, height; + + if (both) { + x = both.x; + y = both.y; + width = both.width; + height = both.height; + + this._fireBeforeChangeEvent(attr, oldVal, both); + if (x !== undefined) { + this[baseMethod + UPPER_X](x); + } + if (y !== undefined) { + this[baseMethod + UPPER_Y](y); + } + if (width !== undefined) { + this[baseMethod + UPPER_WIDTH](width); + } + if (height !== undefined) { + this[baseMethod + UPPER_HEIGHT](height); + } + this._fireChangeEvent(attr, oldVal, both); + } + }; + }, + addRotationSetter: function(constructor, attr) { + var that = this, + method = SET + Kinetic.Util._capitalize(attr); + + // radians + constructor.prototype[method] = function(val) { + this._setAttr(attr, val); + }; + // degrees + constructor.prototype[method + DEG] = function(deg) { + this._setAttr(attr, Kinetic.Util._degToRad(deg)); + }; + }, + + // add adders + addPointAdder: function(constructor, attr) { + var that = this, + baseMethod = ADD + Kinetic.Util._removeLastLetter(Kinetic.Util._capitalize(attr)); + + constructor.prototype[baseMethod] = function() { + var pos = Kinetic.Util._getXY([].slice.call(arguments)), + oldVal = this.attrs[attr]; + + if (pos) { + this._fireBeforeChangeEvent(attr, oldVal, pos); + this.attrs[attr].push(pos); + this._fireChangeEvent(attr, oldVal, pos); + } + }; + } + }; +})(); \ No newline at end of file diff --git a/src/Layer.js b/src/Layer.js index 54f164bc..7b00e723 100644 --- a/src/Layer.js +++ b/src/Layer.js @@ -199,7 +199,7 @@ Kinetic.Util.extend(Kinetic.Layer, Kinetic.Container); // add getters and setters - Kinetic.Node.addGetterSetter(Kinetic.Layer, 'clearBeforeDraw', true); + Kinetic.Factory.addGetterSetter(Kinetic.Layer, 'clearBeforeDraw', true); /** * set flag which determines if the layer is cleared or not diff --git a/src/Node.js b/src/Node.js index afa92b3f..0f91d118 100644 --- a/src/Node.js +++ b/src/Node.js @@ -1264,270 +1264,6 @@ } }); - // getter setter adders - Kinetic.Node.addGetterSetter = function(constructor, attr, def) { - this.addGetter(constructor, attr, def); - this.addSetter(constructor, attr); - }; - Kinetic.Node.addPointGetterSetter = function(constructor, attr, def) { - this.addPointGetter(constructor, attr, def); - this.addPointSetter(constructor, attr); - - // add invdividual component getters and setters - this.addGetter(constructor, attr + UPPER_X, def); - this.addGetter(constructor, attr + UPPER_Y, def); - this.addSetter(constructor, attr + UPPER_X); - this.addSetter(constructor, attr + UPPER_Y); - }; - Kinetic.Node.addBoxGetterSetter = function(constructor, attr, def) { - this.addBoxGetter(constructor, attr, def); - this.addBoxSetter(constructor, attr); - - // add invdividual component getters and setters - this.addGetter(constructor, attr + UPPER_X, def); - this.addGetter(constructor, attr + UPPER_Y, def); - this.addGetter(constructor, attr + UPPER_WIDTH, def); - this.addGetter(constructor, attr + UPPER_HEIGHT, def); - - this.addSetter(constructor, attr + UPPER_X); - this.addSetter(constructor, attr + UPPER_Y); - this.addSetter(constructor, attr + UPPER_WIDTH); - this.addSetter(constructor, attr + UPPER_HEIGHT); - }; - Kinetic.Node.addPointsGetterSetter = function(constructor, attr) { - this.addPointsGetter(constructor, attr); - this.addPointsSetter(constructor, attr); - this.addPointAdder(constructor, attr); - }; - Kinetic.Node.addRotationGetterSetter = function(constructor, attr, def) { - this.addRotationGetter(constructor, attr, def); - this.addRotationSetter(constructor, attr); - }; - Kinetic.Node.addColorGetterSetter = function(constructor, attr) { - this.addGetter(constructor, attr); - this.addSetter(constructor, attr); - - // component getters - this.addColorRGBGetter(constructor, attr); - this.addColorComponentGetter(constructor, attr, R); - this.addColorComponentGetter(constructor, attr, G); - this.addColorComponentGetter(constructor, attr, B); - - // component setters - this.addColorRGBSetter(constructor, attr); - this.addColorComponentSetter(constructor, attr, R); - this.addColorComponentSetter(constructor, attr, G); - this.addColorComponentSetter(constructor, attr, B); - }; - - // getter adders - Kinetic.Node.addColorRGBGetter = function(constructor, attr) { - var method = GET + Kinetic.Util._capitalize(attr) + RGB; - constructor.prototype[method] = function() { - return Kinetic.Util.getRGB(this.attrs[attr]); - }; - }; - - Kinetic.Node.addColorComponentGetter = function(constructor, attr, c) { - var prefix = GET + Kinetic.Util._capitalize(attr), - method = prefix + Kinetic.Util._capitalize(c); - constructor.prototype[method] = function() { - return this[prefix + RGB]()[c]; - }; - }; - Kinetic.Node.addPointsGetter = function(constructor, attr) { - var that = this, - method = GET + Kinetic.Util._capitalize(attr); - - constructor.prototype[method] = function() { - var val = this.attrs[attr]; - return val === undefined ? [] : val; - }; - }; - Kinetic.Node.addGetter = function(constructor, attr, def) { - var that = this, - method = GET + Kinetic.Util._capitalize(attr); - - constructor.prototype[method] = function() { - var val = this.attrs[attr]; - return val === undefined ? def : val; - }; - }; - Kinetic.Node.addPointGetter = function(constructor, attr) { - var that = this, - baseMethod = GET + Kinetic.Util._capitalize(attr); - - constructor.prototype[baseMethod] = function() { - var that = this; - return { - x: that[baseMethod + UPPER_X](), - y: that[baseMethod + UPPER_Y]() - }; - }; - }; - Kinetic.Node.addBoxGetter = function(constructor, attr) { - var that = this, - baseMethod = GET + Kinetic.Util._capitalize(attr); - - constructor.prototype[baseMethod] = function() { - var that = this; - return { - x: that[baseMethod + UPPER_X](), - y: that[baseMethod + UPPER_Y](), - width: that[baseMethod + UPPER_WIDTH](), - height: that[baseMethod + UPPER_HEIGHT]() - }; - }; - }; - Kinetic.Node.addRotationGetter = function(constructor, attr, def) { - var that = this, - method = GET + Kinetic.Util._capitalize(attr); - - // radians - constructor.prototype[method] = function() { - var val = this.attrs[attr]; - if (val === undefined) { - val = def; - } - return val; - }; - // degrees - constructor.prototype[method + DEG] = function() { - var val = this.attrs[attr]; - if (val === undefined) { - val = def; - } - return Kinetic.Util._radToDeg(val); - }; - }; - - // setter adders - Kinetic.Node.addColorRGBSetter = function(constructor, attr) { - var method = SET + Kinetic.Util._capitalize(attr) + RGB; - - constructor.prototype[method] = function(obj) { - var r = obj && obj.r !== undefined ? obj.r | 0 : this.getAttr(attr + UPPER_R), - g = obj && obj.g !== undefined ? obj.g | 0 : this.getAttr(attr + UPPER_G), - b = obj && obj.b !== undefined ? obj.b | 0 : this.getAttr(attr + UPPER_B); - - this._setAttr(attr, HASH + Kinetic.Util._rgbToHex(r, g, b)); - }; - }; - - Kinetic.Node.addColorComponentSetter = function(constructor, attr, c) { - var prefix = SET + Kinetic.Util._capitalize(attr), - method = prefix + Kinetic.Util._capitalize(c); - constructor.prototype[method] = function(val) { - var obj = {}; - obj[c] = val; - this[prefix + RGB](obj); - }; - }; - Kinetic.Node.addPointsSetter = function(constructor, attr) { - var method = SET + Kinetic.Util._capitalize(attr); - constructor.prototype[method] = function(val) { - var points = Kinetic.Util._getPoints(val); - this._setAttr('points', points); - }; - }; - Kinetic.Node.addSetter = function(constructor, attr) { - var method = SET + Kinetic.Util._capitalize(attr); - - constructor.prototype[method] = function(val) { - this._setAttr(attr, val); - }; - }; - Kinetic.Node.addPointSetter = function(constructor, attr) { - var that = this, - baseMethod = SET + Kinetic.Util._capitalize(attr); - - constructor.prototype[baseMethod] = function() { - var pos = Kinetic.Util._getXY([].slice.call(arguments)), - oldVal = this.attrs[attr], - x = 0, - y = 0; - - if (pos) { - x = pos.x; - y = pos.y; - - this._fireBeforeChangeEvent(attr, oldVal, pos); - if (x !== undefined) { - this[baseMethod + UPPER_X](x); - } - if (y !== undefined) { - this[baseMethod + UPPER_Y](y); - } - this._fireChangeEvent(attr, oldVal, pos); - } - }; - }; - Kinetic.Node.addBoxSetter = function(constructor, attr) { - var that = this, - baseMethod = SET + Kinetic.Util._capitalize(attr); - - constructor.prototype[baseMethod] = function() { - var config = [].slice.call(arguments), - pos = Kinetic.Util._getXY(config), - size = Kinetic.Util._getSize(config), - both = Kinetic.Util._merge(pos, size), - oldVal = this.attrs[attr], - x, y, width, height; - - if (both) { - x = both.x; - y = both.y; - width = both.width; - height = both.height; - - this._fireBeforeChangeEvent(attr, oldVal, both); - if (x !== undefined) { - this[baseMethod + UPPER_X](x); - } - if (y !== undefined) { - this[baseMethod + UPPER_Y](y); - } - if (width !== undefined) { - this[baseMethod + UPPER_WIDTH](width); - } - if (height !== undefined) { - this[baseMethod + UPPER_HEIGHT](height); - } - this._fireChangeEvent(attr, oldVal, both); - } - }; - }; - Kinetic.Node.addRotationSetter = function(constructor, attr) { - var that = this, - method = SET + Kinetic.Util._capitalize(attr); - - // radians - constructor.prototype[method] = function(val) { - this._setAttr(attr, val); - }; - // degrees - constructor.prototype[method + DEG] = function(deg) { - this._setAttr(attr, Kinetic.Util._degToRad(deg)); - }; - }; - - // add adders - Kinetic.Node.addPointAdder = function(constructor, attr) { - var that = this, - baseMethod = ADD + Kinetic.Util._removeLastLetter(Kinetic.Util._capitalize(attr)); - - constructor.prototype[baseMethod] = function() { - var pos = Kinetic.Util._getXY([].slice.call(arguments)), - oldVal = this.attrs[attr]; - - if (pos) { - this._fireBeforeChangeEvent(attr, oldVal, pos); - this.attrs[attr].push(pos); - this._fireChangeEvent(attr, oldVal, pos); - } - }; - }; - /** * create node with JSON string. De-serializtion does not generate custom * shape drawing functions, images, or event handlers (this would make the @@ -1566,7 +1302,7 @@ }; // add getters setters - Kinetic.Node.addGetterSetter(Kinetic.Node, 'x', 0); + Kinetic.Factory.addGetterSetter(Kinetic.Node, 'x', 0); /** * set x position @@ -1583,7 +1319,7 @@ * @memberof Kinetic.Node.prototype */ - Kinetic.Node.addGetterSetter(Kinetic.Node, 'y', 0); + Kinetic.Factory.addGetterSetter(Kinetic.Node, 'y', 0); /** * set y position @@ -1600,7 +1336,7 @@ * @memberof Kinetic.Node.prototype */ - Kinetic.Node.addGetterSetter(Kinetic.Node, 'opacity', 1); + Kinetic.Factory.addGetterSetter(Kinetic.Node, 'opacity', 1); /** * set opacity. Opacity values range from 0 to 1. @@ -1619,7 +1355,7 @@ * @memberof Kinetic.Node.prototype */ - Kinetic.Node.addGetter(Kinetic.Node, 'name'); + Kinetic.Factory.addGetter(Kinetic.Node, 'name'); /** * get name @@ -1628,7 +1364,7 @@ * @memberof Kinetic.Node.prototype */ - Kinetic.Node.addGetter(Kinetic.Node, 'id'); + Kinetic.Factory.addGetter(Kinetic.Node, 'id'); /** * get id @@ -1637,7 +1373,7 @@ * @memberof Kinetic.Node.prototype */ - Kinetic.Node.addRotationGetterSetter(Kinetic.Node, 'rotation', 0); + Kinetic.Factory.addRotationGetterSetter(Kinetic.Node, 'rotation', 0); /** * set rotation in radians @@ -1669,7 +1405,7 @@ * @memberof Kinetic.Node.prototype */ - Kinetic.Node.addPointGetterSetter(Kinetic.Node, 'scale', 1); + Kinetic.Factory.addPointGetterSetter(Kinetic.Node, 'scale', 1); /** * set scale @@ -1730,7 +1466,7 @@ * @memberof Kinetic.Node.prototype */ - Kinetic.Node.addPointGetterSetter(Kinetic.Node, 'skew', 0); + Kinetic.Factory.addPointGetterSetter(Kinetic.Node, 'skew', 0); /** * set skew @@ -1792,7 +1528,7 @@ * @memberof Kinetic.Node.prototype */ - Kinetic.Node.addPointGetterSetter(Kinetic.Node, 'offset', 0); + Kinetic.Factory.addPointGetterSetter(Kinetic.Node, 'offset', 0); /** * set offset. A node's offset defines the position and rotation point @@ -1854,7 +1590,7 @@ * @memberof Kinetic.Node.prototype */ - Kinetic.Node.addSetter(Kinetic.Node, 'width'); + Kinetic.Factory.addSetter(Kinetic.Node, 'width'); /** * set width @@ -1864,7 +1600,7 @@ * @param {Number} width */ - Kinetic.Node.addSetter(Kinetic.Node, 'height'); + Kinetic.Factory.addSetter(Kinetic.Node, 'height'); /** * set height @@ -1874,7 +1610,7 @@ * @param {Number} height */ - Kinetic.Node.addGetterSetter(Kinetic.Node, 'listening', true); + Kinetic.Factory.addGetterSetter(Kinetic.Node, 'listening', true); /** * listen or don't listen to events @@ -1891,7 +1627,7 @@ * @memberof Kinetic.Node.prototype */ - Kinetic.Node.addGetterSetter(Kinetic.Node, 'visible', true); + Kinetic.Factory.addGetterSetter(Kinetic.Node, 'visible', true); /** * set visible diff --git a/src/Shape.js b/src/Shape.js index b3ab144c..c759f6ae 100644 --- a/src/Shape.js +++ b/src/Shape.js @@ -251,7 +251,7 @@ Kinetic.Util.extend(Kinetic.Shape, Kinetic.Node); // add getters and setters - Kinetic.Node.addColorGetterSetter(Kinetic.Shape, 'stroke'); + Kinetic.Factory.addColorGetterSetter(Kinetic.Shape, 'stroke'); /** * set stroke color @@ -334,7 +334,7 @@ * @memberof Kinetic.Shape.prototype */ - Kinetic.Node.addGetterSetter(Kinetic.Shape, 'lineJoin'); + Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'lineJoin'); /** * set line join @@ -353,7 +353,7 @@ */ - Kinetic.Node.addGetterSetter(Kinetic.Shape, 'lineCap'); + Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'lineCap'); /** * set line cap. Can be butt, round, or square @@ -370,7 +370,7 @@ * @memberof Kinetic.Shape.prototype */ - Kinetic.Node.addGetterSetter(Kinetic.Shape, 'strokeWidth'); + Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'strokeWidth'); /** * set stroke width @@ -387,7 +387,7 @@ * @memberof Kinetic.Shape.prototype */ - Kinetic.Node.addGetterSetter(Kinetic.Shape, 'drawFunc'); + Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'drawFunc'); /** * set draw function @@ -404,7 +404,7 @@ * @memberof Kinetic.Shape.prototype */ - Kinetic.Node.addGetterSetter(Kinetic.Shape, 'drawHitFunc'); + Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'drawHitFunc'); /** * set draw hit function used for hit detection @@ -421,7 +421,7 @@ * @memberof Kinetic.Shape.prototype */ - Kinetic.Node.addGetterSetter(Kinetic.Shape, 'dashArray'); + Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'dashArray'); /** * set dash array. @@ -444,7 +444,7 @@ * @memberof Kinetic.Shape.prototype */ - Kinetic.Node.addColorGetterSetter(Kinetic.Shape, 'shadowColor'); + Kinetic.Factory.addColorGetterSetter(Kinetic.Shape, 'shadowColor'); /** * set shadow color @@ -527,7 +527,7 @@ * @memberof Kinetic.Shape.prototype */ - Kinetic.Node.addGetterSetter(Kinetic.Shape, 'shadowBlur'); + Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'shadowBlur'); /** * set shadow blur @@ -544,7 +544,7 @@ * @memberof Kinetic.Shape.prototype */ - Kinetic.Node.addGetterSetter(Kinetic.Shape, 'shadowOpacity'); + Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'shadowOpacity'); /** * set shadow opacity @@ -561,7 +561,7 @@ * @memberof Kinetic.Shape.prototype */ - Kinetic.Node.addGetterSetter(Kinetic.Shape, 'fillPatternImage'); + Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'fillPatternImage'); /** * set fill pattern image @@ -578,7 +578,7 @@ * @memberof Kinetic.Shape.prototype */ - Kinetic.Node.addColorGetterSetter(Kinetic.Shape, 'fill'); + Kinetic.Factory.addColorGetterSetter(Kinetic.Shape, 'fill'); /** * set fill color @@ -661,7 +661,7 @@ * @memberof Kinetic.Shape.prototype */ - Kinetic.Node.addGetterSetter(Kinetic.Shape, 'fillPatternX'); + Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'fillPatternX'); /** * set fill pattern x @@ -678,7 +678,7 @@ * @memberof Kinetic.Shape.prototype */ - Kinetic.Node.addGetterSetter(Kinetic.Shape, 'fillPatternY'); + Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'fillPatternY'); /** * set fill pattern y @@ -695,7 +695,7 @@ * @memberof Kinetic.Shape.prototype */ - Kinetic.Node.addGetterSetter(Kinetic.Shape, 'fillLinearGradientColorStops'); + Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'fillLinearGradientColorStops'); /** * set fill linear gradient color stops @@ -713,7 +713,7 @@ * @param {Array} colorStops */ - Kinetic.Node.addGetterSetter(Kinetic.Shape, 'fillRadialGradientStartRadius'); + Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'fillRadialGradientStartRadius'); /** * set fill radial gradient start radius @@ -730,7 +730,7 @@ * @memberof Kinetic.Shape.prototype */ - Kinetic.Node.addGetterSetter(Kinetic.Shape, 'fillRadialGradientEndRadius'); + Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'fillRadialGradientEndRadius'); /** * set fill radial gradient end radius @@ -747,7 +747,7 @@ * @memberof Kinetic.Shape.prototype */ - Kinetic.Node.addGetterSetter(Kinetic.Shape, 'fillRadialGradientColorStops'); + Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'fillRadialGradientColorStops'); /** * set fill radial gradient color stops @@ -764,7 +764,7 @@ * @memberof Kinetic.Shape.prototype */ - Kinetic.Node.addGetterSetter(Kinetic.Shape, 'fillPatternRepeat'); + Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'fillPatternRepeat'); /** * set fill pattern repeat @@ -781,7 +781,7 @@ * @memberof Kinetic.Shape.prototype */ - Kinetic.Node.addGetterSetter(Kinetic.Shape, 'fillEnabled', true); + Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'fillEnabled', true); /** * set fill enabled @@ -798,7 +798,7 @@ * @memberof Kinetic.Shape.prototype */ - Kinetic.Node.addGetterSetter(Kinetic.Shape, 'strokeEnabled', true); + Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'strokeEnabled', true); /** * set stroke enabled @@ -815,7 +815,7 @@ * @memberof Kinetic.Shape.prototype */ - Kinetic.Node.addGetterSetter(Kinetic.Shape, 'shadowEnabled', true); + Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'shadowEnabled', true); /** * set shadow enabled @@ -832,7 +832,7 @@ * @memberof Kinetic.Shape.prototype */ - Kinetic.Node.addGetterSetter(Kinetic.Shape, 'dashArrayEnabled', true); + Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'dashArrayEnabled', true); /** * set dash array enabled @@ -849,7 +849,7 @@ * @memberof Kinetic.Shape.prototype */ - Kinetic.Node.addGetterSetter(Kinetic.Shape, 'fillPriority', 'color'); + Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'fillPriority', 'color'); /** * set fill priority @@ -867,7 +867,7 @@ * @memberof Kinetic.Shape.prototype */ - Kinetic.Node.addGetterSetter(Kinetic.Shape, 'strokeScaleEnabled', true); + Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'strokeScaleEnabled', true); /** * set stroke scale enabled @@ -884,7 +884,7 @@ * @memberof Kinetic.Shape.prototype */ - Kinetic.Node.addPointGetterSetter(Kinetic.Shape, 'fillPatternOffset', 0); + Kinetic.Factory.addPointGetterSetter(Kinetic.Shape, 'fillPatternOffset', 0); /** * set fill pattern offset @@ -945,7 +945,7 @@ * @memberof Kinetic.Shape.prototype */ - Kinetic.Node.addPointGetterSetter(Kinetic.Shape, 'fillPatternScale', 1); + Kinetic.Factory.addPointGetterSetter(Kinetic.Shape, 'fillPatternScale', 1); /** * set fill pattern scale @@ -1006,7 +1006,7 @@ * @memberof Kinetic.Shape.prototype */ - Kinetic.Node.addPointGetterSetter(Kinetic.Shape, 'fillLinearGradientStartPoint', 0); + Kinetic.Factory.addPointGetterSetter(Kinetic.Shape, 'fillLinearGradientStartPoint', 0); /** * set fill linear gradient start point @@ -1067,7 +1067,7 @@ * @memberof Kinetic.Shape.prototype */ - Kinetic.Node.addPointGetterSetter(Kinetic.Shape, 'fillLinearGradientEndPoint', 0); + Kinetic.Factory.addPointGetterSetter(Kinetic.Shape, 'fillLinearGradientEndPoint', 0); /** * set fill linear gradient end point @@ -1128,7 +1128,7 @@ * @memberof Kinetic.Shape.prototype */ - Kinetic.Node.addPointGetterSetter(Kinetic.Shape, 'fillRadialGradientStartPoint', 0); + Kinetic.Factory.addPointGetterSetter(Kinetic.Shape, 'fillRadialGradientStartPoint', 0); /** * set fill radial gradient start point @@ -1189,7 +1189,7 @@ * @memberof Kinetic.Shape.prototype */ - Kinetic.Node.addPointGetterSetter(Kinetic.Shape, 'fillRadialGradientEndPoint', 0); + Kinetic.Factory.addPointGetterSetter(Kinetic.Shape, 'fillRadialGradientEndPoint', 0); /** * set fill radial gradient end point @@ -1250,7 +1250,7 @@ * @memberof Kinetic.Shape.prototype */ - Kinetic.Node.addPointGetterSetter(Kinetic.Shape, 'shadowOffset', 0); + Kinetic.Factory.addPointGetterSetter(Kinetic.Shape, 'shadowOffset', 0); /** * set shadow offset @@ -1311,7 +1311,7 @@ * @memberof Kinetic.Shape.prototype */ - Kinetic.Node.addRotationGetterSetter(Kinetic.Shape, 'fillPatternRotation', 0); + Kinetic.Factory.addRotationGetterSetter(Kinetic.Shape, 'fillPatternRotation', 0); /** * set fill pattern rotation in radians diff --git a/src/Stage.js b/src/Stage.js index 3c015761..bbb7dd67 100644 --- a/src/Stage.js +++ b/src/Stage.js @@ -587,7 +587,7 @@ Kinetic.Util.extend(Kinetic.Stage, Kinetic.Container); // add getters and setters - Kinetic.Node.addGetter(Kinetic.Stage, 'container'); + Kinetic.Factory.addGetter(Kinetic.Stage, 'container'); /** * get container DOM element diff --git a/src/filters/Blur.js b/src/filters/Blur.js index a68ba61d..d0deb3a3 100644 --- a/src/filters/Blur.js +++ b/src/filters/Blur.js @@ -337,6 +337,6 @@ } }; - Kinetic.Node.addFilterGetterSetter(Kinetic.Image, 'filterRadius', 0); + Kinetic.Factory.addFilterGetterSetter(Kinetic.Image, 'filterRadius', 0); })(); diff --git a/src/filters/Brighten.js b/src/filters/Brighten.js index c5e58f14..d372fd89 100644 --- a/src/filters/Brighten.js +++ b/src/filters/Brighten.js @@ -18,7 +18,7 @@ } }; - Kinetic.Node.addFilterGetterSetter(Kinetic.Image, 'filterBrightness', 0); + Kinetic.Factory.addFilterGetterSetter(Kinetic.Image, 'filterBrightness', 0); /** * get filter brightness. The brightness is a number between -255 and 255.  Positive values * increase the brightness and negative values decrease the brightness, making the image darker diff --git a/src/filters/Mask.js b/src/filters/Mask.js index b6bb6dfa..97834e8d 100644 --- a/src/filters/Mask.js +++ b/src/filters/Mask.js @@ -191,7 +191,7 @@ return idata; }; - Kinetic.Node.addFilterGetterSetter(Kinetic.Image, 'filterThreshold', 0); + Kinetic.Factory.addFilterGetterSetter(Kinetic.Image, 'filterThreshold', 0); //threshold The RGB euclidian distance threshold (default : 10) diff --git a/src/plugins/Label.js b/src/plugins/Label.js index 0cb52404..562b9026 100644 --- a/src/plugins/Label.js +++ b/src/plugins/Label.js @@ -223,7 +223,7 @@ }; Kinetic.Util.extend(Kinetic.Tag, Kinetic.Shape); - Kinetic.Node.addGetterSetter(Kinetic.Tag, 'pointerDirection', NONE); + Kinetic.Factory.addGetterSetter(Kinetic.Tag, 'pointerDirection', NONE); /** * set pointer Direction @@ -241,7 +241,7 @@ * @memberof Kinetic.Tag.prototype */ - Kinetic.Node.addGetterSetter(Kinetic.Tag, 'pointerWidth', 0); + Kinetic.Factory.addGetterSetter(Kinetic.Tag, 'pointerWidth', 0); /** * set pointer width @@ -258,7 +258,7 @@ * @memberof Kinetic.Tag.prototype */ - Kinetic.Node.addGetterSetter(Kinetic.Tag, 'pointerHeight', 0); + Kinetic.Factory.addGetterSetter(Kinetic.Tag, 'pointerHeight', 0); /** * set pointer height @@ -275,7 +275,7 @@ * @memberof Kinetic.Tag.prototype */ - Kinetic.Node.addGetterSetter(Kinetic.Tag, 'cornerRadius', 0); + Kinetic.Factory.addGetterSetter(Kinetic.Tag, 'cornerRadius', 0); /** * set corner radius diff --git a/src/plugins/Path.js b/src/plugins/Path.js index fc80a822..f9616fff 100644 --- a/src/plugins/Path.js +++ b/src/plugins/Path.js @@ -551,7 +551,7 @@ return [cx, cy, rx, ry, theta, dTheta, psi, fs]; }; // add getters setters - Kinetic.Node.addGetterSetter(Kinetic.Path, 'data'); + Kinetic.Factory.addGetterSetter(Kinetic.Path, 'data'); /** * set SVG path data string. This method diff --git a/src/plugins/RegularPolygon.js b/src/plugins/RegularPolygon.js index 7bd42ac7..c2ce6be5 100644 --- a/src/plugins/RegularPolygon.js +++ b/src/plugins/RegularPolygon.js @@ -51,7 +51,7 @@ Kinetic.Util.extend(Kinetic.RegularPolygon, Kinetic.Shape); // add getters setters - Kinetic.Node.addGetterSetter(Kinetic.RegularPolygon, 'radius', 0); + Kinetic.Factory.addGetterSetter(Kinetic.RegularPolygon, 'radius', 0); /** * set radius @@ -68,7 +68,7 @@ * @memberof Kinetic.RegularPolygon.prototype */ - Kinetic.Node.addGetterSetter(Kinetic.RegularPolygon, 'sides', 0); + Kinetic.Factory.addGetterSetter(Kinetic.RegularPolygon, 'sides', 0); /** * set number of sides diff --git a/src/plugins/Star.js b/src/plugins/Star.js index bd6ae8e3..48c9fbdf 100644 --- a/src/plugins/Star.js +++ b/src/plugins/Star.js @@ -52,7 +52,7 @@ Kinetic.Util.extend(Kinetic.Star, Kinetic.Shape); // add getters setters - Kinetic.Node.addGetterSetter(Kinetic.Star, 'numPoints', 0); + Kinetic.Factory.addGetterSetter(Kinetic.Star, 'numPoints', 0); /** * set number of points @@ -69,7 +69,7 @@ * @memberof Kinetic.Star.prototype */ - Kinetic.Node.addGetterSetter(Kinetic.Star, 'innerRadius', 0); + Kinetic.Factory.addGetterSetter(Kinetic.Star, 'innerRadius', 0); /** * set inner radius @@ -86,7 +86,7 @@ * @memberof Kinetic.Star.prototype */ - Kinetic.Node.addGetterSetter(Kinetic.Star, 'outerRadius', 0); + Kinetic.Factory.addGetterSetter(Kinetic.Star, 'outerRadius', 0); /** * set outer radius diff --git a/src/plugins/TextPath.js b/src/plugins/TextPath.js index 65fdf142..acd48b81 100644 --- a/src/plugins/TextPath.js +++ b/src/plugins/TextPath.js @@ -315,7 +315,7 @@ Kinetic.Util.extend(Kinetic.TextPath, Kinetic.Shape); // add setters and getters - Kinetic.Node.addGetterSetter(Kinetic.TextPath, 'fontFamily', CALIBRI); + Kinetic.Factory.addGetterSetter(Kinetic.TextPath, 'fontFamily', CALIBRI); /** * set font family @@ -332,7 +332,7 @@ * @memberof Kinetic.TextPath.prototype */ - Kinetic.Node.addGetterSetter(Kinetic.TextPath, 'fontSize', 12); + Kinetic.Factory.addGetterSetter(Kinetic.TextPath, 'fontSize', 12); /** * set font size @@ -349,7 +349,7 @@ * @memberof Kinetic.TextPath.prototype */ - Kinetic.Node.addGetterSetter(Kinetic.TextPath, 'fontStyle', NORMAL); + Kinetic.Factory.addGetterSetter(Kinetic.TextPath, 'fontStyle', NORMAL); /** * set font style. Can be 'normal', 'italic', or 'bold'. 'normal' is the default. @@ -366,7 +366,7 @@ * @memberof Kinetic.TextPath.prototype */ - Kinetic.Node.addGetter(Kinetic.TextPath, 'text', EMPTY_STRING); + Kinetic.Factory.addGetter(Kinetic.TextPath, 'text', EMPTY_STRING); /** * get text diff --git a/src/shapes/Blob.js b/src/shapes/Blob.js index 66704119..214a8dcb 100644 --- a/src/shapes/Blob.js +++ b/src/shapes/Blob.js @@ -92,7 +92,7 @@ Kinetic.Util.extend(Kinetic.Blob, Kinetic.Shape); - Kinetic.Node.addGetterSetter(Kinetic.Blob, 'tension', 1); + Kinetic.Factory.addGetterSetter(Kinetic.Blob, 'tension', 1); /** * get tension * @name getTension @@ -107,7 +107,7 @@ * @param {Number} tension */ - Kinetic.Node.addPointsGetterSetter(Kinetic.Blob, 'points'); + Kinetic.Factory.addPointsGetterSetter(Kinetic.Blob, 'points'); /** * get points array * @method diff --git a/src/shapes/Circle.js b/src/shapes/Circle.js index 546f6f60..615b6d6d 100644 --- a/src/shapes/Circle.js +++ b/src/shapes/Circle.js @@ -67,7 +67,7 @@ Kinetic.Util.extend(Kinetic.Circle, Kinetic.Shape); // add getters setters - Kinetic.Node.addGetterSetter(Kinetic.Circle, 'radius', 0); + Kinetic.Factory.addGetterSetter(Kinetic.Circle, 'radius', 0); /** * set radius diff --git a/src/shapes/Ellipse.js b/src/shapes/Ellipse.js index 64add10d..ab681bf9 100644 --- a/src/shapes/Ellipse.js +++ b/src/shapes/Ellipse.js @@ -56,7 +56,7 @@ Kinetic.Util.extend(Kinetic.Ellipse, Kinetic.Shape); // add getters setters - Kinetic.Node.addPointGetterSetter(Kinetic.Ellipse, 'radius', 0); + Kinetic.Factory.addPointGetterSetter(Kinetic.Ellipse, 'radius', 0); /** * set radius diff --git a/src/shapes/Image.js b/src/shapes/Image.js index fd00f168..89788165 100644 --- a/src/shapes/Image.js +++ b/src/shapes/Image.js @@ -225,12 +225,12 @@ Kinetic.Util.extend(Kinetic.Image, Kinetic.Shape); - Kinetic.Node.addFilterGetterSetter = function(constructor, attr, def) { + Kinetic.Factory.addFilterGetterSetter = function(constructor, attr, def) { this.addGetter(constructor, attr, def); this.addFilterSetter(constructor, attr); }; - Kinetic.Node.addFilterSetter = function(constructor, attr) { + Kinetic.Factory.addFilterSetter = function(constructor, attr) { var that = this, method = SET + Kinetic.Util._capitalize(attr); @@ -241,7 +241,7 @@ }; // add getters setters - Kinetic.Node.addGetterSetter(Kinetic.Image, 'image'); + Kinetic.Factory.addGetterSetter(Kinetic.Image, 'image'); /** * set image @@ -258,7 +258,7 @@ * @memberof Kinetic.Image.prototype */ - Kinetic.Node.addBoxGetterSetter(Kinetic.Image, 'crop'); + Kinetic.Factory.addBoxGetterSetter(Kinetic.Image, 'crop'); /** * set crop * @method @@ -346,7 +346,7 @@ * @memberof Kinetic.Image.prototype */ - Kinetic.Node.addFilterGetterSetter(Kinetic.Image, 'filter'); + Kinetic.Factory.addFilterGetterSetter(Kinetic.Image, 'filter'); /** * set filter diff --git a/src/shapes/Line.js b/src/shapes/Line.js index 94098912..89b6ef0f 100644 --- a/src/shapes/Line.js +++ b/src/shapes/Line.js @@ -60,7 +60,7 @@ }; Kinetic.Util.extend(Kinetic.Line, Kinetic.Shape); - Kinetic.Node.addPointsGetterSetter(Kinetic.Line, 'points'); + Kinetic.Factory.addPointsGetterSetter(Kinetic.Line, 'points'); /** * set points array * @method diff --git a/src/shapes/Polygon.js b/src/shapes/Polygon.js index c28f0149..5bc69602 100644 --- a/src/shapes/Polygon.js +++ b/src/shapes/Polygon.js @@ -40,7 +40,7 @@ }; Kinetic.Util.extend(Kinetic.Polygon, Kinetic.Shape); - Kinetic.Node.addPointsGetterSetter(Kinetic.Polygon, 'points'); + Kinetic.Factory.addPointsGetterSetter(Kinetic.Polygon, 'points'); /** * set points array * @method diff --git a/src/shapes/Rect.js b/src/shapes/Rect.js index 35b67fec..b0f2a718 100644 --- a/src/shapes/Rect.js +++ b/src/shapes/Rect.js @@ -57,7 +57,7 @@ Kinetic.Util.extend(Kinetic.Rect, Kinetic.Shape); - Kinetic.Node.addGetterSetter(Kinetic.Rect, 'cornerRadius', 0); + Kinetic.Factory.addGetterSetter(Kinetic.Rect, 'cornerRadius', 0); /** * set corner radius diff --git a/src/shapes/Spline.js b/src/shapes/Spline.js index 3451af6c..f04ea7ed 100644 --- a/src/shapes/Spline.js +++ b/src/shapes/Spline.js @@ -78,7 +78,7 @@ Kinetic.Util.extend(Kinetic.Spline, Kinetic.Shape); // add getters setters - Kinetic.Node.addGetterSetter(Kinetic.Spline, 'tension', 1); + Kinetic.Factory.addGetterSetter(Kinetic.Spline, 'tension', 1); /** * get tension @@ -94,7 +94,7 @@ * @param {Number} tension */ - Kinetic.Node.addPointsGetterSetter(Kinetic.Spline, 'points'); + Kinetic.Factory.addPointsGetterSetter(Kinetic.Spline, 'points'); /** * get points array * @method diff --git a/src/shapes/Sprite.js b/src/shapes/Sprite.js index 687f449d..21669276 100644 --- a/src/shapes/Sprite.js +++ b/src/shapes/Sprite.js @@ -172,7 +172,7 @@ Kinetic.Util.extend(Kinetic.Sprite, Kinetic.Shape); // add getters setters - Kinetic.Node.addGetterSetter(Kinetic.Sprite, 'animation'); + Kinetic.Factory.addGetterSetter(Kinetic.Sprite, 'animation'); /** * set animation key @@ -189,7 +189,7 @@ * @memberof Kinetic.Sprite.prototype */ - Kinetic.Node.addGetterSetter(Kinetic.Sprite, 'animations'); + Kinetic.Factory.addGetterSetter(Kinetic.Sprite, 'animations'); /** * set animations map @@ -206,7 +206,7 @@ * @memberof Kinetic.Sprite.prototype */ - Kinetic.Node.addGetterSetter(Kinetic.Sprite, 'image'); + Kinetic.Factory.addGetterSetter(Kinetic.Sprite, 'image'); /** * set image @@ -223,7 +223,7 @@ * @memberof Kinetic.Sprite.prototype */ - Kinetic.Node.addGetterSetter(Kinetic.Sprite, 'index', 0); + Kinetic.Factory.addGetterSetter(Kinetic.Sprite, 'index', 0); /** * set animation frame index @@ -240,7 +240,7 @@ * @memberof Kinetic.Sprite.prototype */ - Kinetic.Node.addGetterSetter(Kinetic.Sprite, 'frameRate', 17); + Kinetic.Factory.addGetterSetter(Kinetic.Sprite, 'frameRate', 17); /** * set frame rate in frames / second. Default is 17 frames per second. Increase this number to make the sprite diff --git a/src/shapes/Text.js b/src/shapes/Text.js index 2b51dc10..823409a1 100644 --- a/src/shapes/Text.js +++ b/src/shapes/Text.js @@ -317,7 +317,7 @@ Kinetic.Util.extend(Kinetic.Text, Kinetic.Shape); // add getters setters - Kinetic.Node.addGetterSetter(Kinetic.Text, 'fontFamily', CALIBRI); + Kinetic.Factory.addGetterSetter(Kinetic.Text, 'fontFamily', CALIBRI); /** * set font family @@ -334,7 +334,7 @@ * @memberof Kinetic.Text.prototype */ - Kinetic.Node.addGetterSetter(Kinetic.Text, 'fontSize', 12); + Kinetic.Factory.addGetterSetter(Kinetic.Text, 'fontSize', 12); /** * set font size in pixels @@ -351,7 +351,7 @@ * @memberof Kinetic.Text.prototype */ - Kinetic.Node.addGetterSetter(Kinetic.Text, 'fontStyle', NORMAL); + Kinetic.Factory.addGetterSetter(Kinetic.Text, 'fontStyle', NORMAL); /** * set font style. Can be 'normal', 'italic', or 'bold'. 'normal' is the default. @@ -368,7 +368,7 @@ * @memberof Kinetic.Text.prototype */ - Kinetic.Node.addGetterSetter(Kinetic.Text, 'padding', 0); + Kinetic.Factory.addGetterSetter(Kinetic.Text, 'padding', 0); /** * set padding @@ -385,7 +385,7 @@ * @memberof Kinetic.Text.prototype */ - Kinetic.Node.addGetterSetter(Kinetic.Text, 'align', LEFT); + Kinetic.Factory.addGetterSetter(Kinetic.Text, 'align', LEFT); /** * set horizontal align of text @@ -402,7 +402,7 @@ * @memberof Kinetic.Text.prototype */ - Kinetic.Node.addGetterSetter(Kinetic.Text, 'lineHeight', 1); + Kinetic.Factory.addGetterSetter(Kinetic.Text, 'lineHeight', 1); /** * set line height @@ -419,7 +419,7 @@ * @memberof Kinetic.Text.prototype */ - Kinetic.Node.addGetterSetter(Kinetic.Text, 'wrap', WORD); + Kinetic.Factory.addGetterSetter(Kinetic.Text, 'wrap', WORD); /** * set wrap @@ -436,7 +436,7 @@ * @memberof Kinetic.Text.prototype */ - Kinetic.Node.addGetter(Kinetic.Text, TEXT, EMPTY_STRING); + Kinetic.Factory.addGetter(Kinetic.Text, TEXT, EMPTY_STRING); /** * get text @@ -445,7 +445,7 @@ * @memberof Kinetic.Text.prototype */ - Kinetic.Node.addSetter(Kinetic.Text, 'width'); + Kinetic.Factory.addSetter(Kinetic.Text, 'width'); /** * set width @@ -455,7 +455,7 @@ * @param {Number|String} width default is auto */ - Kinetic.Node.addSetter(Kinetic.Text, 'height'); + Kinetic.Factory.addSetter(Kinetic.Text, 'height'); /** * set height diff --git a/src/shapes/Wedge.js b/src/shapes/Wedge.js index e0397076..42555cf5 100644 --- a/src/shapes/Wedge.js +++ b/src/shapes/Wedge.js @@ -43,7 +43,7 @@ Kinetic.Util.extend(Kinetic.Wedge, Kinetic.Shape); // add getters setters - Kinetic.Node.addGetterSetter(Kinetic.Wedge, 'radius', 0); + Kinetic.Factory.addGetterSetter(Kinetic.Wedge, 'radius', 0); /** * set radius @@ -60,7 +60,7 @@ * @memberof Kinetic.Wedge.prototype */ - Kinetic.Node.addRotationGetterSetter(Kinetic.Wedge, 'angle', 0); + Kinetic.Factory.addRotationGetterSetter(Kinetic.Wedge, 'angle', 0); /** * set angle @@ -92,7 +92,7 @@ * @memberof Kinetic.Wedge.prototype */ - Kinetic.Node.addGetterSetter(Kinetic.Wedge, 'clockwise', false); + Kinetic.Factory.addGetterSetter(Kinetic.Wedge, 'clockwise', false); /** * set clockwise draw direction. If set to true, the wedge will be drawn clockwise