From 3544b727bee099546aeeaa134a877e10a9550054 Mon Sep 17 00:00:00 2001 From: neopheus Date: Sat, 20 Aug 2016 17:58:16 +0200 Subject: [PATCH] Update code v2 (#3180) * update JSDOC - v4 * update JSDOC -v5 --- src/filters/resize_filter.class.js | 11 +++++++++++ src/shapes/ellipse.class.js | 2 +- src/shapes/group.class.js | 2 +- src/shapes/image.class.js | 4 ++++ src/shapes/itext.class.js | 2 +- src/shapes/line.class.js | 1 + src/shapes/path_group.class.js | 2 +- src/shapes/polygon.class.js | 2 ++ src/shapes/polyline.class.js | 1 + src/shapes/rect.class.js | 1 + src/shapes/text.class.js | 2 ++ src/util/lang_array.js | 8 ++++---- src/util/misc.js | 2 ++ 13 files changed, 32 insertions(+), 8 deletions(-) diff --git a/src/filters/resize_filter.class.js b/src/filters/resize_filter.class.js index 3baa0039..49d92954 100644 --- a/src/filters/resize_filter.class.js +++ b/src/filters/resize_filter.class.js @@ -58,6 +58,8 @@ * Applies filter to canvas element * @memberOf fabric.Image.filters.Resize.prototype * @param {Object} canvasEl Canvas element to apply filter to + * @param {Number} scaleX + * @param {Number} scaleY */ applyTo: function(canvasEl, scaleX, scaleY) { @@ -85,6 +87,15 @@ canvasEl.getContext('2d').putImageData(imageData, 0, 0); }, + /** + * Filter sliceByTwo + * @param {Object} canvasEl Canvas element to apply filter to + * @param {Number} width + * @param {Number} height + * @param {Number} newWidth + * @param {Number} newHeight + * @returns {ImageData} + */ sliceByTwo: function(canvasEl, width, height, newWidth, newHeight) { var context = canvasEl.getContext('2d'), imageData, multW = 0.5, multH = 0.5, signW = 1, signH = 1, diff --git a/src/shapes/ellipse.class.js b/src/shapes/ellipse.class.js index f9b7b137..89832c16 100644 --- a/src/shapes/ellipse.class.js +++ b/src/shapes/ellipse.class.js @@ -58,7 +58,7 @@ /** * @private * @param {String} key - * @param {Any} value + * @param {*} value * @return {fabric.Ellipse} thisArg */ _set: function(key, value) { diff --git a/src/shapes/group.class.js b/src/shapes/group.class.js index 8eb5c1d9..27d7cd9a 100644 --- a/src/shapes/group.class.js +++ b/src/shapes/group.class.js @@ -493,7 +493,7 @@ /** * Returns requested property * @param {String} prop Property to get - * @return {Any} + * @return {*} */ get: function(prop) { if (prop in _lockProperties) { diff --git a/src/shapes/image.class.js b/src/shapes/image.class.js index 24db86a9..4e165635 100644 --- a/src/shapes/image.class.js +++ b/src/shapes/image.class.js @@ -337,6 +337,9 @@ * Applies filters assigned to this image (from "filters" array) * @method applyFilters * @param {Function} callback Callback is invoked when all filters have been applied and new image is generated + * @param {Array} filters to be initialized + * @param {fabric.Image} imgElement + * @param {Boolean} forResizing * @return {fabric.Image} thisArg * @chainable */ @@ -397,6 +400,7 @@ /** * @private * @param {CanvasRenderingContext2D} ctx Context to render on + * @param {Boolean} noTransform */ _render: function(ctx, noTransform) { var x, y, imageMargins = this._findMargins(), elementToDraw; diff --git a/src/shapes/itext.class.js b/src/shapes/itext.class.js index dc8dae70..eb4d718e 100644 --- a/src/shapes/itext.class.js +++ b/src/shapes/itext.class.js @@ -585,7 +585,7 @@ * @private * @param {String} method * @param {CanvasRenderingContext2D} ctx Context to render on - * @param {Number} line + * @param {String} line Content of the line * @param {Number} left * @param {Number} top * @param {Number} lineIndex diff --git a/src/shapes/line.class.js b/src/shapes/line.class.js index 4786742f..28330435 100644 --- a/src/shapes/line.class.js +++ b/src/shapes/line.class.js @@ -149,6 +149,7 @@ /** * @private * @param {CanvasRenderingContext2D} ctx Context to render on + * @param {Boolean} noTransform */ _render: function(ctx, noTransform) { ctx.beginPath(); diff --git a/src/shapes/path_group.class.js b/src/shapes/path_group.class.js index 2cce0c2c..bccc8ee6 100644 --- a/src/shapes/path_group.class.js +++ b/src/shapes/path_group.class.js @@ -122,7 +122,7 @@ /** * Sets certain property to a certain value * @param {String} prop - * @param {Any} value + * @param {*} value * @return {fabric.PathGroup} thisArg */ _set: function(prop, value) { diff --git a/src/shapes/polygon.class.js b/src/shapes/polygon.class.js index a1a001bd..90bd4f27 100644 --- a/src/shapes/polygon.class.js +++ b/src/shapes/polygon.class.js @@ -133,6 +133,7 @@ /** * @private * @param {CanvasRenderingContext2D} ctx Context to render on + * @param {Boolean} noTransform */ _render: function(ctx, noTransform) { if (!this.commonRender(ctx, noTransform)) { @@ -148,6 +149,7 @@ /** * @private * @param {CanvasRenderingContext2D} ctx Context to render on + * @param {Boolean} noTransform */ commonRender: function(ctx, noTransform) { var point, len = this.points.length; diff --git a/src/shapes/polyline.class.js b/src/shapes/polyline.class.js index 5602a541..9462dce8 100644 --- a/src/shapes/polyline.class.js +++ b/src/shapes/polyline.class.js @@ -98,6 +98,7 @@ /** * @private * @param {CanvasRenderingContext2D} ctx Context to render on + * @param {Boolean} noTransform */ _render: function(ctx, noTransform) { if (!fabric.Polygon.prototype.commonRender.call(this, ctx, noTransform)) { diff --git a/src/shapes/rect.class.js b/src/shapes/rect.class.js index 64816331..dc8f57f3 100644 --- a/src/shapes/rect.class.js +++ b/src/shapes/rect.class.js @@ -85,6 +85,7 @@ /** * @private * @param {CanvasRenderingContext2D} ctx Context to render on + * @param {Boolean} noTransform */ _render: function(ctx, noTransform) { diff --git a/src/shapes/text.class.js b/src/shapes/text.class.js index a1b6f77f..e4ff78c4 100644 --- a/src/shapes/text.class.js +++ b/src/shapes/text.class.js @@ -559,6 +559,7 @@ /** * @private * @param {CanvasRenderingContext2D} ctx Context to render on + * @param {String} method Method name ("fillText" or "strokeText") */ _renderTextCommon: function(ctx, method) { @@ -858,6 +859,7 @@ /** * Renders text instance on a specified context * @param {CanvasRenderingContext2D} ctx Context to render on + * @param {Boolean} noTransform */ render: function(ctx, noTransform) { // do not render if object is not visible diff --git a/src/util/lang_array.js b/src/util/lang_array.js index 9e0e2526..bebb5714 100644 --- a/src/util/lang_array.js +++ b/src/util/lang_array.js @@ -7,7 +7,7 @@ if (!Array.prototype.indexOf) { /** * Finds index of an element in an array - * @param {Any} searchElement + * @param {*} searchElement * @return {Number} */ Array.prototype.indexOf = function (searchElement /*, fromIndex */ ) { @@ -134,7 +134,7 @@ /** * Returns "folded" (reduced) result of iterating over elements in an array * @param {Function} fn Callback to invoke for each element - * @return {Any} + * @return {*} */ Array.prototype.reduce = function(fn /*, initial*/) { var len = this.length >>> 0, @@ -188,7 +188,7 @@ * @memberOf fabric.util.array * @param {Array} array Array to iterate over * @param {String} byProperty - * @return {Any} + * @return {*} */ function max(array, byProperty) { return find(array, byProperty, function(value1, value2) { @@ -201,7 +201,7 @@ * @memberOf fabric.util.array * @param {Array} array Array to iterate over * @param {String} byProperty - * @return {Any} + * @return {*} */ function min(array, byProperty) { return find(array, byProperty, function(value1, value2) { diff --git a/src/util/misc.js b/src/util/misc.js index 097f1cdf..71d47a89 100644 --- a/src/util/misc.js +++ b/src/util/misc.js @@ -173,6 +173,7 @@ * Converts from attribute value to pixel value if applicable. * Returns converted pixels or original value not converted. * @param {Number|String} value number to operate on + * @param {Number} fontSize * @return {Number|String} */ parseUnit: function(value, fontSize) { @@ -348,6 +349,7 @@ * @memberOf fabric.util * @param {Array} elements SVG elements to group * @param {Object} [options] Options object + * @param {String} path Value to set sourcePath to * @return {fabric.Object|fabric.PathGroup} */ groupSVGElements: function(elements, options, path) {