mirror of
https://github.com/konvajs/konva.git
synced 2026-01-09 11:34:38 +08:00
change documentation
This commit is contained in:
@@ -1,28 +1,28 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
/**
|
||||
* Line constructor. Lines are defined by an array of points and
|
||||
* a tension
|
||||
* @constructor
|
||||
* @memberof Konva
|
||||
* @augments Konva.Shape
|
||||
* @param {Object} config
|
||||
* @param {Array} config.points
|
||||
* @param {Number} [config.tension] Higher values will result in a more curvy line. A value of 0 will result in no interpolation.
|
||||
* The default is 0
|
||||
* @param {Boolean} [config.closed] defines whether or not the line shape is closed, creating a polygon or blob
|
||||
* @param {Boolean} [config.bezier] if no tension is provided but bezier=true, we draw the line as a bezier using the passed points
|
||||
* @@shapeParams
|
||||
* @@nodeParams
|
||||
* @example
|
||||
* var line = new Konva.Line({
|
||||
* x: 100,
|
||||
* y: 50,
|
||||
* points: [73, 70, 340, 23, 450, 60, 500, 20],
|
||||
* stroke: 'red',
|
||||
* tension: 1
|
||||
* });
|
||||
*/
|
||||
* Line constructor. Lines are defined by an array of points and
|
||||
* a tension
|
||||
* @constructor
|
||||
* @memberof Konva
|
||||
* @augments Konva.Shape
|
||||
* @param {Object} config
|
||||
* @param {Array} config.points Array of points coordinates. You should define them as [x1, y1, x2, y2, x3, y3].
|
||||
* @param {Number} [config.tension] Higher values will result in a more curvy line. A value of 0 will result in no interpolation.
|
||||
* The default is 0
|
||||
* @param {Boolean} [config.closed] defines whether or not the line shape is closed, creating a polygon or blob
|
||||
* @param {Boolean} [config.bezier] if no tension is provided but bezier=true, we draw the line as a bezier using the passed points
|
||||
* @@shapeParams
|
||||
* @@nodeParams
|
||||
* @example
|
||||
* var line = new Konva.Line({
|
||||
* x: 100,
|
||||
* y: 50,
|
||||
* points: [73, 70, 340, 23, 450, 60, 500, 20],
|
||||
* stroke: 'red',
|
||||
* tension: 1
|
||||
* });
|
||||
*/
|
||||
Konva.Line = function(config) {
|
||||
this.___init(config);
|
||||
};
|
||||
@@ -210,76 +210,76 @@
|
||||
Konva.Factory.addGetterSetter(Konva.Line, 'closed', false);
|
||||
|
||||
/**
|
||||
* get/set closed flag. The default is false
|
||||
* @name closed
|
||||
* @method
|
||||
* @memberof Konva.Line.prototype
|
||||
* @param {Boolean} closed
|
||||
* @returns {Boolean}
|
||||
* @example
|
||||
* // get closed flag
|
||||
* var closed = line.closed();
|
||||
*
|
||||
* // close the shape
|
||||
* line.closed(true);
|
||||
*
|
||||
* // open the shape
|
||||
* line.closed(false);
|
||||
*/
|
||||
* get/set closed flag. The default is false
|
||||
* @name closed
|
||||
* @method
|
||||
* @memberof Konva.Line.prototype
|
||||
* @param {Boolean} closed
|
||||
* @returns {Boolean}
|
||||
* @example
|
||||
* // get closed flag
|
||||
* var closed = line.closed();
|
||||
*
|
||||
* // close the shape
|
||||
* line.closed(true);
|
||||
*
|
||||
* // open the shape
|
||||
* line.closed(false);
|
||||
*/
|
||||
|
||||
Konva.Factory.addGetterSetter(Konva.Line, 'bezier', false);
|
||||
|
||||
/**
|
||||
* get/set bezier flag. The default is false
|
||||
* @name bezier
|
||||
* @method
|
||||
* @memberof Konva.Line.prototype
|
||||
* @param {Boolean} bezier
|
||||
* @returns {Boolean}
|
||||
* @example
|
||||
* // get whether the line is a bezier
|
||||
* var isBezier = line.bezier();
|
||||
*
|
||||
* // set whether the line is a bezier
|
||||
* line.bezier(true);
|
||||
*/
|
||||
* get/set bezier flag. The default is false
|
||||
* @name bezier
|
||||
* @method
|
||||
* @memberof Konva.Line.prototype
|
||||
* @param {Boolean} bezier
|
||||
* @returns {Boolean}
|
||||
* @example
|
||||
* // get whether the line is a bezier
|
||||
* var isBezier = line.bezier();
|
||||
*
|
||||
* // set whether the line is a bezier
|
||||
* line.bezier(true);
|
||||
*/
|
||||
|
||||
Konva.Factory.addGetterSetter(Konva.Line, 'tension', 0);
|
||||
|
||||
/**
|
||||
* get/set tension
|
||||
* @name tension
|
||||
* @method
|
||||
* @memberof Konva.Line.prototype
|
||||
* @param {Number} Higher values will result in a more curvy line. A value of 0 will result in no interpolation.
|
||||
* The default is 0
|
||||
* @returns {Number}
|
||||
* @example
|
||||
* // get tension
|
||||
* var tension = line.tension();
|
||||
*
|
||||
* // set tension
|
||||
* line.tension(3);
|
||||
*/
|
||||
* get/set tension
|
||||
* @name tension
|
||||
* @method
|
||||
* @memberof Konva.Line.prototype
|
||||
* @param {Number} Higher values will result in a more curvy line. A value of 0 will result in no interpolation.
|
||||
* The default is 0
|
||||
* @returns {Number}
|
||||
* @example
|
||||
* // get tension
|
||||
* var tension = line.tension();
|
||||
*
|
||||
* // set tension
|
||||
* line.tension(3);
|
||||
*/
|
||||
|
||||
Konva.Factory.addGetterSetter(Konva.Line, 'points', []);
|
||||
/**
|
||||
* get/set points array
|
||||
* @name points
|
||||
* @method
|
||||
* @memberof Konva.Line.prototype
|
||||
* @param {Array} points
|
||||
* @returns {Array}
|
||||
* @example
|
||||
* // get points
|
||||
* var points = line.points();
|
||||
*
|
||||
* // set points
|
||||
* line.points([10, 20, 30, 40, 50, 60]);
|
||||
*
|
||||
* // push a new point
|
||||
* line.points(line.points().concat([70, 80]));
|
||||
*/
|
||||
* get/set points array
|
||||
* @name points
|
||||
* @method
|
||||
* @memberof Konva.Line.prototype
|
||||
* @param {Array} points
|
||||
* @returns {Array}
|
||||
* @example
|
||||
* // get points
|
||||
* var points = line.points();
|
||||
*
|
||||
* // set points
|
||||
* line.points([10, 20, 30, 40, 50, 60]);
|
||||
*
|
||||
* // push a new point
|
||||
* line.points(line.points().concat([70, 80]));
|
||||
*/
|
||||
|
||||
Konva.Collection.mapMethods(Konva.Line);
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user