mirror of
https://github.com/konvajs/konva.git
synced 2025-06-28 09:48:30 +08:00
linting fixes
This commit is contained in:
parent
ba674dbbb4
commit
bd910a8bc7
174
.eslintrc
174
.eslintrc
@ -1,23 +1,173 @@
|
||||
{
|
||||
"ecmaFeatures": {
|
||||
"blockBindings": true,
|
||||
"forOf": true,
|
||||
"jsx": true
|
||||
},
|
||||
"env": {
|
||||
"browser": true,
|
||||
"node": true
|
||||
},
|
||||
"rules": {
|
||||
"semi": 2,
|
||||
"quotes": [2, "single"],
|
||||
"no-alert": 0,
|
||||
"no-array-constructor": 2,
|
||||
"no-bitwise": 0,
|
||||
"no-caller": 2,
|
||||
"no-catch-shadow": 2,
|
||||
"comma-dangle": 2,
|
||||
"no-underscore-dangle": 0,
|
||||
"no-cond-assign": 2,
|
||||
"no-console": 0,
|
||||
"no-constant-condition": 0,
|
||||
"no-continue": 0,
|
||||
"no-control-regex": 2,
|
||||
"no-debugger": 2,
|
||||
"no-delete-var": 2,
|
||||
"no-div-regex": 0,
|
||||
"no-dupe-keys": 2,
|
||||
"no-dupe-args": 2,
|
||||
"no-duplicate-case": 2,
|
||||
"no-else-return": 1,
|
||||
"no-empty": 2,
|
||||
"no-empty-class": 0,
|
||||
"no-empty-character-class": 2,
|
||||
"no-empty-label": 2,
|
||||
"no-eq-null": 2,
|
||||
"no-eval": 2,
|
||||
"no-ex-assign": 2,
|
||||
"no-extend-native": 2,
|
||||
"no-extra-bind": 2,
|
||||
"no-extra-boolean-cast": 2,
|
||||
"no-extra-parens": 0,
|
||||
"no-extra-semi": 2,
|
||||
"no-fallthrough": 2,
|
||||
"no-floating-decimal": 0,
|
||||
"no-func-assign": 2,
|
||||
"no-implied-eval": 2,
|
||||
"no-inline-comments": 0,
|
||||
"no-inner-declarations": [2, "functions"],
|
||||
"no-invalid-regexp": 2,
|
||||
"no-irregular-whitespace": 2,
|
||||
"no-iterator": 2,
|
||||
"no-label-var": 2,
|
||||
"no-labels": 2,
|
||||
"no-lone-blocks": 2,
|
||||
"no-lonely-if": 0,
|
||||
"no-loop-func": 2,
|
||||
"no-mixed-requires": [1, false],
|
||||
"no-mixed-spaces-and-tabs": [2, false],
|
||||
"linebreak-style": [1, "unix"],
|
||||
"no-multi-spaces": 2,
|
||||
"no-multi-str": 2,
|
||||
"no-multiple-empty-lines": [1, {"max": 3}],
|
||||
"no-native-reassign": 2,
|
||||
"no-negated-in-lhs": 2,
|
||||
"no-nested-ternary": 0,
|
||||
"no-new": 2,
|
||||
"no-new-func": 2,
|
||||
"no-new-object": 2,
|
||||
"no-new-require": 0,
|
||||
"no-new-wrappers": 2,
|
||||
"no-obj-calls": 2,
|
||||
"no-octal": 2,
|
||||
"no-octal-escape": 2,
|
||||
"no-param-reassign": 0,
|
||||
"no-path-concat": 0,
|
||||
"no-plusplus": 0,
|
||||
"no-process-env": 0,
|
||||
"no-process-exit": 2,
|
||||
"no-proto": 2,
|
||||
"no-redeclare": 2,
|
||||
"no-regex-spaces": 2,
|
||||
"no-reserved-keys": 0,
|
||||
"no-restricted-modules": 0,
|
||||
"no-return-assign": 2,
|
||||
"no-script-url": 2,
|
||||
"no-self-compare": 0,
|
||||
"no-sequences": 2,
|
||||
"no-shadow": 2,
|
||||
"no-shadow-restricted-names": 2,
|
||||
"no-spaced-func": 2,
|
||||
"no-sparse-arrays": 2,
|
||||
"no-sync": 0,
|
||||
"no-ternary": 0,
|
||||
"no-trailing-spaces": 2,
|
||||
"no-throw-literal": 1,
|
||||
"no-undef": 2,
|
||||
"no-undef-init": 2,
|
||||
"no-undefined": 0,
|
||||
"no-unneeded-ternary": 2,
|
||||
"no-unreachable": 2,
|
||||
"no-unused-expressions": 2,
|
||||
"no-unused-vars": [2, {"vars": "all", "args": "after-used"}],
|
||||
"no-use-before-define": 2,
|
||||
"no-void": 0,
|
||||
"no-var": 0,
|
||||
"prefer-const": 0,
|
||||
"no-warning-comments": [0, { "terms": ["todo", "fixme", "xxx"], "location": "start" }],
|
||||
"no-with": 2,
|
||||
|
||||
"accessor-pairs": 0,
|
||||
"block-scoped-var": 0,
|
||||
"brace-style": [0, "1tbs"],
|
||||
"camelcase": 1,
|
||||
"comma-dangle": [2, "never"],
|
||||
"comma-spacing": 2,
|
||||
"comma-style": 0,
|
||||
"complexity": [1, 11],
|
||||
"computed-property-spacing": [0, "never"],
|
||||
"consistent-return": 2,
|
||||
"consistent-this": [0, "that"],
|
||||
"curly": [2, "all"],
|
||||
"default-case": 0,
|
||||
"dot-location": 0,
|
||||
"dot-notation": [2, { "allowKeywords": true }],
|
||||
"eol-last": 0,
|
||||
"eqeqeq": 2,
|
||||
"func-names": 0,
|
||||
"func-style": [1, "declaration"],
|
||||
"generator-star": 0,
|
||||
"generator-star-spacing": 0,
|
||||
"guard-for-in": 1,
|
||||
"handle-callback-err": 2,
|
||||
"indent": 0,
|
||||
"key-spacing": [2, { "beforeColon": false, "afterColon": true }],
|
||||
"lines-around-comment": 0,
|
||||
"max-depth": [2, 4],
|
||||
"max-len": [2, 320, 4],
|
||||
"max-nested-callbacks": [2, 2],
|
||||
"max-params": [1, 8],
|
||||
"max-statements": [1, 20],
|
||||
"new-cap": 0,
|
||||
"new-parens": 2,
|
||||
"newline-after-var": 0,
|
||||
"object-curly-spacing": [0, "never"],
|
||||
"object-shorthand": 0,
|
||||
"one-var": 0,
|
||||
"operator-assignment": [0, "always"],
|
||||
"operator-linebreak": 0,
|
||||
"padded-blocks": 0,
|
||||
"quote-props": 0,
|
||||
"quotes": [2, "single"],
|
||||
"radix": 0,
|
||||
"semi": 2,
|
||||
"semi-spacing": [2, {"before": false, "after": true}],
|
||||
"sort-vars": 0,
|
||||
"space-after-function-name": [0, "never"],
|
||||
"space-after-keywords": [0, "always"],
|
||||
"space-before-blocks": [0, "always"],
|
||||
"space-before-function-paren": [0, "always"],
|
||||
"space-before-function-parentheses": [0, "always"],
|
||||
"space-in-brackets": [0, "never"],
|
||||
"space-in-parens": [0, "never"],
|
||||
"space-infix-ops": 2,
|
||||
"space-return-throw-case": 2,
|
||||
"space-unary-ops": [2, { "words": true, "nonwords": false }],
|
||||
"spaced-comment": 0,
|
||||
"spaced-line-comment": [0, "always"],
|
||||
"strict": 2,
|
||||
"use-isnan": 2,
|
||||
"valid-jsdoc": 0,
|
||||
"no-constant-condition": 1,
|
||||
"strict": [0, "never"],
|
||||
"camelcase": 0,
|
||||
"space-infix-ops": 0,
|
||||
"new-cap": 0
|
||||
"valid-typeof": 2,
|
||||
"vars-on-top": 0,
|
||||
"wrap-iife": 0,
|
||||
"wrap-regex": 0,
|
||||
"yoda": [2, "never"]
|
||||
},
|
||||
"globals": {
|
||||
"Konva" : false,
|
||||
|
@ -23,7 +23,8 @@
|
||||
"package.json",
|
||||
".travis.yml",
|
||||
".gitignore",
|
||||
"Gruntfile.js"
|
||||
"Gruntfile.js",
|
||||
"gulpfile.js"
|
||||
],
|
||||
"main": "konva.min.js"
|
||||
}
|
||||
|
106
konva.js
106
konva.js
@ -3,7 +3,7 @@
|
||||
* Konva JavaScript Framework v0.9.9
|
||||
* http://konvajs.github.io/
|
||||
* Licensed under the MIT or GPL Version 2 licenses.
|
||||
* Date: Mon Oct 12 2015
|
||||
* Date: Thu Oct 22 2015
|
||||
*
|
||||
* Original work Copyright (C) 2011 - 2013 by Eric Rowell (KineticJS)
|
||||
* Modified work Copyright (C) 2014 - 2015 by Anton Lavrenov (Konva)
|
||||
@ -30,7 +30,6 @@
|
||||
/**
|
||||
* @namespace Konva
|
||||
*/
|
||||
/*jshint -W079, -W020*/
|
||||
var Konva = {};
|
||||
(function(root) {
|
||||
'use strict';
|
||||
@ -114,9 +113,8 @@ var Konva = {};
|
||||
// drag and drop is not even possible
|
||||
if (dd) {
|
||||
return dd.isDragging;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
/**
|
||||
* returns whether or not a drag and drop operation is ready, but may
|
||||
@ -131,9 +129,8 @@ var Konva = {};
|
||||
// drag and drop is not even possible
|
||||
if (dd) {
|
||||
return !!dd.node;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
_addId: function(node, id) {
|
||||
if(id !== undefined) {
|
||||
@ -2138,6 +2135,9 @@ var Konva = {};
|
||||
}
|
||||
|
||||
for (key in val) {
|
||||
if (!val.hasOwnProperty(key)) {
|
||||
continue;
|
||||
}
|
||||
this._setAttr(attr + capitalize(key), val[key]);
|
||||
}
|
||||
|
||||
@ -2164,9 +2164,7 @@ var Konva = {};
|
||||
return this;
|
||||
}
|
||||
// getting
|
||||
else {
|
||||
return this[getter]();
|
||||
}
|
||||
};
|
||||
},
|
||||
addDeprecatedGetterSetter: function(constructor, attr, def, validator) {
|
||||
@ -2205,9 +2203,8 @@ var Konva = {};
|
||||
return 255;
|
||||
} else if (val < 0) {
|
||||
return 0;
|
||||
} else {
|
||||
return Math.round(val);
|
||||
}
|
||||
return Math.round(val);
|
||||
},
|
||||
alphaComponent: function(val) {
|
||||
if (val > 1) {
|
||||
@ -2217,10 +2214,9 @@ var Konva = {};
|
||||
else if (val < 0.0001) {
|
||||
return 0.0001;
|
||||
}
|
||||
else {
|
||||
|
||||
return val;
|
||||
}
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
@ -2515,7 +2511,7 @@ var Konva = {};
|
||||
getClientRect: function() {
|
||||
// abstract method
|
||||
// redefine in Container and Shape
|
||||
throw 'abstract "getClientRect" method call';
|
||||
throw new Error('abstract "getClientRect" method call');
|
||||
},
|
||||
_transformedRect: function(rect) {
|
||||
var points = [
|
||||
@ -2605,9 +2601,7 @@ var Konva = {};
|
||||
|
||||
return filterCanvas;
|
||||
}
|
||||
else {
|
||||
return sceneCanvas;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* bind events to the node. KonvaJS supports mouseover, mousemove,
|
||||
@ -2819,9 +2813,7 @@ var Konva = {};
|
||||
return this[method]();
|
||||
}
|
||||
// otherwise get directly
|
||||
else {
|
||||
return this.attrs[attr];
|
||||
}
|
||||
},
|
||||
/**
|
||||
* get ancestors
|
||||
@ -4464,6 +4456,7 @@ var Konva = {};
|
||||
})(Konva);
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
/**
|
||||
* Grayscale Filter
|
||||
* @function
|
||||
@ -4491,6 +4484,7 @@ var Konva = {};
|
||||
})();
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
/**
|
||||
* Brighten Filter.
|
||||
* @function
|
||||
@ -4531,6 +4525,7 @@ var Konva = {};
|
||||
})();
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
/**
|
||||
* Invert Filter
|
||||
* @function
|
||||
@ -4561,6 +4556,7 @@ var Konva = {};
|
||||
master repo: https://github.com/pavelpower/kineticjsGaussFilter
|
||||
*/
|
||||
(function() {
|
||||
'use strict';
|
||||
/*
|
||||
|
||||
StackBlur - a fast almost Gaussian Blur For Canvas
|
||||
@ -4916,8 +4912,9 @@ var Konva = {};
|
||||
*/
|
||||
})();
|
||||
|
||||
/*eslint-disable max-depth */
|
||||
(function() {
|
||||
|
||||
'use strict';
|
||||
function pixelAt(idata, x, y) {
|
||||
var idx = (y * idata.width + x) * 4;
|
||||
var d = [];
|
||||
@ -5115,6 +5112,7 @@ var Konva = {};
|
||||
})();
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
/**
|
||||
* RGB Filter
|
||||
* @function
|
||||
@ -5199,6 +5197,7 @@ var Konva = {};
|
||||
})();
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
/**
|
||||
* RGBA Filter
|
||||
* @function
|
||||
@ -5306,7 +5305,7 @@ var Konva = {};
|
||||
})();
|
||||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
/**
|
||||
* HSV Filter. Adjusts the hue, saturation and value
|
||||
* @function
|
||||
@ -5401,6 +5400,7 @@ var Konva = {};
|
||||
})();
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
Konva.Factory.addGetterSetter(Konva.Node, 'hue', 0, null, Konva.Factory.afterSetFilter);
|
||||
/**
|
||||
@ -5494,6 +5494,7 @@ var Konva = {};
|
||||
})();
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
/**
|
||||
* Emboss Filter.
|
||||
* Pixastic Lib - Emboss filter - v0.1.0
|
||||
@ -5675,6 +5676,7 @@ var Konva = {};
|
||||
})();
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
function remap(fromValue, fromMin, fromMax, toMin, toMax) {
|
||||
// Compute the range of the data
|
||||
var fromRange = fromMax - fromMin,
|
||||
@ -5791,7 +5793,7 @@ var Konva = {};
|
||||
})();
|
||||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
/**
|
||||
* Posterize Filter. Adjusts the channels so that there are no more
|
||||
* than n different values for that channel. This is also applied
|
||||
@ -5833,6 +5835,7 @@ var Konva = {};
|
||||
})();
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Noise Filter. Randomly adds or substracts to the color channels
|
||||
@ -5872,8 +5875,9 @@ var Konva = {};
|
||||
*/
|
||||
})();
|
||||
|
||||
/*eslint-disable max-depth */
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
/**
|
||||
* Pixelate Filter. Averages groups of pixels and redraws
|
||||
* them as larger pixels
|
||||
@ -5967,7 +5971,7 @@ var Konva = {};
|
||||
})();
|
||||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
/**
|
||||
* Threshold Filter. Pushes any value above the mid point to
|
||||
* the max and any value below the mid point to the min.
|
||||
@ -6007,6 +6011,7 @@ var Konva = {};
|
||||
})();
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
/**
|
||||
* Sepia Filter
|
||||
* Based on: Pixastic Lib - Sepia filter - v0.1.0
|
||||
@ -6052,6 +6057,7 @@ var Konva = {};
|
||||
})();
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
/**
|
||||
* Solarize Filter
|
||||
* Pixastic Lib - Solarize filter - v0.1.0
|
||||
@ -6102,6 +6108,7 @@ var Konva = {};
|
||||
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
/*
|
||||
* ToPolar Filter. Converts image data to polar coordinates. Performs
|
||||
@ -6439,7 +6446,8 @@ var Konva = {};
|
||||
getChildren: function(filterFunc) {
|
||||
if (!filterFunc) {
|
||||
return this.children;
|
||||
} else {
|
||||
}
|
||||
|
||||
var results = new Konva.Collection();
|
||||
this.children.each(function(child){
|
||||
if (filterFunc(child)) {
|
||||
@ -6447,7 +6455,6 @@ var Konva = {};
|
||||
}
|
||||
});
|
||||
return results;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* determine if node has children
|
||||
@ -9623,13 +9630,11 @@ var Konva = {};
|
||||
return {
|
||||
shape: shape
|
||||
};
|
||||
} else {
|
||||
}
|
||||
return {
|
||||
antialiased: true
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
// antialiased pixel
|
||||
else if(p3 > 0) {
|
||||
return {
|
||||
@ -9637,9 +9642,7 @@ var Konva = {};
|
||||
};
|
||||
}
|
||||
// empty pixel
|
||||
else {
|
||||
return {};
|
||||
}
|
||||
},
|
||||
drawScene: function(can, top) {
|
||||
var layer = this.getLayer(),
|
||||
@ -9898,11 +9901,10 @@ var Konva = {};
|
||||
return Konva.root.performance.now();
|
||||
};
|
||||
}
|
||||
else {
|
||||
|
||||
return function() {
|
||||
return new Date().getTime();
|
||||
};
|
||||
}
|
||||
})();
|
||||
|
||||
function FRAF(callback) {
|
||||
@ -9967,6 +9969,7 @@ var Konva = {};
|
||||
* @method
|
||||
* @memberof Konva.Animation.prototype
|
||||
* @param {Konva.Layer|Array} [layers] layer(s) to be redrawn. Can be a layer, an array of layers, or null. Not specifying a node will result in no redraw.
|
||||
* @return {Konva.Animation} this
|
||||
*/
|
||||
setLayers: function(layers) {
|
||||
var lays = [];
|
||||
@ -9986,11 +9989,13 @@ var Konva = {};
|
||||
}
|
||||
|
||||
this.layers = lays;
|
||||
return this;
|
||||
},
|
||||
/**
|
||||
* get layers
|
||||
* @method
|
||||
* @memberof Konva.Animation.prototype
|
||||
* @return {Array} Array of Konva.Layer
|
||||
*/
|
||||
getLayers: function() {
|
||||
return this.layers;
|
||||
@ -9999,7 +10004,8 @@ var Konva = {};
|
||||
* add layer. Returns true if the layer was added, and false if it was not
|
||||
* @method
|
||||
* @memberof Konva.Animation.prototype
|
||||
* @param {Konva.Layer} layer
|
||||
* @param {Konva.Layer} layer to add
|
||||
* @return {Bool} true if layer is added to animation, otherwise false
|
||||
*/
|
||||
addLayer: function(layer) {
|
||||
var layers = this.layers,
|
||||
@ -10019,6 +10025,7 @@ var Konva = {};
|
||||
* determine if animation is running or not. returns true or false
|
||||
* @method
|
||||
* @memberof Konva.Animation.prototype
|
||||
* @return {Bool} is animation running?
|
||||
*/
|
||||
isRunning: function() {
|
||||
var a = Konva.Animation,
|
||||
@ -10037,6 +10044,7 @@ var Konva = {};
|
||||
* start animation
|
||||
* @method
|
||||
* @memberof Konva.Animation.prototype
|
||||
* @return {Konva.Animation} this
|
||||
*/
|
||||
start: function() {
|
||||
var Anim = Konva.Animation;
|
||||
@ -10044,14 +10052,17 @@ var Konva = {};
|
||||
this.frame.timeDiff = 0;
|
||||
this.frame.lastTime = now();
|
||||
Anim._addAnimation(this);
|
||||
return this;
|
||||
},
|
||||
/**
|
||||
* stop animation
|
||||
* @method
|
||||
* @memberof Konva.Animation.prototype
|
||||
* @return {Konva.Animation} this
|
||||
*/
|
||||
stop: function() {
|
||||
Konva.Animation._removeAnimation(this);
|
||||
return this;
|
||||
},
|
||||
_updateFrameObject: function(time) {
|
||||
this.frame.timeDiff = time - this.frame.lastTime;
|
||||
@ -10127,12 +10138,14 @@ var Konva = {};
|
||||
}
|
||||
|
||||
for (key in layerHash) {
|
||||
if (!layerHash.hasOwnProperty(key)) {
|
||||
continue;
|
||||
}
|
||||
layerHash[key].draw();
|
||||
}
|
||||
};
|
||||
Konva.Animation._animationLoop = function() {
|
||||
var Anim = Konva.Animation;
|
||||
|
||||
if(Anim.animations.length) {
|
||||
requestAnimFrame(Anim._animationLoop);
|
||||
Anim._runFrames();
|
||||
@ -10142,10 +10155,9 @@ var Konva = {};
|
||||
}
|
||||
};
|
||||
Konva.Animation._handleAnimation = function() {
|
||||
var that = this;
|
||||
if(!this.animRunning) {
|
||||
this.animRunning = true;
|
||||
that._animationLoop();
|
||||
this._animationLoop();
|
||||
}
|
||||
};
|
||||
|
||||
@ -10157,6 +10169,7 @@ var Konva = {};
|
||||
/**
|
||||
* batch draw
|
||||
* @method
|
||||
* @return {Konva.Layer} this
|
||||
* @memberof Konva.Base.prototype
|
||||
*/
|
||||
Konva.BaseLayer.prototype.batchDraw = function() {
|
||||
@ -10177,17 +10190,20 @@ var Konva = {};
|
||||
this.draw();
|
||||
this.batchAnim.start();
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* batch draw
|
||||
* @method
|
||||
* @return {Konva.Stage} this
|
||||
* @memberof Konva.Stage.prototype
|
||||
*/
|
||||
Konva.Stage.prototype.batchDraw = function() {
|
||||
this.getChildren().each(function(layer) {
|
||||
layer.batchDraw();
|
||||
});
|
||||
return this;
|
||||
};
|
||||
})(Konva);
|
||||
|
||||
@ -11181,6 +11197,7 @@ var Konva = {};
|
||||
})();
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
/**
|
||||
* Rect constructor
|
||||
* @constructor
|
||||
@ -11328,6 +11345,7 @@ var Konva = {};
|
||||
})();
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
// the 0.0001 offset fixes a bug in Chrome 27
|
||||
var PIx2 = (Math.PI * 2) - 0.0001,
|
||||
CIRCLE = 'Circle';
|
||||
@ -11485,6 +11503,7 @@ var Konva = {};
|
||||
})();
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
// the 0.0001 offset fixes a bug in Chrome 27
|
||||
var PIx2 = (Math.PI * 2) - 0.0001,
|
||||
ELLIPSE = 'Ellipse';
|
||||
@ -11686,6 +11705,7 @@ var Konva = {};
|
||||
})();
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
// the 0.0001 offset fixes a bug in Chrome 27
|
||||
var PIx2 = (Math.PI * 2) - 0.0001;
|
||||
/**
|
||||
@ -11865,6 +11885,7 @@ var Konva = {};
|
||||
})();
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
/**
|
||||
* Wedge constructor
|
||||
* @constructor
|
||||
@ -12064,6 +12085,7 @@ var Konva = {};
|
||||
})();
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
/**
|
||||
* Arc constructor
|
||||
* @constructor
|
||||
@ -12279,7 +12301,7 @@ var Konva = {};
|
||||
})();
|
||||
|
||||
(function() {
|
||||
|
||||
'use strict';
|
||||
// CONSTANTS
|
||||
var IMAGE = 'Image';
|
||||
|
||||
@ -12572,7 +12594,9 @@ var Konva = {};
|
||||
};
|
||||
})();
|
||||
|
||||
/*eslint-disable max-depth */
|
||||
(function() {
|
||||
'use strict';
|
||||
// constants
|
||||
var AUTO = 'auto',
|
||||
//CANVAS = 'canvas',
|
||||
@ -13130,6 +13154,7 @@ var Konva = {};
|
||||
})();
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
/**
|
||||
* Line constructor. Lines are defined by an array of points and
|
||||
* a tension
|
||||
@ -13439,6 +13464,7 @@ var Konva = {};
|
||||
})();
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
/**
|
||||
* Sprite constructor
|
||||
* @constructor
|
||||
@ -13847,8 +13873,9 @@ var Konva = {};
|
||||
Konva.Collection.mapMethods(Konva.Sprite);
|
||||
})();
|
||||
|
||||
/*eslint-disable no-shadow*/
|
||||
/*eslint-disable no-shadow, max-len, max-depth */
|
||||
(function () {
|
||||
'use strict';
|
||||
/**
|
||||
* Path constructor.
|
||||
* @author Jason Follas
|
||||
@ -14567,6 +14594,7 @@ var Konva = {};
|
||||
})();
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
var EMPTY_STRING = '',
|
||||
//CALIBRI = 'Calibri',
|
||||
NORMAL = 'normal';
|
||||
@ -15077,6 +15105,7 @@ var Konva = {};
|
||||
})();
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
/**
|
||||
* RegularPolygon constructor. Examples include triangles, squares, pentagons, hexagons, etc.
|
||||
* @constructor
|
||||
@ -15258,6 +15287,7 @@ var Konva = {};
|
||||
})();
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
/**
|
||||
* Star constructor
|
||||
* @constructor
|
||||
@ -15461,6 +15491,7 @@ var Konva = {};
|
||||
})();
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
// constants
|
||||
var ATTR_CHANGE_LIST = ['fontFamily', 'fontSize', 'fontStyle', 'padding', 'lineHeight', 'text'],
|
||||
CHANGE_KONVA = 'Change.konva',
|
||||
@ -15827,6 +15858,7 @@ var Konva = {};
|
||||
})();
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
/**
|
||||
* Arrow constructor
|
||||
* @constructor
|
||||
|
12
konva.min.js
vendored
12
konva.min.js
vendored
File diff suppressed because one or more lines are too long
@ -8,11 +8,10 @@
|
||||
return Konva.root.performance.now();
|
||||
};
|
||||
}
|
||||
else {
|
||||
|
||||
return function() {
|
||||
return new Date().getTime();
|
||||
};
|
||||
}
|
||||
})();
|
||||
|
||||
function FRAF(callback) {
|
||||
@ -77,6 +76,7 @@
|
||||
* @method
|
||||
* @memberof Konva.Animation.prototype
|
||||
* @param {Konva.Layer|Array} [layers] layer(s) to be redrawn. Can be a layer, an array of layers, or null. Not specifying a node will result in no redraw.
|
||||
* @return {Konva.Animation} this
|
||||
*/
|
||||
setLayers: function(layers) {
|
||||
var lays = [];
|
||||
@ -96,11 +96,13 @@
|
||||
}
|
||||
|
||||
this.layers = lays;
|
||||
return this;
|
||||
},
|
||||
/**
|
||||
* get layers
|
||||
* @method
|
||||
* @memberof Konva.Animation.prototype
|
||||
* @return {Array} Array of Konva.Layer
|
||||
*/
|
||||
getLayers: function() {
|
||||
return this.layers;
|
||||
@ -109,7 +111,8 @@
|
||||
* add layer. Returns true if the layer was added, and false if it was not
|
||||
* @method
|
||||
* @memberof Konva.Animation.prototype
|
||||
* @param {Konva.Layer} layer
|
||||
* @param {Konva.Layer} layer to add
|
||||
* @return {Bool} true if layer is added to animation, otherwise false
|
||||
*/
|
||||
addLayer: function(layer) {
|
||||
var layers = this.layers,
|
||||
@ -129,6 +132,7 @@
|
||||
* determine if animation is running or not. returns true or false
|
||||
* @method
|
||||
* @memberof Konva.Animation.prototype
|
||||
* @return {Bool} is animation running?
|
||||
*/
|
||||
isRunning: function() {
|
||||
var a = Konva.Animation,
|
||||
@ -147,6 +151,7 @@
|
||||
* start animation
|
||||
* @method
|
||||
* @memberof Konva.Animation.prototype
|
||||
* @return {Konva.Animation} this
|
||||
*/
|
||||
start: function() {
|
||||
var Anim = Konva.Animation;
|
||||
@ -154,14 +159,17 @@
|
||||
this.frame.timeDiff = 0;
|
||||
this.frame.lastTime = now();
|
||||
Anim._addAnimation(this);
|
||||
return this;
|
||||
},
|
||||
/**
|
||||
* stop animation
|
||||
* @method
|
||||
* @memberof Konva.Animation.prototype
|
||||
* @return {Konva.Animation} this
|
||||
*/
|
||||
stop: function() {
|
||||
Konva.Animation._removeAnimation(this);
|
||||
return this;
|
||||
},
|
||||
_updateFrameObject: function(time) {
|
||||
this.frame.timeDiff = time - this.frame.lastTime;
|
||||
@ -237,12 +245,14 @@
|
||||
}
|
||||
|
||||
for (key in layerHash) {
|
||||
if (!layerHash.hasOwnProperty(key)) {
|
||||
continue;
|
||||
}
|
||||
layerHash[key].draw();
|
||||
}
|
||||
};
|
||||
Konva.Animation._animationLoop = function() {
|
||||
var Anim = Konva.Animation;
|
||||
|
||||
if(Anim.animations.length) {
|
||||
requestAnimFrame(Anim._animationLoop);
|
||||
Anim._runFrames();
|
||||
@ -252,10 +262,9 @@
|
||||
}
|
||||
};
|
||||
Konva.Animation._handleAnimation = function() {
|
||||
var that = this;
|
||||
if(!this.animRunning) {
|
||||
this.animRunning = true;
|
||||
that._animationLoop();
|
||||
this._animationLoop();
|
||||
}
|
||||
};
|
||||
|
||||
@ -267,6 +276,7 @@
|
||||
/**
|
||||
* batch draw
|
||||
* @method
|
||||
* @return {Konva.Layer} this
|
||||
* @memberof Konva.Base.prototype
|
||||
*/
|
||||
Konva.BaseLayer.prototype.batchDraw = function() {
|
||||
@ -287,16 +297,19 @@
|
||||
this.draw();
|
||||
this.batchAnim.start();
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* batch draw
|
||||
* @method
|
||||
* @return {Konva.Stage} this
|
||||
* @memberof Konva.Stage.prototype
|
||||
*/
|
||||
Konva.Stage.prototype.batchDraw = function() {
|
||||
this.getChildren().each(function(layer) {
|
||||
layer.batchDraw();
|
||||
});
|
||||
return this;
|
||||
};
|
||||
})(Konva);
|
||||
|
@ -45,7 +45,8 @@
|
||||
getChildren: function(filterFunc) {
|
||||
if (!filterFunc) {
|
||||
return this.children;
|
||||
} else {
|
||||
}
|
||||
|
||||
var results = new Konva.Collection();
|
||||
this.children.each(function(child){
|
||||
if (filterFunc(child)) {
|
||||
@ -53,7 +54,6 @@
|
||||
}
|
||||
});
|
||||
return results;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* determine if node has children
|
||||
|
@ -64,6 +64,9 @@
|
||||
}
|
||||
|
||||
for (key in val) {
|
||||
if (!val.hasOwnProperty(key)) {
|
||||
continue;
|
||||
}
|
||||
this._setAttr(attr + capitalize(key), val[key]);
|
||||
}
|
||||
|
||||
@ -90,9 +93,7 @@
|
||||
return this;
|
||||
}
|
||||
// getting
|
||||
else {
|
||||
return this[getter]();
|
||||
}
|
||||
};
|
||||
},
|
||||
addDeprecatedGetterSetter: function(constructor, attr, def, validator) {
|
||||
@ -131,9 +132,8 @@
|
||||
return 255;
|
||||
} else if (val < 0) {
|
||||
return 0;
|
||||
} else {
|
||||
return Math.round(val);
|
||||
}
|
||||
return Math.round(val);
|
||||
},
|
||||
alphaComponent: function(val) {
|
||||
if (val > 1) {
|
||||
@ -143,9 +143,8 @@
|
||||
else if (val < 0.0001) {
|
||||
return 0.0001;
|
||||
}
|
||||
else {
|
||||
|
||||
return val;
|
||||
}
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
@ -30,7 +30,6 @@
|
||||
/**
|
||||
* @namespace Konva
|
||||
*/
|
||||
/*jshint -W079, -W020*/
|
||||
var Konva = {};
|
||||
(function(root) {
|
||||
'use strict';
|
||||
@ -114,9 +113,8 @@ var Konva = {};
|
||||
// drag and drop is not even possible
|
||||
if (dd) {
|
||||
return dd.isDragging;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
/**
|
||||
* returns whether or not a drag and drop operation is ready, but may
|
||||
@ -131,9 +129,8 @@ var Konva = {};
|
||||
// drag and drop is not even possible
|
||||
if (dd) {
|
||||
return !!dd.node;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
_addId: function(node, id) {
|
||||
if(id !== undefined) {
|
||||
|
@ -140,13 +140,11 @@
|
||||
return {
|
||||
shape: shape
|
||||
};
|
||||
} else {
|
||||
}
|
||||
return {
|
||||
antialiased: true
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
// antialiased pixel
|
||||
else if(p3 > 0) {
|
||||
return {
|
||||
@ -154,9 +152,7 @@
|
||||
};
|
||||
}
|
||||
// empty pixel
|
||||
else {
|
||||
return {};
|
||||
}
|
||||
},
|
||||
drawScene: function(can, top) {
|
||||
var layer = this.getLayer(),
|
||||
|
@ -270,7 +270,7 @@
|
||||
getClientRect: function() {
|
||||
// abstract method
|
||||
// redefine in Container and Shape
|
||||
throw 'abstract "getClientRect" method call';
|
||||
throw new Error('abstract "getClientRect" method call');
|
||||
},
|
||||
_transformedRect: function(rect) {
|
||||
var points = [
|
||||
@ -360,9 +360,7 @@
|
||||
|
||||
return filterCanvas;
|
||||
}
|
||||
else {
|
||||
return sceneCanvas;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* bind events to the node. KonvaJS supports mouseover, mousemove,
|
||||
@ -574,9 +572,7 @@
|
||||
return this[method]();
|
||||
}
|
||||
// otherwise get directly
|
||||
else {
|
||||
return this.attrs[attr];
|
||||
}
|
||||
},
|
||||
/**
|
||||
* get ancestors
|
||||
|
@ -3,6 +3,7 @@
|
||||
master repo: https://github.com/pavelpower/kineticjsGaussFilter
|
||||
*/
|
||||
(function() {
|
||||
'use strict';
|
||||
/*
|
||||
|
||||
StackBlur - a fast almost Gaussian Blur For Canvas
|
||||
|
@ -1,4 +1,5 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
/**
|
||||
* Brighten Filter.
|
||||
* @function
|
||||
|
@ -1,4 +1,5 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
/**
|
||||
* Emboss Filter.
|
||||
* Pixastic Lib - Emboss filter - v0.1.0
|
||||
|
@ -1,4 +1,5 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
function remap(fromValue, fromMin, fromMax, toMin, toMax) {
|
||||
// Compute the range of the data
|
||||
var fromRange = fromMax - fromMin,
|
||||
|
@ -1,4 +1,5 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
/**
|
||||
* Grayscale Filter
|
||||
* @function
|
||||
|
@ -1,4 +1,5 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
Konva.Factory.addGetterSetter(Konva.Node, 'hue', 0, null, Konva.Factory.afterSetFilter);
|
||||
/**
|
||||
|
@ -1,5 +1,5 @@
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
/**
|
||||
* HSV Filter. Adjusts the hue, saturation and value
|
||||
* @function
|
||||
|
@ -1,4 +1,5 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
/**
|
||||
* Invert Filter
|
||||
* @function
|
||||
|
@ -1,4 +1,5 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
/*
|
||||
* ToPolar Filter. Converts image data to polar coordinates. Performs
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*eslint-disable max-depth */
|
||||
(function() {
|
||||
|
||||
'use strict';
|
||||
function pixelAt(idata, x, y) {
|
||||
var idx = (y * idata.width + x) * 4;
|
||||
var d = [];
|
||||
|
@ -1,4 +1,5 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Noise Filter. Randomly adds or substracts to the color channels
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*eslint-disable max-depth */
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
/**
|
||||
* Pixelate Filter. Averages groups of pixels and redraws
|
||||
* them as larger pixels
|
||||
|
@ -1,5 +1,5 @@
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
/**
|
||||
* Posterize Filter. Adjusts the channels so that there are no more
|
||||
* than n different values for that channel. This is also applied
|
||||
|
@ -1,4 +1,5 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
/**
|
||||
* RGB Filter
|
||||
* @function
|
||||
|
@ -1,4 +1,5 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
/**
|
||||
* RGBA Filter
|
||||
* @function
|
||||
|
@ -1,4 +1,5 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
/**
|
||||
* Sepia Filter
|
||||
* Based on: Pixastic Lib - Sepia filter - v0.1.0
|
||||
|
@ -1,4 +1,5 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
/**
|
||||
* Solarize Filter
|
||||
* Pixastic Lib - Solarize filter - v0.1.0
|
||||
|
@ -1,5 +1,5 @@
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
/**
|
||||
* Threshold Filter. Pushes any value above the mid point to
|
||||
* the max and any value below the mid point to the min.
|
||||
|
@ -1,4 +1,5 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
/**
|
||||
* Arrow constructor
|
||||
* @constructor
|
||||
|
@ -1,4 +1,5 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
// constants
|
||||
var ATTR_CHANGE_LIST = ['fontFamily', 'fontSize', 'fontStyle', 'padding', 'lineHeight', 'text'],
|
||||
CHANGE_KONVA = 'Change.konva',
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*eslint-disable no-shadow*/
|
||||
/*eslint-disable no-shadow, max-len, max-depth */
|
||||
(function () {
|
||||
'use strict';
|
||||
/**
|
||||
* Path constructor.
|
||||
* @author Jason Follas
|
||||
|
@ -1,4 +1,5 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
/**
|
||||
* RegularPolygon constructor. Examples include triangles, squares, pentagons, hexagons, etc.
|
||||
* @constructor
|
||||
|
@ -1,4 +1,5 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
/**
|
||||
* Star constructor
|
||||
* @constructor
|
||||
|
@ -1,4 +1,5 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
var EMPTY_STRING = '',
|
||||
//CALIBRI = 'Calibri',
|
||||
NORMAL = 'normal';
|
||||
|
@ -1,4 +1,5 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
/**
|
||||
* Arc constructor
|
||||
* @constructor
|
||||
|
@ -1,4 +1,5 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
// the 0.0001 offset fixes a bug in Chrome 27
|
||||
var PIx2 = (Math.PI * 2) - 0.0001,
|
||||
CIRCLE = 'Circle';
|
||||
|
@ -1,4 +1,5 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
// the 0.0001 offset fixes a bug in Chrome 27
|
||||
var PIx2 = (Math.PI * 2) - 0.0001,
|
||||
ELLIPSE = 'Ellipse';
|
||||
|
@ -1,5 +1,5 @@
|
||||
(function() {
|
||||
|
||||
'use strict';
|
||||
// CONSTANTS
|
||||
var IMAGE = 'Image';
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
/**
|
||||
* Line constructor. Lines are defined by an array of points and
|
||||
* a tension
|
||||
|
@ -1,4 +1,5 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
/**
|
||||
* Rect constructor
|
||||
* @constructor
|
||||
|
@ -1,4 +1,5 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
// the 0.0001 offset fixes a bug in Chrome 27
|
||||
var PIx2 = (Math.PI * 2) - 0.0001;
|
||||
/**
|
||||
|
@ -1,4 +1,5 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
/**
|
||||
* Sprite constructor
|
||||
* @constructor
|
||||
|
@ -1,4 +1,6 @@
|
||||
/*eslint-disable max-depth */
|
||||
(function() {
|
||||
'use strict';
|
||||
// constants
|
||||
var AUTO = 'auto',
|
||||
//CANVAS = 'canvas',
|
||||
|
@ -1,4 +1,5 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
/**
|
||||
* Wedge constructor
|
||||
* @constructor
|
||||
|
Loading…
Reference in New Issue
Block a user