diff --git a/src/color.class.js b/src/color.class.js index 1d10641c..6ee4e320 100644 --- a/src/color.class.js +++ b/src/color.class.js @@ -184,7 +184,7 @@ /** * Sets value of alpha channel for this color - * @param {Number} alpha 0-1 + * @param {Number} alpha Alpha value 0-1 * @return {fabric.Color} thisArg */ setAlpha: function(alpha) { @@ -319,7 +319,7 @@ /** * Returns new color object, when given a color in RGB format * @memberOf fabric.Color - * @param {String} color ex: rgb(0-255,0-255,0-255) + * @param {String} color Color value ex: rgb(0-255,0-255,0-255) * @return {fabric.Color} */ fabric.Color.fromRgb = function(color) { @@ -329,7 +329,7 @@ /** * Returns array represenatation (ex: [100, 100, 200, 1]) of a color that's in RGB or RGBA format * @memberOf fabric.Color - * @param {String} color ex: rgb(0-255,0-255,0-255), rgb(0%-100%,0%-100%,0%-100%) + * @param {String} color Color value ex: rgb(0-255,0-255,0-255), rgb(0%-100%,0%-100%,0%-100%) * @return {Array} source */ fabric.Color.sourceFromRgb = function(color) { @@ -360,7 +360,7 @@ /** * Returns new color object, when given a color in HSL format - * @param {String} color ex: hsl(0-260,0%-100%,0%-100%) + * @param {String} color Color value ex: hsl(0-260,0%-100%,0%-100%) * @memberOf fabric.Color * @return {fabric.Color} */ @@ -372,7 +372,7 @@ * Returns array represenatation (ex: [100, 100, 200, 1]) of a color that's in HSL or HSLA format. * Adapted from https://github.com/mjijackson * @memberOf fabric.Color - * @param {String} color ex: hsl(0-360,0%-100%,0%-100%) or hsla(0-360,0%-100%,0%-100%, 0-1) + * @param {String} color Color value ex: hsl(0-360,0%-100%,0%-100%) or hsla(0-360,0%-100%,0%-100%, 0-1) * @return {Array} source * @see http://http://www.w3.org/TR/css3-color/#hsl-color */ @@ -419,6 +419,7 @@ * Returns new color object, when given a color in HEX format * @static * @memberOf fabric.Color + * @param {String} color Color value ex: FF5555 * @return {fabric.Color} */ fabric.Color.fromHex = function(color) { diff --git a/src/gradient.class.js b/src/gradient.class.js index 939fb84d..3883d5d5 100644 --- a/src/gradient.class.js +++ b/src/gradient.class.js @@ -181,7 +181,7 @@ /** * Returns an instance of CanvasGradient - * @param ctx + * @param {CanvasRenderingContext2D} ctx Context to render on * @return {CanvasGradient} */ toLive: function(ctx) { @@ -221,7 +221,8 @@ * @static * @memberof fabric.Gradient * @param {SVGGradientElement} el SVG gradient element - * @param {Object} instance + * @param {fabric.Object} instance + * @return {fabric.Gradient} Gradient instance * @see http://www.w3.org/TR/SVG/pservers.html#LinearGradientElement * @see http://www.w3.org/TR/SVG/pservers.html#RadialGradientElement */ diff --git a/src/mixins/animation.mixin.js b/src/mixins/animation.mixin.js index 4e04a78a..f213f9b2 100644 --- a/src/mixins/animation.mixin.js +++ b/src/mixins/animation.mixin.js @@ -11,6 +11,8 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, /** @lends fabric.Stati * Centers object horizontally with animation. * @param {fabric.Object} object Object to center * @param {Object} [callbacks] Callbacks object with optional "onComplete" and/or "onChange" properties + * @param {Function} [callbacks.onComplete] Invoked on completion + * @param {Function} [callbacks.onChange] Invoked on every step of animation * @return {fabric.Canvas} thisArg * @chainable */ @@ -44,6 +46,8 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, /** @lends fabric.Stati * Centers object vertically with animation. * @param {fabric.Object} object Object to center * @param {Object} [callbacks] Callbacks object with optional "onComplete" and/or "onChange" properties + * @param {Function} [callbacks.onComplete] Invoked on completion + * @param {Function} [callbacks.onChange] Invoked on every step of animation * @return {fabric.Canvas} thisArg * @chainable */ @@ -76,7 +80,9 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, /** @lends fabric.Stati /** * Same as `fabric.Canvas#remove` but animated * @param {fabric.Object} object Object to remove - * @param {Function} callback Callback, invoked on effect completion + * @param {Object} [callbacks] Callbacks object with optional "onComplete" and/or "onChange" properties + * @param {Function} [callbacks.onComplete] Invoked on completion + * @param {Function} [callbacks.onChange] Invoked on every step of animation * @return {fabric.Canvas} thisArg * @chainable */ diff --git a/src/mixins/canvas_dataurl_exporter.mixin.js b/src/mixins/canvas_dataurl_exporter.mixin.js index 816f9338..c481b650 100644 --- a/src/mixins/canvas_dataurl_exporter.mixin.js +++ b/src/mixins/canvas_dataurl_exporter.mixin.js @@ -2,17 +2,15 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, /** @lends fabric.Stati /** * Exports canvas element to a dataurl image. Note that when multiplier is used, cropping is scaled appropriately - * @param {Object} options - * - * `format` the format of the output image. Either "jpeg" or "png". - * `quality` quality level (0..1) - * `multiplier` multiplier to scale by {Number} - * `left` cropping left offset - * `top` cropping top offset - * `width` cropping width - * `height` cropping height - * - * @return {String} + * @param {Object} [options] Options object + * @param {String} [options.format=png] The format of the output image. Either "jpeg" or "png" + * @param {Number} [options.quality=1] Quality level (0..1). Only used for jpeg. + * @param {Number} [options.multiplier=1] Multiplier to scale by + * @param {Number} [options.left] Cropping left offset + * @param {Number} [options.top] Cropping top offset + * @param {Number} [options.width] Cropping width + * @param {Number} [options.height] Cropping height + * @return {String} Returns a data: URL containing a representation of the object in the format specified by options.format */ toDataURL: function (options) { options || (options = { }); diff --git a/src/mixins/object_straightening.mixin.js b/src/mixins/object_straightening.mixin.js index 7c572369..1ec7ce23 100644 --- a/src/mixins/object_straightening.mixin.js +++ b/src/mixins/object_straightening.mixin.js @@ -23,11 +23,10 @@ fabric.util.object.extend(fabric.Object.prototype, /** @lends fabric.Object.prot }, /** - * Same as {@link fabric.Object.prototype.straghten} but with animation - * @param {Object} callbacks - * - onComplete: invoked on completion - * - onChange: invoked on every step of animation - * + * Same as {@link fabric.Object.prototype.straighten} but with animation + * @param {Object} callbacks Object with callback functions + * @param {Function} [callbacks.onComplete] Invoked on completion + * @param {Function} [callbacks.onChange] Invoked on every step of animation * @return {fabric.Object} thisArg * @chainable */ diff --git a/src/pattern.class.js b/src/pattern.class.js index fa5e302f..22a490cf 100644 --- a/src/pattern.class.js +++ b/src/pattern.class.js @@ -5,7 +5,7 @@ fabric.Pattern = fabric.util.createClass(/** @lends fabric.Pattern.prototype */ { /** - * Repeat property of a pattern (one of repeat, repeat-x, repeat-y) + * Repeat property of a pattern (one of repeat, repeat-x, repeat-y or no-repeat) * @type String * @default */ @@ -94,7 +94,7 @@ fabric.Pattern = fabric.util.createClass(/** @lends fabric.Pattern.prototype */ /* _TO_SVG_START_ */ /** * Returns SVG representation of a pattern - * @param {Object} object + * @param {fabric.Object} object * @return {String} SVG representation of a pattern */ toSVG: function(object) { diff --git a/src/shadow.class.js b/src/shadow.class.js index 24d22d3f..17910d1b 100644 --- a/src/shadow.class.js +++ b/src/shadow.class.js @@ -97,7 +97,7 @@ /* _TO_SVG_START_ */ /** * Returns SVG representation of a shadow - * @param {Object} object + * @param {fabric.Object} object * @return {String} SVG representation of a shadow */ toSVG: function(object) { diff --git a/src/shapes/object.class.js b/src/shapes/object.class.js index 6246a8db..6ce6286d 100644 --- a/src/shapes/object.class.js +++ b/src/shapes/object.class.js @@ -834,7 +834,7 @@ /** * Clones an instance * @param {Function} callback Callback is invoked with a clone as a first argument - * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the outpu + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output * @return {fabric.Object} clone of an instance */ clone: function(callback, propertiesToInclude) { @@ -956,6 +956,15 @@ * Backwards incompatibility note: This method was named "setGradientFill" until v1.1.0 * @param {String} property Property name 'stroke' or 'fill' * @param {Object} [options] Options object + * @param {String} [options.type] Type of gradient 'radial' or 'linear' + * @param {Number} [options.x1=0] x-coordinate of start point + * @param {Number} [options.y1=0] y-coordinate of start point + * @param {Number} [options.x2=0] x-coordinate of end point + * @param {Number} [options.y2=0] y-coordinate of end point + * @param {Number} [options.r1=0] Radius of start point (only for radial gradients) + * @param {Number} [options.r2=0] Radius of end point (only for radial gradients) + * @param {Object} [options.colorStops] Color stops object eg. {0: 'ff0000', 1: '000000'} + * @return {fabric.Object} thisArg * @chainable */ setGradient: function(property, options) { @@ -986,7 +995,11 @@ /** * Sets pattern fill of an object - * @param {Object} [options] Options object + * @param {Object} options Options object + * @param {(String|HTMLImageElement)} options.source Pattern source + * @param {String} [options.repeat=repeat] Repeat property of a pattern (one of repeat, repeat-x, repeat-y or no-repeat) + * @param {Number} [options.offsetX=0] Pattern horizontal offset from object's left/top corner + * @param {Number} [options.offsetY=0] Pattern vertical offset from object's left/top corner * @return {fabric.Object} thisArg * @chainable */ @@ -997,6 +1010,10 @@ /** * Sets shadow of an object * @param {Object|String} [options] Options object or string (e.g. "2px 2px 10px rgba(0,0,0,0.2)") + * @param {String} [options.color=rgb(0,0,0)] Shadow color + * @param {Number} [options.blur=0] Shadow blur + * @param {Number} [options.offsetX=0] Shadow horizontal offset + * @param {Number} [options.offsetY=0] Shadow vertical offset * @return {fabric.Object} thisArg * @chainable */ @@ -1088,7 +1105,7 @@ /** * Moves an object down in stack of drawn objects - * @param intersecting {Boolean} If `true`, send object behind next lower intersecting object + * @param {Boolean} [intersecting] If `true`, send object behind next lower intersecting object * @return {fabric.Object} thisArg * @chainable */ @@ -1104,7 +1121,7 @@ /** * Moves an object up in stack of drawn objects - * @param intersecting {Boolean} If `true`, send object in front of next upper intersecting object + * @param {Boolean} [intersecting] If `true`, send object in front of next upper intersecting object * @return {fabric.Object} thisArg * @chainable */ diff --git a/src/static_canvas.class.js b/src/static_canvas.class.js index 1d9d40c8..86f46bf2 100644 --- a/src/static_canvas.class.js +++ b/src/static_canvas.class.js @@ -179,7 +179,9 @@ * Sets overlay image for this canvas * @param {String} url url of an image to set overlay to * @param {Function} callback callback to invoke when image is loaded and set as an overlay - * @param {Object} [options] optional options to set for the overlay image + * @param {Object} [options] Optional options to set for the overlay image + * @param {Number} [options.overlayImageLeft] Left offset of overlay image + * @param {Number} [options.overlayImageTop] Top offset of overlay image * @return {fabric.Canvas} thisArg * @chainable */ @@ -202,7 +204,9 @@ * Sets background image for this canvas * @param {String} url url of an image to set background to * @param {Function} callback callback to invoke when image is loaded and set as background - * @param {Object} [options] optional options to set for the background image + * @param {Object} [options] Optional options to set for the background image + * @param {Float} [options.backgroundImageOpacity] Opacity of the background image of the canvas instance + * @param {Boolean} [options.backgroundImageStretch] Indicates whether the background image should be stretched to fit the canvas * @return {fabric.Canvas} thisArg * @chainable */ @@ -223,7 +227,7 @@ /** * Sets background color for this canvas - * @param {String|fabric.Pattern} Color of pattern to set background color to + * @param {String|fabric.Pattern} backgroundColor Color of pattern to set background color to * @param {Function} callback callback to invoke when background color is set * @return {fabric.Canvas} thisArg * @chainable @@ -349,6 +353,8 @@ /** * Sets dimensions (width, height) of this canvas instance * @param {Object} dimensions Object with width/height properties + * @param {Number} [dimensions.width] Width of canvas element + * @param {Number} [dimensions.height] Height of canvas element * @return {fabric.Canvas} thisArg * @chainable */ @@ -418,8 +424,8 @@ /** * Given a context, renders an object on that context - * @param ctx {Object} context to render object on - * @param object {Object} object to render + * @param {CanvasRenderingContext2D} ctx Context to render object on + * @param {fabric.Object} object Object to render * @private */ _draw: function (ctx, object) { @@ -439,6 +445,7 @@ /** * @private + * @param {fabric.Object} obj Object that was added */ _onObjectAdded: function(obj) { this.stateful && obj.setupState(); @@ -450,6 +457,7 @@ /** * @private + * @param {fabric.Object} obj Object that was removed */ _onObjectRemoved: function(obj) { this.fire('object:removed', { target: obj }); @@ -466,7 +474,7 @@ /** * Clears specified context of canvas element - * @param context {Object} ctx context to clear + * @param {CanvasRenderingContext2D} ctx Context to clear * @return {fabric.Canvas} thisArg * @chainable */ @@ -507,7 +515,7 @@ /** * Renders both the top canvas and the secondary container canvas. - * @param allOnTop {Boolean} optional Whether we want to force all images to be rendered on the top canvas + * @param {Boolean} [allOnTop] Whether we want to force all images to be rendered on the top canvas * @return {fabric.Canvas} instance * @chainable */ @@ -585,6 +593,7 @@ /** * @private + * @param {CanvasRenderingContext2D} canvasToDrawOn Context to render on */ _drawBackroundImage: function(canvasToDrawOn) { canvasToDrawOn.save(); @@ -680,7 +689,7 @@ /** * Returs dataless JSON representation of canvas - * @param {Array} propertiesToInclude Any properties that you might want to additionally include in the output + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output * @return {String} json string */ toDatalessJSON: function (propertiesToInclude) { @@ -689,7 +698,7 @@ /** * Returns object representation of canvas - * @param {Array} propertiesToInclude Any properties that you might want to additionally include in the output + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output * @return {Object} object representation of an instance */ toObject: function (propertiesToInclude) { @@ -698,7 +707,7 @@ /** * Returns dataless object representation of canvas - * @param {Array} propertiesToInclude Any properties that you might want to additionally include in the output + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output * @return {Object} object representation of an instance */ toDatalessObject: function (propertiesToInclude) { @@ -754,8 +763,14 @@ /** * Returns SVG representation of canvas * @function - * @param {Object} [options] Options for SVG output (suppressPreamble: true/false (if true xml tag is not included), - * viewBox: {x, y, width, height} to define the svg output viewBox), encoding default: UTF-8 + * @param {Object} [options] Options object for SVG output + * @param {Boolean} [options.suppressPreamble=false] If true xml tag is not included + * @param {Object} [options.viewBox] SVG viewbox object + * @param {Number} [options.viewBox.x] x-cooridnate of viewbox + * @param {Number} [options.viewBox.y] y-coordinate of viewbox + * @param {Number} [options.viewBox.width] Width of viewbox + * @param {Number} [options.viewBox.height] Height of viewbox + * @param {String} [options.encoding=UTF-8] Encoding of SVG output * @return {String} */ toSVG: function(options) { @@ -835,8 +850,8 @@ /** * Removes an object from canvas and returns it - * @param object {Object} Object to remove - * @return {Object} removed object + * @param {fabric.Object} object Object to remove + * @return {fabric.Object} removed object */ remove: function (object) { // removing active object should fire "selection:cleared" events @@ -851,7 +866,7 @@ /** * Moves an object to the bottom of the stack of drawn objects - * @param object {fabric.Object} Object to send to back + * @param {fabric.Object} object Object to send to back * @return {fabric.Canvas} thisArg * @chainable */ @@ -863,7 +878,7 @@ /** * Moves an object to the top of the stack of drawn objects - * @param object {fabric.Object} Object to send + * @param {fabric.Object} object Object to send * @return {fabric.Canvas} thisArg * @chainable */ @@ -875,8 +890,8 @@ /** * Moves an object down in stack of drawn objects - * @param object {fabric.Object} Object to send - * @param intersecting {Boolean} If `true`, send object behind next lower intersecting object + * @param {fabric.Object} object Object to send + * @param {Boolean} [intersecting] If `true`, send object behind next lower intersecting object * @return {fabric.Canvas} thisArg * @chainable */ @@ -916,8 +931,8 @@ /** * Moves an object up in stack of drawn objects - * @param object {fabric.Object} Object to send - * @param intersecting {Boolean} If `true`, send object in front of next upper intersecting object + * @param {fabric.Object} object Object to send + * @param {Boolean} [intersecting] If `true`, send object in front of next upper intersecting object * @return {fabric.Canvas} thisArg * @chainable */ @@ -957,7 +972,7 @@ /** * Moves an object to specified level in stack of drawn objects - * @param object {fabric.Object} Object to send + * @param {fabric.Object} object Object to send * @param {Number} index Position to move to * @return {fabric.Canvas} thisArg * @chainable