mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-03 19:45:44 -05:00
A lot of work on documentation.
- @values lists - Improve event documentation - Compound path - etc.
This commit is contained in:
parent
64f997a3bc
commit
f2ae7840cf
34 changed files with 357 additions and 277 deletions
|
@ -50,8 +50,8 @@ var Line = Base.extend(/** @lends Line# */{
|
||||||
/**
|
/**
|
||||||
* The starting point of the line.
|
* The starting point of the line.
|
||||||
*
|
*
|
||||||
* @type Point
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Point
|
||||||
*/
|
*/
|
||||||
getPoint: function() {
|
getPoint: function() {
|
||||||
return new Point(this._px, this._py);
|
return new Point(this._px, this._py);
|
||||||
|
@ -60,8 +60,8 @@ var Line = Base.extend(/** @lends Line# */{
|
||||||
/**
|
/**
|
||||||
* The direction of the line as a vector.
|
* The direction of the line as a vector.
|
||||||
*
|
*
|
||||||
* @type Point
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Point
|
||||||
*/
|
*/
|
||||||
getVector: function() {
|
getVector: function() {
|
||||||
return new Point(this._vx, this._vy);
|
return new Point(this._vx, this._vy);
|
||||||
|
@ -70,8 +70,8 @@ var Line = Base.extend(/** @lends Line# */{
|
||||||
/**
|
/**
|
||||||
* The length of the line.
|
* The length of the line.
|
||||||
*
|
*
|
||||||
* @type Number
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Number
|
||||||
*/
|
*/
|
||||||
getLength: function() {
|
getLength: function() {
|
||||||
return this.getVector().getLength();
|
return this.getVector().getLength();
|
||||||
|
|
|
@ -688,8 +688,8 @@ var Matrix = Base.extend(/** @lends Matrix# */{
|
||||||
* The transform values as an array, in the same sequence as they are passed
|
* The transform values as an array, in the same sequence as they are passed
|
||||||
* to {@link #initialize(a, c, b, d, tx, ty)}.
|
* to {@link #initialize(a, c, b, d, tx, ty)}.
|
||||||
*
|
*
|
||||||
* @type Number[]
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Number[]
|
||||||
*/
|
*/
|
||||||
getValues: function() {
|
getValues: function() {
|
||||||
return [ this._a, this._c, this._b, this._d, this._tx, this._ty ];
|
return [ this._a, this._c, this._b, this._d, this._tx, this._ty ];
|
||||||
|
@ -698,8 +698,8 @@ var Matrix = Base.extend(/** @lends Matrix# */{
|
||||||
/**
|
/**
|
||||||
* The translation of the matrix as a vector.
|
* The translation of the matrix as a vector.
|
||||||
*
|
*
|
||||||
* @type Point
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Point
|
||||||
*/
|
*/
|
||||||
getTranslation: function() {
|
getTranslation: function() {
|
||||||
// No decomposition is required to extract translation.
|
// No decomposition is required to extract translation.
|
||||||
|
@ -709,8 +709,8 @@ var Matrix = Base.extend(/** @lends Matrix# */{
|
||||||
/**
|
/**
|
||||||
* The scaling values of the matrix, if it can be decomposed.
|
* The scaling values of the matrix, if it can be decomposed.
|
||||||
*
|
*
|
||||||
* @type Point
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Point
|
||||||
* @see #decompose()
|
* @see #decompose()
|
||||||
*/
|
*/
|
||||||
getScaling: function() {
|
getScaling: function() {
|
||||||
|
@ -720,8 +720,8 @@ var Matrix = Base.extend(/** @lends Matrix# */{
|
||||||
/**
|
/**
|
||||||
* The rotation angle of the matrix, if it can be decomposed.
|
* The rotation angle of the matrix, if it can be decomposed.
|
||||||
*
|
*
|
||||||
* @type Number
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Number
|
||||||
* @see #decompose()
|
* @see #decompose()
|
||||||
*/
|
*/
|
||||||
getRotation: function() {
|
getRotation: function() {
|
||||||
|
|
|
@ -245,8 +245,8 @@ var Point = Base.extend(/** @lends Point# */{
|
||||||
* = 0`, `y = 0`) to the point's location. Setting the length changes the
|
* = 0`, `y = 0`) to the point's location. Setting the length changes the
|
||||||
* location but keeps the vector's angle.
|
* location but keeps the vector's angle.
|
||||||
*
|
*
|
||||||
* @type Number
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Number
|
||||||
*/
|
*/
|
||||||
getLength: function() {
|
getLength: function() {
|
||||||
return Math.sqrt(this.x * this.x + this.y * this.y);
|
return Math.sqrt(this.x * this.x + this.y * this.y);
|
||||||
|
@ -285,8 +285,8 @@ var Point = Base.extend(/** @lends Point# */{
|
||||||
/**
|
/**
|
||||||
* The vector's angle in degrees, measured from the x-axis to the vector.
|
* The vector's angle in degrees, measured from the x-axis to the vector.
|
||||||
*
|
*
|
||||||
* @name Point#getAngle
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @name Point#getAngle
|
||||||
* @type Number
|
* @type Number
|
||||||
*/
|
*/
|
||||||
getAngle: function(/* point */) {
|
getAngle: function(/* point */) {
|
||||||
|
@ -312,8 +312,8 @@ var Point = Base.extend(/** @lends Point# */{
|
||||||
/**
|
/**
|
||||||
* The vector's angle in radians, measured from the x-axis to the vector.
|
* The vector's angle in radians, measured from the x-axis to the vector.
|
||||||
*
|
*
|
||||||
* @name Point#getAngleInRadians
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @name Point#getAngleInRadians
|
||||||
* @type Number
|
* @type Number
|
||||||
*/
|
*/
|
||||||
getAngleInRadians: function(/* point */) {
|
getAngleInRadians: function(/* point */) {
|
||||||
|
@ -362,8 +362,8 @@ var Point = Base.extend(/** @lends Point# */{
|
||||||
* are in quadrant `3` and angles between 270 and 360 degrees are in
|
* are in quadrant `3` and angles between 270 and 360 degrees are in
|
||||||
* quadrant `4`.
|
* quadrant `4`.
|
||||||
*
|
*
|
||||||
* @type Number
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Number
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* var point = new Point({
|
* var point = new Point({
|
||||||
|
|
|
@ -237,8 +237,8 @@ var Rectangle = Base.extend(/** @lends Rectangle# */{
|
||||||
/**
|
/**
|
||||||
* The top-left point of the rectangle
|
* The top-left point of the rectangle
|
||||||
*
|
*
|
||||||
* @type Point
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Point
|
||||||
*/
|
*/
|
||||||
getPoint: function(_dontLink) {
|
getPoint: function(_dontLink) {
|
||||||
var ctor = _dontLink ? Point : LinkedPoint;
|
var ctor = _dontLink ? Point : LinkedPoint;
|
||||||
|
@ -255,8 +255,8 @@ var Rectangle = Base.extend(/** @lends Rectangle# */{
|
||||||
/**
|
/**
|
||||||
* The size of the rectangle
|
* The size of the rectangle
|
||||||
*
|
*
|
||||||
* @type Size
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Size
|
||||||
*/
|
*/
|
||||||
getSize: function(_dontLink) {
|
getSize: function(_dontLink) {
|
||||||
var ctor = _dontLink ? Size : LinkedSize;
|
var ctor = _dontLink ? Size : LinkedSize;
|
||||||
|
@ -288,8 +288,8 @@ var Rectangle = Base.extend(/** @lends Rectangle# */{
|
||||||
* The position of the left hand side of the rectangle. Note that this
|
* The position of the left hand side of the rectangle. Note that this
|
||||||
* doesn't move the whole rectangle; the right hand side stays where it was.
|
* doesn't move the whole rectangle; the right hand side stays where it was.
|
||||||
*
|
*
|
||||||
* @type Number
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Number
|
||||||
*/
|
*/
|
||||||
getLeft: function() {
|
getLeft: function() {
|
||||||
return this.x;
|
return this.x;
|
||||||
|
@ -306,8 +306,8 @@ var Rectangle = Base.extend(/** @lends Rectangle# */{
|
||||||
* The top coordinate of the rectangle. Note that this doesn't move the
|
* The top coordinate of the rectangle. Note that this doesn't move the
|
||||||
* whole rectangle: the bottom won't move.
|
* whole rectangle: the bottom won't move.
|
||||||
*
|
*
|
||||||
* @type Number
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Number
|
||||||
*/
|
*/
|
||||||
getTop: function() {
|
getTop: function() {
|
||||||
return this.y;
|
return this.y;
|
||||||
|
@ -324,8 +324,8 @@ var Rectangle = Base.extend(/** @lends Rectangle# */{
|
||||||
* The position of the right hand side of the rectangle. Note that this
|
* The position of the right hand side of the rectangle. Note that this
|
||||||
* doesn't move the whole rectangle; the left hand side stays where it was.
|
* doesn't move the whole rectangle; the left hand side stays where it was.
|
||||||
*
|
*
|
||||||
* @type Number
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Number
|
||||||
*/
|
*/
|
||||||
getRight: function() {
|
getRight: function() {
|
||||||
return this.x + this.width;
|
return this.x + this.width;
|
||||||
|
@ -346,8 +346,8 @@ var Rectangle = Base.extend(/** @lends Rectangle# */{
|
||||||
* The bottom coordinate of the rectangle. Note that this doesn't move the
|
* The bottom coordinate of the rectangle. Note that this doesn't move the
|
||||||
* whole rectangle: the top won't move.
|
* whole rectangle: the top won't move.
|
||||||
*
|
*
|
||||||
* @type Number
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Number
|
||||||
*/
|
*/
|
||||||
getBottom: function() {
|
getBottom: function() {
|
||||||
return this.y + this.height;
|
return this.y + this.height;
|
||||||
|
@ -367,8 +367,8 @@ var Rectangle = Base.extend(/** @lends Rectangle# */{
|
||||||
/**
|
/**
|
||||||
* The center-x coordinate of the rectangle.
|
* The center-x coordinate of the rectangle.
|
||||||
*
|
*
|
||||||
* @type Number
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Number
|
||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
getCenterX: function() {
|
getCenterX: function() {
|
||||||
|
@ -383,8 +383,8 @@ var Rectangle = Base.extend(/** @lends Rectangle# */{
|
||||||
/**
|
/**
|
||||||
* The center-y coordinate of the rectangle.
|
* The center-y coordinate of the rectangle.
|
||||||
*
|
*
|
||||||
* @type Number
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Number
|
||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
getCenterY: function() {
|
getCenterY: function() {
|
||||||
|
@ -401,8 +401,8 @@ var Rectangle = Base.extend(/** @lends Rectangle# */{
|
||||||
*
|
*
|
||||||
* The center point of the rectangle.
|
* The center point of the rectangle.
|
||||||
*
|
*
|
||||||
* @type Point
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Point
|
||||||
*/
|
*/
|
||||||
getCenter: function(_dontLink) {
|
getCenter: function(_dontLink) {
|
||||||
var ctor = _dontLink ? Point : LinkedPoint;
|
var ctor = _dontLink ? Point : LinkedPoint;
|
||||||
|
@ -477,8 +477,8 @@ var Rectangle = Base.extend(/** @lends Rectangle# */{
|
||||||
/**
|
/**
|
||||||
* The area of the rectangle.
|
* The area of the rectangle.
|
||||||
*
|
*
|
||||||
* @type Number
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Number
|
||||||
*/
|
*/
|
||||||
getArea: function() {
|
getArea: function() {
|
||||||
return this.width * this.height;
|
return this.width * this.height;
|
||||||
|
@ -899,9 +899,9 @@ new function() {
|
||||||
* Paper.js draws the visual bounds of selected items on top of your
|
* Paper.js draws the visual bounds of selected items on top of your
|
||||||
* project. This can be useful for debugging.
|
* project. This can be useful for debugging.
|
||||||
*
|
*
|
||||||
|
* @bean
|
||||||
* @type Boolean
|
* @type Boolean
|
||||||
* @default false
|
* @default false
|
||||||
* @bean
|
|
||||||
*/
|
*/
|
||||||
isSelected: function() {
|
isSelected: function() {
|
||||||
return this._owner._boundsSelected;
|
return this._owner._boundsSelected;
|
||||||
|
|
|
@ -40,7 +40,7 @@ Base.inject(/** @lends Base# */{
|
||||||
* The class name of the object as a string, if the prototype defines a
|
* The class name of the object as a string, if the prototype defines a
|
||||||
* `_class` value.
|
* `_class` value.
|
||||||
*
|
*
|
||||||
* @beans
|
* @bean
|
||||||
*/
|
*/
|
||||||
getClassName: function() {
|
getClassName: function() {
|
||||||
return this._class || '';
|
return this._class || '';
|
||||||
|
|
|
@ -136,20 +136,23 @@ var PaperScope = Base.extend(/** @lends PaperScope# */{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The currently active project.
|
* The currently active project.
|
||||||
|
*
|
||||||
* @name PaperScope#project
|
* @name PaperScope#project
|
||||||
* @type Project
|
* @type Project
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The list of all open projects within the current Paper.js context.
|
* The list of all open projects within the current Paper.js context.
|
||||||
|
*
|
||||||
* @name PaperScope#projects
|
* @name PaperScope#projects
|
||||||
* @type Project[]
|
* @type Project[]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The reference to the active project's view.
|
* The reference to the active project's view.
|
||||||
* @type View
|
*
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type View
|
||||||
*/
|
*/
|
||||||
getView: function() {
|
getView: function() {
|
||||||
return this.project && this.project.getView();
|
return this.project && this.project.getView();
|
||||||
|
@ -157,13 +160,17 @@ var PaperScope = Base.extend(/** @lends PaperScope# */{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The reference to the active tool.
|
* The reference to the active tool.
|
||||||
|
*
|
||||||
* @name PaperScope#tool
|
* @name PaperScope#tool
|
||||||
|
* @property
|
||||||
* @type Tool
|
* @type Tool
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The list of available tools.
|
* The list of available tools.
|
||||||
|
*
|
||||||
* @name PaperScope#tools
|
* @name PaperScope#tools
|
||||||
|
* @property
|
||||||
* @type Tool[]
|
* @type Tool[]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -171,9 +178,10 @@ var PaperScope = Base.extend(/** @lends PaperScope# */{
|
||||||
* A reference to the local scope. This is required, so `paper` will always
|
* A reference to the local scope. This is required, so `paper` will always
|
||||||
* refer to the local scope, even when calling into it from another scope.
|
* refer to the local scope, even when calling into it from another scope.
|
||||||
* `paper.activate();` will have to be called in such a situation.
|
* `paper.activate();` will have to be called in such a situation.
|
||||||
|
*
|
||||||
|
* @bean
|
||||||
* @type PaperScript
|
* @type PaperScript
|
||||||
* @private
|
* @private
|
||||||
* @bean
|
|
||||||
*/
|
*/
|
||||||
getPaper: function() {
|
getPaper: function() {
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -12,7 +12,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name Event
|
* @name Event
|
||||||
* @class
|
*
|
||||||
|
* @class The Event object is the base class for any of the other event types,
|
||||||
|
* such as {@link MouseEvent}, {@link ToolEvent} and {@link KeyEvent}.
|
||||||
*/
|
*/
|
||||||
var Event = Base.extend(/** @lends Event# */{
|
var Event = Base.extend(/** @lends Event# */{
|
||||||
_class: 'Event',
|
_class: 'Event',
|
||||||
|
@ -24,16 +26,31 @@ var Event = Base.extend(/** @lends Event# */{
|
||||||
isPrevented: false,
|
isPrevented: false,
|
||||||
isStopped: false,
|
isStopped: false,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cancels the event if it is cancelable, without stopping further
|
||||||
|
* propagation of the event.
|
||||||
|
*/
|
||||||
preventDefault: function() {
|
preventDefault: function() {
|
||||||
this.isPrevented = true;
|
this.isPrevented = true;
|
||||||
this.event.preventDefault();
|
this.event.preventDefault();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prevents further propagation of the current event.
|
||||||
|
*/
|
||||||
stopPropagation: function() {
|
stopPropagation: function() {
|
||||||
this.isStopped = true;
|
this.isStopped = true;
|
||||||
this.event.stopPropagation();
|
this.event.stopPropagation();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cancels the event if it is cancelable, and stops stopping further
|
||||||
|
* propagation of the event. This is has the same effect as calling both
|
||||||
|
* {@link #stopPropagation()} and {@link #preventDefault()}.
|
||||||
|
*
|
||||||
|
* Any handler can also return `false` to indicate that `stop()` should be
|
||||||
|
* called right after.
|
||||||
|
*/
|
||||||
stop: function() {
|
stop: function() {
|
||||||
this.stopPropagation();
|
this.stopPropagation();
|
||||||
this.preventDefault();
|
this.preventDefault();
|
||||||
|
@ -42,8 +59,8 @@ var Event = Base.extend(/** @lends Event# */{
|
||||||
/**
|
/**
|
||||||
* The time at which the event was created, in milliseconds since the epoch.
|
* The time at which the event was created, in milliseconds since the epoch.
|
||||||
*
|
*
|
||||||
* @type Number
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Number
|
||||||
*/
|
*/
|
||||||
getTimeStamp: function() {
|
getTimeStamp: function() {
|
||||||
return this.event.timeStamp;
|
return this.event.timeStamp;
|
||||||
|
@ -52,8 +69,8 @@ var Event = Base.extend(/** @lends Event# */{
|
||||||
/**
|
/**
|
||||||
* The current state of the keyboard modifiers.
|
* The current state of the keyboard modifiers.
|
||||||
*
|
*
|
||||||
* @type object
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type object
|
||||||
* @see Key.modifiers
|
* @see Key.modifiers
|
||||||
*/
|
*/
|
||||||
getModifiers: function() {
|
getModifiers: function() {
|
||||||
|
|
|
@ -223,9 +223,10 @@ var Key = new function() {
|
||||||
/**
|
/**
|
||||||
* Checks whether the specified key is pressed.
|
* Checks whether the specified key is pressed.
|
||||||
*
|
*
|
||||||
* @param {String} key any character or special key descriptor, e.g.:
|
* @param {String} key any character or special key descriptor:
|
||||||
* {@strings enter, space, shift, control, alt, meta, caps-lock,
|
* {@values 'enter', 'space', 'shift', 'control', 'alt', 'meta',
|
||||||
* left, up, right, down, escape, delete, ...}
|
* 'caps-lock', 'left', 'up', 'right', 'down', 'escape', 'delete',
|
||||||
|
* ...}
|
||||||
* @return {Boolean} {@true if the key is pressed}
|
* @return {Boolean} {@true if the key is pressed}
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
|
|
|
@ -31,10 +31,11 @@ var KeyEvent = Event.extend(/** @lends KeyEvent# */{
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The type of key event.
|
* The type of mouse event.
|
||||||
*
|
*
|
||||||
* @name KeyEvent#type
|
* @name KeyEvent#type
|
||||||
* @type String('keydown', 'keyup')
|
* @type String
|
||||||
|
* @values 'keydown', 'keyup'
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -48,11 +49,12 @@ var KeyEvent = Event.extend(/** @lends KeyEvent# */{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The key that caused this key event, either as a lower-case character or
|
* The key that caused this key event, either as a lower-case character or
|
||||||
* special key descriptor, e.g.: {@strings enter, space, shift, control,
|
* special key descriptor.
|
||||||
* alt, meta, caps-lock, left, up, right, down, escape, delete, ...}
|
|
||||||
*
|
*
|
||||||
* @name KeyEvent#key
|
* @name KeyEvent#key
|
||||||
* @type String
|
* @type String
|
||||||
|
* @values 'enter', 'space', 'shift', 'control', 'alt', 'meta', 'caps-lock',
|
||||||
|
* 'left', 'up', 'right', 'down', 'escape', 'delete', ...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -37,8 +37,9 @@ var MouseEvent = Event.extend(/** @lends MouseEvent# */{
|
||||||
* The type of mouse event.
|
* The type of mouse event.
|
||||||
*
|
*
|
||||||
* @name MouseEvent#type
|
* @name MouseEvent#type
|
||||||
* @type String('mousedown', 'mouseup', 'mousedrag', 'click',
|
* @type String
|
||||||
* 'doubleclick', 'mousemove', 'mouseenter', 'mouseleave')
|
* @values 'mousedown', 'mouseup', 'mousedrag', 'click', 'doubleclick',
|
||||||
|
* 'mousemove', 'mouseenter', mouseleave'
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -129,8 +129,8 @@ var Group = Item.extend(/** @lends Group# */{
|
||||||
* `true`, the first child in the group is automatically defined as the
|
* `true`, the first child in the group is automatically defined as the
|
||||||
* clipping mask.
|
* clipping mask.
|
||||||
*
|
*
|
||||||
* @type Boolean
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Boolean
|
||||||
*
|
*
|
||||||
* @example {@paperscript}
|
* @example {@paperscript}
|
||||||
* var star = new Path.Star({
|
* var star = new Path.Star({
|
||||||
|
|
|
@ -35,22 +35,24 @@ var HitResult = Base.extend(/** @lends HitResult# */{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Describes the type of the hit result. For example, if you hit a segment
|
* Describes the type of the hit result. For example, if you hit a segment
|
||||||
* point, the type would be 'segment'.
|
* point, the type would be `'segment'`.
|
||||||
*
|
*
|
||||||
* @name HitResult#type
|
* @name HitResult#type
|
||||||
* @property
|
* @property
|
||||||
* @type String('segment', 'handle-in', 'handle-out', 'curve', 'stroke',
|
* @type String
|
||||||
* 'fill', 'bounds', 'center', 'pixel')
|
* @values 'segment', 'handle-in', 'handle-out', 'curve', 'stroke', 'fill',
|
||||||
|
* 'bounds', 'center', 'pixel'
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If the HitResult has a {@link HitResult#type} of 'bounds', this property
|
* If the HitResult has a {@link HitResult#type} of `'bounds'`, this
|
||||||
* describes which corner of the bounding rectangle was hit.
|
* property describes which corner of the bounding rectangle was hit.
|
||||||
*
|
*
|
||||||
* @name HitResult#name
|
* @name HitResult#name
|
||||||
* @property
|
* @property
|
||||||
* @type String('top-left', 'top-right', 'bottom-left', 'bottom-right',
|
* @type String
|
||||||
* 'left-center', 'top-center', 'right-center', 'bottom-center')
|
* @values 'top-left', 'top-right', 'bottom-left', 'bottom-right',
|
||||||
|
* 'left-center', 'top-center', 'right-center', 'bottom- center'
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
136
src/item/Item.js
136
src/item/Item.js
|
@ -267,8 +267,8 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
||||||
/**
|
/**
|
||||||
* The unique id of the item.
|
* The unique id of the item.
|
||||||
*
|
*
|
||||||
* @type Number
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Number
|
||||||
*/
|
*/
|
||||||
getId: function() {
|
getId: function() {
|
||||||
return this._id;
|
return this._id;
|
||||||
|
@ -278,16 +278,17 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
||||||
* The class name of the item as a string.
|
* The class name of the item as a string.
|
||||||
*
|
*
|
||||||
* @name Item#className
|
* @name Item#className
|
||||||
* @type String('Group', 'Layer', 'Path', 'CompoundPath', 'Shape',
|
* @type String
|
||||||
* 'Raster', 'PlacedSymbol', 'PointText')
|
* @values 'Group', 'Layer', 'Path', 'CompoundPath', 'Shape', 'Raster',
|
||||||
|
* 'PlacedSymbol', 'PointText'
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The name of the item. If the item has a name, it can be accessed by name
|
* The name of the item. If the item has a name, it can be accessed by name
|
||||||
* through its parent's children list.
|
* through its parent's children list.
|
||||||
*
|
*
|
||||||
* @type String
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type String
|
||||||
*
|
*
|
||||||
* @example {@paperscript}
|
* @example {@paperscript}
|
||||||
* var path = new Path.Circle({
|
* var path = new Path.Circle({
|
||||||
|
@ -339,9 +340,9 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
||||||
/**
|
/**
|
||||||
* The path style of the item.
|
* The path style of the item.
|
||||||
*
|
*
|
||||||
|
* @bean
|
||||||
* @name Item#getStyle
|
* @name Item#getStyle
|
||||||
* @type Style
|
* @type Style
|
||||||
* @bean
|
|
||||||
*
|
*
|
||||||
* @example {@paperscript}
|
* @example {@paperscript}
|
||||||
* // Applying several styles to an item in one go, by passing an object
|
* // Applying several styles to an item in one go, by passing an object
|
||||||
|
@ -465,13 +466,14 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
||||||
* emulated. Be aware that emulation can have an impact on performance.
|
* emulated. Be aware that emulation can have an impact on performance.
|
||||||
*
|
*
|
||||||
* @name Item#blendMode
|
* @name Item#blendMode
|
||||||
* @type String('normal', 'multiply', 'screen', 'overlay', 'soft-light',
|
* @type String
|
||||||
* 'hard-light', 'color-dodge', 'color-burn', 'darken', 'lighten',
|
* @values 'normal', 'multiply', 'screen', 'overlay', 'soft-light', 'hard-
|
||||||
* 'difference', 'exclusion', 'hue', 'saturation', 'luminosity', 'color',
|
* light', 'color-dodge', 'color-burn', 'darken', 'lighten',
|
||||||
* 'add', 'subtract', 'average', 'pin-light', 'negation', 'source-over',
|
* 'difference', 'exclusion', 'hue', 'saturation', 'luminosity',
|
||||||
* 'source-in', 'source-out', 'source-atop', 'destination-over',
|
* 'color', 'add', 'subtract', 'average', 'pin-light', 'negation',
|
||||||
* 'destination-in', 'destination-out', 'destination-atop', 'lighter',
|
* 'source- over', 'source-in', 'source-out', 'source-atop',
|
||||||
* 'darker', 'copy', 'xor')
|
* 'destination-over', 'destination-in', 'destination-out',
|
||||||
|
* 'destination-atop', 'lighter', 'darker', 'copy', 'xor'
|
||||||
* @default 'normal'
|
* @default 'normal'
|
||||||
*
|
*
|
||||||
* @example {@paperscript}
|
* @example {@paperscript}
|
||||||
|
@ -549,9 +551,9 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
||||||
* construction of paths, position of path curves, individual segment points
|
* construction of paths, position of path curves, individual segment points
|
||||||
* and bounding boxes of symbol and raster items.
|
* and bounding boxes of symbol and raster items.
|
||||||
*
|
*
|
||||||
|
* @bean
|
||||||
* @type Boolean
|
* @type Boolean
|
||||||
* @default false
|
* @default false
|
||||||
* @bean
|
|
||||||
* @see Project#selectedItems
|
* @see Project#selectedItems
|
||||||
* @see Segment#selected
|
* @see Segment#selected
|
||||||
* @see Curve#selected
|
* @see Curve#selected
|
||||||
|
@ -619,9 +621,9 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
||||||
* paths, compound paths, and text frame objects, and only if the item is
|
* paths, compound paths, and text frame objects, and only if the item is
|
||||||
* already contained within a clipping group.
|
* already contained within a clipping group.
|
||||||
*
|
*
|
||||||
|
* @bean
|
||||||
* @type Boolean
|
* @type Boolean
|
||||||
* @default false
|
* @default false
|
||||||
* @bean
|
|
||||||
*/
|
*/
|
||||||
isClipMask: function() {
|
isClipMask: function() {
|
||||||
return this._clipMask;
|
return this._clipMask;
|
||||||
|
@ -652,8 +654,8 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
||||||
* A plain javascript object which can be used to store
|
* A plain javascript object which can be used to store
|
||||||
* arbitrary data on the item.
|
* arbitrary data on the item.
|
||||||
*
|
*
|
||||||
* @type Object
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Object
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* var path = new Path();
|
* var path = new Path();
|
||||||
|
@ -700,8 +702,8 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
||||||
* default, this is the {@link Rectangle#center} of the item's
|
* default, this is the {@link Rectangle#center} of the item's
|
||||||
* {@link #bounds} rectangle.
|
* {@link #bounds} rectangle.
|
||||||
*
|
*
|
||||||
* @type Point
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Point
|
||||||
*
|
*
|
||||||
* @example {@paperscript}
|
* @example {@paperscript}
|
||||||
* // Changing the position of a path:
|
* // Changing the position of a path:
|
||||||
|
@ -766,8 +768,8 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
||||||
* meaning the {@link Rectangle#center} of the item's {@link #bounds}
|
* meaning the {@link Rectangle#center} of the item's {@link #bounds}
|
||||||
* rectangle is used as pivot.
|
* rectangle is used as pivot.
|
||||||
*
|
*
|
||||||
* @type Point
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Point
|
||||||
* @default null
|
* @default null
|
||||||
*/
|
*/
|
||||||
getPivot: function(_dontLink) {
|
getPivot: function(_dontLink) {
|
||||||
|
@ -1021,8 +1023,8 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
||||||
* The current rotation angle of the item, as described by its
|
* The current rotation angle of the item, as described by its
|
||||||
* {@link #matrix}.
|
* {@link #matrix}.
|
||||||
*
|
*
|
||||||
* @type Number
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Number
|
||||||
*/
|
*/
|
||||||
getRotation: function() {
|
getRotation: function() {
|
||||||
var decomposed = this._decomposed || this._decompose();
|
var decomposed = this._decomposed || this._decompose();
|
||||||
|
@ -1045,8 +1047,8 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
||||||
* The current scale factor of the item, as described by its
|
* The current scale factor of the item, as described by its
|
||||||
* {@link #matrix}.
|
* {@link #matrix}.
|
||||||
*
|
*
|
||||||
* @type Point
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Point
|
||||||
*/
|
*/
|
||||||
getScaling: function(_dontLink) {
|
getScaling: function(_dontLink) {
|
||||||
var decomposed = this._decomposed || this._decompose(),
|
var decomposed = this._decomposed || this._decompose(),
|
||||||
|
@ -1072,8 +1074,8 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
||||||
* The item's transformation matrix, defining position and dimensions in
|
* The item's transformation matrix, defining position and dimensions in
|
||||||
* relation to its parent item in which it is contained.
|
* relation to its parent item in which it is contained.
|
||||||
*
|
*
|
||||||
* @type Matrix
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Matrix
|
||||||
*/
|
*/
|
||||||
getMatrix: function() {
|
getMatrix: function() {
|
||||||
return this._matrix;
|
return this._matrix;
|
||||||
|
@ -1097,8 +1099,8 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
||||||
* coordinate space. Note that the view's transformations resulting from
|
* coordinate space. Note that the view's transformations resulting from
|
||||||
* zooming and panning are not factored in.
|
* zooming and panning are not factored in.
|
||||||
*
|
*
|
||||||
* @type Matrix
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Matrix
|
||||||
*/
|
*/
|
||||||
getGlobalMatrix: function(_dontClone) {
|
getGlobalMatrix: function(_dontClone) {
|
||||||
var matrix = this._globalMatrix,
|
var matrix = this._globalMatrix,
|
||||||
|
@ -1124,9 +1126,9 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
||||||
* on to the segments in {@link Path} items, the children of {@link Group}
|
* on to the segments in {@link Path} items, the children of {@link Group}
|
||||||
* items, etc.).
|
* items, etc.).
|
||||||
*
|
*
|
||||||
|
* @bean
|
||||||
* @type Boolean
|
* @type Boolean
|
||||||
* @default true
|
* @default true
|
||||||
* @bean
|
|
||||||
*/
|
*/
|
||||||
getApplyMatrix: function() {
|
getApplyMatrix: function() {
|
||||||
return this._applyMatrix;
|
return this._applyMatrix;
|
||||||
|
@ -1691,8 +1693,8 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
||||||
* @option [options.tolerance={@link PaperScope#settings}.hitTolerance]
|
* @option [options.tolerance={@link PaperScope#settings}.hitTolerance]
|
||||||
* {Number} the tolerance of the hit-test
|
* {Number} the tolerance of the hit-test
|
||||||
* @option options.class {Function} only hit-test again a certain item class
|
* @option options.class {Function} only hit-test again a certain item class
|
||||||
* and its sub-classes: {@code Group, Layer, Path, CompoundPath, Shape,
|
* and its sub-classes: {@values Group, Layer, Path, CompoundPath,
|
||||||
* Raster, PlacedSymbol, PointText}, etc
|
* Shape, Raster, PlacedSymbol, PointText, ...}
|
||||||
* @option options.fill {Boolean} hit-test the fill of items
|
* @option options.fill {Boolean} hit-test the fill of items
|
||||||
* @option options.stroke {Boolean} hit-test the stroke of path items,
|
* @option options.stroke {Boolean} hit-test the stroke of path items,
|
||||||
* taking into account the setting of stroke color and width
|
* taking into account the setting of stroke color and width
|
||||||
|
@ -2754,8 +2756,9 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
||||||
*
|
*
|
||||||
* @name Item#strokeCap
|
* @name Item#strokeCap
|
||||||
* @property
|
* @property
|
||||||
|
* @type String
|
||||||
|
* @values 'round', 'square', 'butt'
|
||||||
* @default 'butt'
|
* @default 'butt'
|
||||||
* @type String('round', 'square', 'butt')
|
|
||||||
*
|
*
|
||||||
* @example {@paperscript height=200}
|
* @example {@paperscript height=200}
|
||||||
* // A look at the different stroke caps:
|
* // A look at the different stroke caps:
|
||||||
|
@ -2787,9 +2790,9 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
||||||
*
|
*
|
||||||
* @name Item#strokeJoin
|
* @name Item#strokeJoin
|
||||||
* @property
|
* @property
|
||||||
|
* @type String
|
||||||
|
* @values 'miter', 'round', 'bevel'
|
||||||
* @default 'miter'
|
* @default 'miter'
|
||||||
* @type String('miter', 'round', 'bevel')
|
|
||||||
*
|
|
||||||
*
|
*
|
||||||
* @example {@paperscript height=120}
|
* @example {@paperscript height=120}
|
||||||
* // A look at the different stroke joins:
|
* // A look at the different stroke joins:
|
||||||
|
@ -2815,8 +2818,8 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
||||||
*
|
*
|
||||||
* @name Item#dashOffset
|
* @name Item#dashOffset
|
||||||
* @property
|
* @property
|
||||||
* @default 0
|
|
||||||
* @type Number
|
* @type Number
|
||||||
|
* @default 0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2826,8 +2829,8 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
||||||
*
|
*
|
||||||
* @name Item#strokeScaling
|
* @name Item#strokeScaling
|
||||||
* @property
|
* @property
|
||||||
* @default true
|
|
||||||
* @type Boolean
|
* @type Boolean
|
||||||
|
* @default true
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2846,8 +2849,8 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
||||||
*
|
*
|
||||||
* @name Item#dashArray
|
* @name Item#dashArray
|
||||||
* @property
|
* @property
|
||||||
* @default []
|
|
||||||
* @type Array
|
* @type Array
|
||||||
|
* @default []
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2860,8 +2863,8 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
||||||
*
|
*
|
||||||
* @name Item#miterLimit
|
* @name Item#miterLimit
|
||||||
* @property
|
* @property
|
||||||
* @default 10
|
|
||||||
* @type Number
|
* @type Number
|
||||||
|
* @default 10
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2893,8 +2896,9 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
||||||
*
|
*
|
||||||
* @name Item#fillRule
|
* @name Item#fillRule
|
||||||
* @property
|
* @property
|
||||||
|
* @type String
|
||||||
|
* @values 'nonzero', 'evenodd'
|
||||||
* @default 'nonzero'
|
* @default 'nonzero'
|
||||||
* @type String('nonzero', 'evenodd')
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2926,18 +2930,18 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
||||||
* The shadow's blur radius.
|
* The shadow's blur radius.
|
||||||
*
|
*
|
||||||
* @property
|
* @property
|
||||||
* @default 0
|
|
||||||
* @name Item#shadowBlur
|
* @name Item#shadowBlur
|
||||||
* @type Number
|
* @type Number
|
||||||
|
* @default 0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The shadow's offset.
|
* The shadow's offset.
|
||||||
*
|
*
|
||||||
* @property
|
* @property
|
||||||
* @default 0
|
|
||||||
* @name Item#shadowOffset
|
* @name Item#shadowOffset
|
||||||
* @type Point
|
* @type Point
|
||||||
|
* @default 0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// TODO: Find a better name than selectedColor. It should also be used for
|
// TODO: Find a better name than selectedColor. It should also be used for
|
||||||
|
@ -3440,6 +3444,31 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The function to be called when the mouse position changes while the mouse
|
||||||
|
* is being dragged over the item. The function receives a {@link
|
||||||
|
* MouseEvent} object which contains information about the mouse event.
|
||||||
|
*
|
||||||
|
* @name Item#onMouseDrag
|
||||||
|
* @property
|
||||||
|
* @type Function
|
||||||
|
*
|
||||||
|
* @example {@paperscript height=240}
|
||||||
|
* // Press and drag the mouse on the blue circle to move it:
|
||||||
|
*
|
||||||
|
* // Create a circle shaped path at the center of the view:
|
||||||
|
* var path = new Path.Circle({
|
||||||
|
* center: view.center,
|
||||||
|
* radius: 50,
|
||||||
|
* fillColor: 'blue'
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* // Install a drag event handler that moves the path along.
|
||||||
|
* path.onMouseDrag = function(event) {
|
||||||
|
* path.position += event.delta;
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The function to be called when the mouse button is released over the item.
|
* The function to be called when the mouse button is released over the item.
|
||||||
* The function receives a {@link MouseEvent} object which contains
|
* The function receives a {@link MouseEvent} object which contains
|
||||||
|
@ -3676,11 +3705,12 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
||||||
*
|
*
|
||||||
* @name Item#on
|
* @name Item#on
|
||||||
* @function
|
* @function
|
||||||
* @param {String('mousedown', 'mouseup', 'mousedrag', 'click',
|
* @param {String} type the type of event: {@values 'frame', mousedown',
|
||||||
* 'doubleclick', 'mousemove', 'mouseenter', 'mouseleave')} type the event
|
* 'mouseup', 'mousedrag', 'click', 'doubleclick', 'mousemove',
|
||||||
* type
|
* 'mouseenter', 'mouseleave'}
|
||||||
* @param {Function} function The function to be called when the event
|
* @param {Function} function the function to be called when the event
|
||||||
* occurs
|
* occurs, receiving a {@link MouseEvent} or {@link Event} object as its
|
||||||
|
* sole argument
|
||||||
* @return {Item} this item itself, so calls can be chained
|
* @return {Item} this item itself, so calls can be chained
|
||||||
*
|
*
|
||||||
* @example {@paperscript}
|
* @example {@paperscript}
|
||||||
|
@ -3710,8 +3740,8 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
||||||
* @name Item#on
|
* @name Item#on
|
||||||
* @function
|
* @function
|
||||||
* @param {Object} object an object literal containing one or more of the
|
* @param {Object} object an object literal containing one or more of the
|
||||||
* following properties: {@code mousedown, mouseup, mousedrag, click,
|
* following properties: {@values frame, mousedown, mouseup, mousedrag,
|
||||||
* doubleclick, mousemove, mouseenter, mouseleave}
|
* click, doubleclick, mousemove, mouseenter, mouseleave}
|
||||||
* @return {Item} this item itself, so calls can be chained
|
* @return {Item} this item itself, so calls can be chained
|
||||||
*
|
*
|
||||||
* @example {@paperscript}
|
* @example {@paperscript}
|
||||||
|
@ -3767,10 +3797,10 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
||||||
*
|
*
|
||||||
* @name Item#off
|
* @name Item#off
|
||||||
* @function
|
* @function
|
||||||
* @param {String('mousedown', 'mouseup', 'mousedrag', 'click',
|
* @param {String} type the type of event: {@values 'frame', mousedown',
|
||||||
* 'doubleclick', 'mousemove', 'mouseenter', 'mouseleave')} type the event
|
* 'mouseup', 'mousedrag', 'click', 'doubleclick', 'mousemove',
|
||||||
* type
|
* 'mouseenter', 'mouseleave'}
|
||||||
* @param {Function} function The function to be detached
|
* @param {Function} function the function to be detached
|
||||||
* @return {Item} this item itself, so calls can be chained
|
* @return {Item} this item itself, so calls can be chained
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
|
@ -3779,8 +3809,8 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
||||||
* @name Item#off
|
* @name Item#off
|
||||||
* @function
|
* @function
|
||||||
* @param {Object} object an object literal containing one or more of the
|
* @param {Object} object an object literal containing one or more of the
|
||||||
* following properties: {@code mousedown, mouseup, mousedrag, click,
|
* following properties: {@values frame, mousedown, mouseup, mousedrag,
|
||||||
* doubleclick, mousemove, mouseenter, mouseleave}
|
* click, doubleclick, mousemove, mouseenter, mouseleave}
|
||||||
* @return {Item} this item itself, so calls can be chained
|
* @return {Item} this item itself, so calls can be chained
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -3789,9 +3819,9 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
||||||
*
|
*
|
||||||
* @name Item#emit
|
* @name Item#emit
|
||||||
* @function
|
* @function
|
||||||
* @param {String('mousedown', 'mouseup', 'mousedrag', 'click',
|
* @param {String} type the type of event: {@values 'frame', mousedown',
|
||||||
* 'doubleclick', 'mousemove', 'mouseenter', 'mouseleave')} type the event
|
* 'mouseup', 'mousedrag', 'click', 'doubleclick', 'mousemove',
|
||||||
* type
|
* 'mouseenter', 'mouseleave'}
|
||||||
* @param {Object} event an object literal containing properties describing
|
* @param {Object} event an object literal containing properties describing
|
||||||
* the event
|
* the event
|
||||||
* @return {Boolean} {@true if the event had listeners}
|
* @return {Boolean} {@true if the event had listeners}
|
||||||
|
@ -3802,9 +3832,9 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
||||||
*
|
*
|
||||||
* @name Item#responds
|
* @name Item#responds
|
||||||
* @function
|
* @function
|
||||||
* @param {String('mousedown', 'mouseup', 'mousedrag', 'click',
|
* @param {String} type the type of event: {@values 'frame', mousedown',
|
||||||
* 'doubleclick', 'mousemove', 'mouseenter', 'mouseleave')} type the event
|
* 'mouseup', 'mousedrag', 'click', 'doubleclick', 'mousemove',
|
||||||
* type
|
* 'mouseenter', 'mouseleave'}
|
||||||
* @return {Boolean} {@true if the item has one or more event handlers of
|
* @return {Boolean} {@true if the item has one or more event handlers of
|
||||||
* the specified type}
|
* the specified type}
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -91,8 +91,8 @@ var PlacedSymbol = Item.extend(/** @lends PlacedSymbol# */{
|
||||||
/**
|
/**
|
||||||
* The symbol that the placed symbol refers to.
|
* The symbol that the placed symbol refers to.
|
||||||
*
|
*
|
||||||
* @type Symbol
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Symbol
|
||||||
*/
|
*/
|
||||||
getSymbol: function() {
|
getSymbol: function() {
|
||||||
return this._symbol;
|
return this._symbol;
|
||||||
|
|
|
@ -120,8 +120,8 @@ var Raster = Item.extend(/** @lends Raster# */{
|
||||||
/**
|
/**
|
||||||
* The size of the raster in pixels.
|
* The size of the raster in pixels.
|
||||||
*
|
*
|
||||||
* @type Size
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Size
|
||||||
*/
|
*/
|
||||||
getSize: function() {
|
getSize: function() {
|
||||||
var size = this._size;
|
var size = this._size;
|
||||||
|
@ -155,8 +155,8 @@ var Raster = Item.extend(/** @lends Raster# */{
|
||||||
/**
|
/**
|
||||||
* The width of the raster in pixels.
|
* The width of the raster in pixels.
|
||||||
*
|
*
|
||||||
* @type Number
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Number
|
||||||
*/
|
*/
|
||||||
getWidth: function() {
|
getWidth: function() {
|
||||||
return this._size ? this._size.width : 0;
|
return this._size ? this._size.width : 0;
|
||||||
|
@ -169,8 +169,8 @@ var Raster = Item.extend(/** @lends Raster# */{
|
||||||
/**
|
/**
|
||||||
* The height of the raster in pixels.
|
* The height of the raster in pixels.
|
||||||
*
|
*
|
||||||
* @type Number
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Number
|
||||||
*/
|
*/
|
||||||
getHeight: function() {
|
getHeight: function() {
|
||||||
return this._size ? this._size.height : 0;
|
return this._size ? this._size.height : 0;
|
||||||
|
@ -189,8 +189,8 @@ var Raster = Item.extend(/** @lends Raster# */{
|
||||||
* The resolution of the raster at its current size, in PPI (pixels per
|
* The resolution of the raster at its current size, in PPI (pixels per
|
||||||
* inch).
|
* inch).
|
||||||
*
|
*
|
||||||
* @type Size
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Size
|
||||||
*/
|
*/
|
||||||
getResolution: function() {
|
getResolution: function() {
|
||||||
var matrix = this._matrix,
|
var matrix = this._matrix,
|
||||||
|
@ -213,8 +213,8 @@ var Raster = Item.extend(/** @lends Raster# */{
|
||||||
/**
|
/**
|
||||||
* The HTMLImageElement of the raster, if one is associated.
|
* The HTMLImageElement of the raster, if one is associated.
|
||||||
*
|
*
|
||||||
* @type HTMLImageElement|Canvas
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type HTMLImageElement|Canvas
|
||||||
*/
|
*/
|
||||||
getImage: function() {
|
getImage: function() {
|
||||||
return this._image;
|
return this._image;
|
||||||
|
@ -252,8 +252,8 @@ var Raster = Item.extend(/** @lends Raster# */{
|
||||||
* image into it. Depending on security policies, this might fail, in which
|
* image into it. Depending on security policies, this might fail, in which
|
||||||
* case `null` is returned instead.
|
* case `null` is returned instead.
|
||||||
*
|
*
|
||||||
* @type Canvas
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Canvas
|
||||||
*/
|
*/
|
||||||
getCanvas: function() {
|
getCanvas: function() {
|
||||||
if (!this._canvas) {
|
if (!this._canvas) {
|
||||||
|
@ -277,8 +277,8 @@ var Raster = Item.extend(/** @lends Raster# */{
|
||||||
/**
|
/**
|
||||||
* The Canvas 2D drawing context of the raster.
|
* The Canvas 2D drawing context of the raster.
|
||||||
*
|
*
|
||||||
* @type Context
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Context
|
||||||
*/
|
*/
|
||||||
getContext: function(modify) {
|
getContext: function(modify) {
|
||||||
if (!this._context)
|
if (!this._context)
|
||||||
|
|
|
@ -48,8 +48,9 @@ var Shape = Item.extend(/** @lends Shape# */{
|
||||||
/**
|
/**
|
||||||
* The type of shape of the item as a string.
|
* The type of shape of the item as a string.
|
||||||
*
|
*
|
||||||
* @type String('rectangle', 'circle', 'ellipse')
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type String
|
||||||
|
* @values 'rectangle', 'circle', 'ellipse'
|
||||||
*/
|
*/
|
||||||
getType: function() {
|
getType: function() {
|
||||||
return this._type;
|
return this._type;
|
||||||
|
@ -70,8 +71,8 @@ var Shape = Item.extend(/** @lends Shape# */{
|
||||||
/**
|
/**
|
||||||
* The size of the shape.
|
* The size of the shape.
|
||||||
*
|
*
|
||||||
* @type Size
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Size
|
||||||
*/
|
*/
|
||||||
getSize: function() {
|
getSize: function() {
|
||||||
var size = this._size;
|
var size = this._size;
|
||||||
|
@ -109,8 +110,8 @@ var Shape = Item.extend(/** @lends Shape# */{
|
||||||
* The radius of the shape, as a number if it is a circle, or a size object
|
* The radius of the shape, as a number if it is a circle, or a size object
|
||||||
* for ellipses and rounded rectangles.
|
* for ellipses and rounded rectangles.
|
||||||
*
|
*
|
||||||
* @type Number|Size
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Number|Size
|
||||||
*/
|
*/
|
||||||
getRadius: function() {
|
getRadius: function() {
|
||||||
var rad = this._radius;
|
var rad = this._radius;
|
||||||
|
|
|
@ -13,10 +13,15 @@
|
||||||
/**
|
/**
|
||||||
* @name CompoundPath
|
* @name CompoundPath
|
||||||
*
|
*
|
||||||
* @class A compound path contains two or more paths, holes are drawn
|
* @class A compound path is a complex path that is made up of one or more
|
||||||
* where the paths overlap. All the paths in a compound path take on the
|
* simple sub-paths. It can have the `nonzero` fill rule, or the `evenodd` rule
|
||||||
* style of the backmost path and can be accessed through its
|
* applied. Both rules use mathematical equations to determine if any region is
|
||||||
* {@link Item#children} list.
|
* outside or inside the final shape. The `evenodd` rule is more predictable:
|
||||||
|
* Every other region within a such a compound path is a hole, regardless of
|
||||||
|
* path direction.
|
||||||
|
*
|
||||||
|
* All the paths in a compound path take on the style of the compound path and
|
||||||
|
* can be accessed through its {@link Item#children} list.
|
||||||
*
|
*
|
||||||
* @extends PathItem
|
* @extends PathItem
|
||||||
*/
|
*/
|
||||||
|
@ -163,8 +168,8 @@ var CompoundPath = PathItem.extend(/** @lends CompoundPath# */{
|
||||||
/**
|
/**
|
||||||
* Specifies whether the compound path is oriented clock-wise.
|
* Specifies whether the compound path is oriented clock-wise.
|
||||||
*
|
*
|
||||||
* @type Boolean
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Boolean
|
||||||
*/
|
*/
|
||||||
isClockwise: function() {
|
isClockwise: function() {
|
||||||
var child = this.getFirstChild();
|
var child = this.getFirstChild();
|
||||||
|
@ -180,8 +185,8 @@ var CompoundPath = PathItem.extend(/** @lends CompoundPath# */{
|
||||||
/**
|
/**
|
||||||
* The first Segment contained within the path.
|
* The first Segment contained within the path.
|
||||||
*
|
*
|
||||||
* @type Segment
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Segment
|
||||||
*/
|
*/
|
||||||
getFirstSegment: function() {
|
getFirstSegment: function() {
|
||||||
var first = this.getFirstChild();
|
var first = this.getFirstChild();
|
||||||
|
@ -191,8 +196,8 @@ var CompoundPath = PathItem.extend(/** @lends CompoundPath# */{
|
||||||
/**
|
/**
|
||||||
* The last Segment contained within the path.
|
* The last Segment contained within the path.
|
||||||
*
|
*
|
||||||
* @type Segment
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Segment
|
||||||
*/
|
*/
|
||||||
getLastSegment: function() {
|
getLastSegment: function() {
|
||||||
var last = this.getLastChild();
|
var last = this.getLastChild();
|
||||||
|
@ -203,8 +208,8 @@ var CompoundPath = PathItem.extend(/** @lends CompoundPath# */{
|
||||||
* All the curves contained within the compound-path, from all its child
|
* All the curves contained within the compound-path, from all its child
|
||||||
* {@link Path} items.
|
* {@link Path} items.
|
||||||
*
|
*
|
||||||
* @type Curve[]
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Curve[]
|
||||||
*/
|
*/
|
||||||
getCurves: function() {
|
getCurves: function() {
|
||||||
var children = this._children,
|
var children = this._children,
|
||||||
|
@ -217,8 +222,8 @@ var CompoundPath = PathItem.extend(/** @lends CompoundPath# */{
|
||||||
/**
|
/**
|
||||||
* The first Curve contained within the path.
|
* The first Curve contained within the path.
|
||||||
*
|
*
|
||||||
* @type Curve
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Curve
|
||||||
*/
|
*/
|
||||||
getFirstCurve: function() {
|
getFirstCurve: function() {
|
||||||
var first = this.getFirstChild();
|
var first = this.getFirstChild();
|
||||||
|
@ -228,8 +233,8 @@ var CompoundPath = PathItem.extend(/** @lends CompoundPath# */{
|
||||||
/**
|
/**
|
||||||
* The last Curve contained within the path.
|
* The last Curve contained within the path.
|
||||||
*
|
*
|
||||||
* @type Curve
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Curve
|
||||||
*/
|
*/
|
||||||
getLastCurve: function() {
|
getLastCurve: function() {
|
||||||
var last = this.getLastChild();
|
var last = this.getLastChild();
|
||||||
|
@ -240,8 +245,8 @@ var CompoundPath = PathItem.extend(/** @lends CompoundPath# */{
|
||||||
* The area that the path's geometry is covering. Self-intersecting paths
|
* The area that the path's geometry is covering. Self-intersecting paths
|
||||||
* can contain sub-areas that cancel each other out.
|
* can contain sub-areas that cancel each other out.
|
||||||
*
|
*
|
||||||
* @type Number
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Number
|
||||||
*/
|
*/
|
||||||
getArea: function() {
|
getArea: function() {
|
||||||
var children = this._children,
|
var children = this._children,
|
||||||
|
|
|
@ -174,8 +174,8 @@ var Curve = Base.extend(/** @lends Curve# */{
|
||||||
/**
|
/**
|
||||||
* The first anchor point of the curve.
|
* The first anchor point of the curve.
|
||||||
*
|
*
|
||||||
* @type Point
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Point
|
||||||
*/
|
*/
|
||||||
getPoint1: function() {
|
getPoint1: function() {
|
||||||
return this._segment1._point;
|
return this._segment1._point;
|
||||||
|
@ -189,8 +189,8 @@ var Curve = Base.extend(/** @lends Curve# */{
|
||||||
/**
|
/**
|
||||||
* The second anchor point of the curve.
|
* The second anchor point of the curve.
|
||||||
*
|
*
|
||||||
* @type Point
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Point
|
||||||
*/
|
*/
|
||||||
getPoint2: function() {
|
getPoint2: function() {
|
||||||
return this._segment2._point;
|
return this._segment2._point;
|
||||||
|
@ -204,8 +204,8 @@ var Curve = Base.extend(/** @lends Curve# */{
|
||||||
/**
|
/**
|
||||||
* The handle point that describes the tangent in the first anchor point.
|
* The handle point that describes the tangent in the first anchor point.
|
||||||
*
|
*
|
||||||
* @type Point
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Point
|
||||||
*/
|
*/
|
||||||
getHandle1: function() {
|
getHandle1: function() {
|
||||||
return this._segment1._handleOut;
|
return this._segment1._handleOut;
|
||||||
|
@ -219,8 +219,8 @@ var Curve = Base.extend(/** @lends Curve# */{
|
||||||
/**
|
/**
|
||||||
* The handle point that describes the tangent in the second anchor point.
|
* The handle point that describes the tangent in the second anchor point.
|
||||||
*
|
*
|
||||||
* @type Point
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Point
|
||||||
*/
|
*/
|
||||||
getHandle2: function() {
|
getHandle2: function() {
|
||||||
return this._segment2._handleIn;
|
return this._segment2._handleIn;
|
||||||
|
@ -234,8 +234,8 @@ var Curve = Base.extend(/** @lends Curve# */{
|
||||||
/**
|
/**
|
||||||
* The first segment of the curve.
|
* The first segment of the curve.
|
||||||
*
|
*
|
||||||
* @type Segment
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Segment
|
||||||
*/
|
*/
|
||||||
getSegment1: function() {
|
getSegment1: function() {
|
||||||
return this._segment1;
|
return this._segment1;
|
||||||
|
@ -244,8 +244,8 @@ var Curve = Base.extend(/** @lends Curve# */{
|
||||||
/**
|
/**
|
||||||
* The second segment of the curve.
|
* The second segment of the curve.
|
||||||
*
|
*
|
||||||
* @type Segment
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Segment
|
||||||
*/
|
*/
|
||||||
getSegment2: function() {
|
getSegment2: function() {
|
||||||
return this._segment2;
|
return this._segment2;
|
||||||
|
@ -254,8 +254,8 @@ var Curve = Base.extend(/** @lends Curve# */{
|
||||||
/**
|
/**
|
||||||
* The path that the curve belongs to.
|
* The path that the curve belongs to.
|
||||||
*
|
*
|
||||||
* @type Path
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Path
|
||||||
*/
|
*/
|
||||||
getPath: function() {
|
getPath: function() {
|
||||||
return this._path;
|
return this._path;
|
||||||
|
@ -264,8 +264,8 @@ var Curve = Base.extend(/** @lends Curve# */{
|
||||||
/**
|
/**
|
||||||
* The index of the curve in the {@link Path#curves} array.
|
* The index of the curve in the {@link Path#curves} array.
|
||||||
*
|
*
|
||||||
* @type Number
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Number
|
||||||
*/
|
*/
|
||||||
getIndex: function() {
|
getIndex: function() {
|
||||||
return this._segment1._index;
|
return this._segment1._index;
|
||||||
|
@ -275,8 +275,8 @@ var Curve = Base.extend(/** @lends Curve# */{
|
||||||
* The next curve in the {@link Path#curves} array that the curve
|
* The next curve in the {@link Path#curves} array that the curve
|
||||||
* belongs to.
|
* belongs to.
|
||||||
*
|
*
|
||||||
* @type Curve
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Curve
|
||||||
*/
|
*/
|
||||||
getNext: function() {
|
getNext: function() {
|
||||||
var curves = this._path && this._path._curves;
|
var curves = this._path && this._path._curves;
|
||||||
|
@ -288,8 +288,8 @@ var Curve = Base.extend(/** @lends Curve# */{
|
||||||
* The previous curve in the {@link Path#curves} array that the curve
|
* The previous curve in the {@link Path#curves} array that the curve
|
||||||
* belongs to.
|
* belongs to.
|
||||||
*
|
*
|
||||||
* @type Curve
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Curve
|
||||||
*/
|
*/
|
||||||
getPrevious: function() {
|
getPrevious: function() {
|
||||||
var curves = this._path && this._path._curves;
|
var curves = this._path && this._path._curves;
|
||||||
|
@ -320,8 +320,8 @@ var Curve = Base.extend(/** @lends Curve# */{
|
||||||
/**
|
/**
|
||||||
* Specifies whether the points and handles of the curve are selected.
|
* Specifies whether the points and handles of the curve are selected.
|
||||||
*
|
*
|
||||||
* @type Boolean
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Boolean
|
||||||
*/
|
*/
|
||||||
isSelected: function() {
|
isSelected: function() {
|
||||||
return this.getPoint1().isSelected()
|
return this.getPoint1().isSelected()
|
||||||
|
@ -345,8 +345,8 @@ var Curve = Base.extend(/** @lends Curve# */{
|
||||||
*
|
*
|
||||||
* Note that the handles are converted to absolute coordinates.
|
* Note that the handles are converted to absolute coordinates.
|
||||||
*
|
*
|
||||||
* @type Number[]
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Number[]
|
||||||
*/
|
*/
|
||||||
getValues: function(matrix) {
|
getValues: function(matrix) {
|
||||||
return Curve.getValues(this._segment1, this._segment2, matrix);
|
return Curve.getValues(this._segment1, this._segment2, matrix);
|
||||||
|
@ -358,8 +358,8 @@ var Curve = Base.extend(/** @lends Curve# */{
|
||||||
*
|
*
|
||||||
* Note that the handles are converted to absolute coordinates.
|
* Note that the handles are converted to absolute coordinates.
|
||||||
*
|
*
|
||||||
* @type Point[]
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Point[]
|
||||||
*/
|
*/
|
||||||
getPoints: function() {
|
getPoints: function() {
|
||||||
// Convert to array of absolute points
|
// Convert to array of absolute points
|
||||||
|
@ -373,8 +373,8 @@ var Curve = Base.extend(/** @lends Curve# */{
|
||||||
/**
|
/**
|
||||||
* The approximated length of the curve.
|
* The approximated length of the curve.
|
||||||
*
|
*
|
||||||
* @type Number
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Number
|
||||||
*/
|
*/
|
||||||
getLength: function() {
|
getLength: function() {
|
||||||
if (this._length == null)
|
if (this._length == null)
|
||||||
|
@ -385,16 +385,16 @@ var Curve = Base.extend(/** @lends Curve# */{
|
||||||
/**
|
/**
|
||||||
* The area that the curve's geometry is covering.
|
* The area that the curve's geometry is covering.
|
||||||
*
|
*
|
||||||
* @type Number
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Number
|
||||||
*/
|
*/
|
||||||
getArea: function() {
|
getArea: function() {
|
||||||
return Curve.getArea(this.getValues());
|
return Curve.getArea(this.getValues());
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type Line
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Line
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
getLine: function() {
|
getLine: function() {
|
||||||
|
|
|
@ -92,8 +92,8 @@ var CurveLocation = Base.extend(/** @lends CurveLocation# */{
|
||||||
/**
|
/**
|
||||||
* The segment of the curve which is closer to the described location.
|
* The segment of the curve which is closer to the described location.
|
||||||
*
|
*
|
||||||
* @type Segment
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Segment
|
||||||
*/
|
*/
|
||||||
getSegment: function() {
|
getSegment: function() {
|
||||||
// Request curve first, so _segment gets invalidated if it's out of sync
|
// Request curve first, so _segment gets invalidated if it's out of sync
|
||||||
|
@ -120,8 +120,8 @@ var CurveLocation = Base.extend(/** @lends CurveLocation# */{
|
||||||
/**
|
/**
|
||||||
* The curve that this location belongs to.
|
* The curve that this location belongs to.
|
||||||
*
|
*
|
||||||
* @type Curve
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Curve
|
||||||
*/
|
*/
|
||||||
getCurve: function() {
|
getCurve: function() {
|
||||||
var path = this._path,
|
var path = this._path,
|
||||||
|
@ -157,8 +157,8 @@ var CurveLocation = Base.extend(/** @lends CurveLocation# */{
|
||||||
/**
|
/**
|
||||||
* The path that this locations is situated on.
|
* The path that this locations is situated on.
|
||||||
*
|
*
|
||||||
* @type Item
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Item
|
||||||
*/
|
*/
|
||||||
getPath: function() {
|
getPath: function() {
|
||||||
var curve = this.getCurve();
|
var curve = this.getCurve();
|
||||||
|
@ -169,8 +169,8 @@ var CurveLocation = Base.extend(/** @lends CurveLocation# */{
|
||||||
* The index of the {@link #curve} within the {@link Path#curves} list, if
|
* The index of the {@link #curve} within the {@link Path#curves} list, if
|
||||||
* it is part of a {@link Path} item.
|
* it is part of a {@link Path} item.
|
||||||
*
|
*
|
||||||
* @type Index
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Index
|
||||||
*/
|
*/
|
||||||
getIndex: function() {
|
getIndex: function() {
|
||||||
var curve = this.getCurve();
|
var curve = this.getCurve();
|
||||||
|
@ -182,8 +182,8 @@ var CurveLocation = Base.extend(/** @lends CurveLocation# */{
|
||||||
* It is value between `0` (beginning of the curve) and `1` (end of the
|
* It is value between `0` (beginning of the curve) and `1` (end of the
|
||||||
* curve).
|
* curve).
|
||||||
*
|
*
|
||||||
* @type Number
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Number
|
||||||
*/
|
*/
|
||||||
getParameter: function() {
|
getParameter: function() {
|
||||||
var curve = this.getCurve(),
|
var curve = this.getCurve(),
|
||||||
|
@ -197,8 +197,8 @@ var CurveLocation = Base.extend(/** @lends CurveLocation# */{
|
||||||
* The point which is defined by the {@link #curve} and
|
* The point which is defined by the {@link #curve} and
|
||||||
* {@link #parameter}.
|
* {@link #parameter}.
|
||||||
*
|
*
|
||||||
* @type Point
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Point
|
||||||
*/
|
*/
|
||||||
getPoint: function() {
|
getPoint: function() {
|
||||||
return this._point;
|
return this._point;
|
||||||
|
@ -209,8 +209,8 @@ var CurveLocation = Base.extend(/** @lends CurveLocation# */{
|
||||||
* by this object. If the curve is not part of a path, then the length
|
* by this object. If the curve is not part of a path, then the length
|
||||||
* within the curve is returned instead.
|
* within the curve is returned instead.
|
||||||
*
|
*
|
||||||
* @type Number
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Number
|
||||||
*/
|
*/
|
||||||
getOffset: function() {
|
getOffset: function() {
|
||||||
var offset = this._offset;
|
var offset = this._offset;
|
||||||
|
@ -232,8 +232,8 @@ var CurveLocation = Base.extend(/** @lends CurveLocation# */{
|
||||||
* The length of the curve from its beginning up to the location described
|
* The length of the curve from its beginning up to the location described
|
||||||
* by this object.
|
* by this object.
|
||||||
*
|
*
|
||||||
* @type Number
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Number
|
||||||
*/
|
*/
|
||||||
getCurveOffset: function() {
|
getCurveOffset: function() {
|
||||||
var curve = this.getCurve(),
|
var curve = this.getCurve(),
|
||||||
|
@ -246,8 +246,8 @@ var CurveLocation = Base.extend(/** @lends CurveLocation# */{
|
||||||
* result of a call to {@link PathItem#getIntersections(path)} /
|
* result of a call to {@link PathItem#getIntersections(path)} /
|
||||||
* {@link Curve#getIntersections(curve)}.
|
* {@link Curve#getIntersections(curve)}.
|
||||||
*
|
*
|
||||||
* @type CurveLocation
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type CurveLocation
|
||||||
*/
|
*/
|
||||||
getIntersection: function() {
|
getIntersection: function() {
|
||||||
return this._intersection;
|
return this._intersection;
|
||||||
|
@ -257,31 +257,31 @@ var CurveLocation = Base.extend(/** @lends CurveLocation# */{
|
||||||
* The tangential vector to the {@link #curve} at the given location.
|
* The tangential vector to the {@link #curve} at the given location.
|
||||||
*
|
*
|
||||||
* @name CurveLocation#getTangent
|
* @name CurveLocation#getTangent
|
||||||
* @type Point
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Point
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The normal vector to the {@link #curve} at the given location.
|
* The normal vector to the {@link #curve} at the given location.
|
||||||
*
|
*
|
||||||
* @name CurveLocation#getNormal
|
* @name CurveLocation#getNormal
|
||||||
* @type Point
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Point
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The curvature of the {@link #curve} at the given location.
|
* The curvature of the {@link #curve} at the given location.
|
||||||
*
|
*
|
||||||
* @name CurveLocation#getCurvature
|
* @name CurveLocation#getCurvature
|
||||||
* @type Number
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Number
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The distance from the queried point to the returned location.
|
* The distance from the queried point to the returned location.
|
||||||
*
|
*
|
||||||
* @type Number
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Number
|
||||||
* @see Curve#getNearestLocation(point)
|
* @see Curve#getNearestLocation(point)
|
||||||
* @see Path#getNearestLocation(point)
|
* @see Path#getNearestLocation(point)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -176,8 +176,8 @@ var Path = PathItem.extend(/** @lends Path# */{
|
||||||
/**
|
/**
|
||||||
* The segments contained within the path.
|
* The segments contained within the path.
|
||||||
*
|
*
|
||||||
* @type Segment[]
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Segment[]
|
||||||
*/
|
*/
|
||||||
getSegments: function() {
|
getSegments: function() {
|
||||||
return this._segments;
|
return this._segments;
|
||||||
|
@ -200,8 +200,8 @@ var Path = PathItem.extend(/** @lends Path# */{
|
||||||
/**
|
/**
|
||||||
* The first Segment contained within the path.
|
* The first Segment contained within the path.
|
||||||
*
|
*
|
||||||
* @type Segment
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Segment
|
||||||
*/
|
*/
|
||||||
getFirstSegment: function() {
|
getFirstSegment: function() {
|
||||||
return this._segments[0];
|
return this._segments[0];
|
||||||
|
@ -210,8 +210,8 @@ var Path = PathItem.extend(/** @lends Path# */{
|
||||||
/**
|
/**
|
||||||
* The last Segment contained within the path.
|
* The last Segment contained within the path.
|
||||||
*
|
*
|
||||||
* @type Segment
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Segment
|
||||||
*/
|
*/
|
||||||
getLastSegment: function() {
|
getLastSegment: function() {
|
||||||
return this._segments[this._segments.length - 1];
|
return this._segments[this._segments.length - 1];
|
||||||
|
@ -220,8 +220,8 @@ var Path = PathItem.extend(/** @lends Path# */{
|
||||||
/**
|
/**
|
||||||
* The curves contained within the path.
|
* The curves contained within the path.
|
||||||
*
|
*
|
||||||
* @type Curve[]
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Curve[]
|
||||||
*/
|
*/
|
||||||
getCurves: function() {
|
getCurves: function() {
|
||||||
var curves = this._curves,
|
var curves = this._curves,
|
||||||
|
@ -240,8 +240,8 @@ var Path = PathItem.extend(/** @lends Path# */{
|
||||||
/**
|
/**
|
||||||
* The first Curve contained within the path.
|
* The first Curve contained within the path.
|
||||||
*
|
*
|
||||||
* @type Curve
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Curve
|
||||||
*/
|
*/
|
||||||
getFirstCurve: function() {
|
getFirstCurve: function() {
|
||||||
return this.getCurves()[0];
|
return this.getCurves()[0];
|
||||||
|
@ -250,8 +250,8 @@ var Path = PathItem.extend(/** @lends Path# */{
|
||||||
/**
|
/**
|
||||||
* The last Curve contained within the path.
|
* The last Curve contained within the path.
|
||||||
*
|
*
|
||||||
* @type Curve
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Curve
|
||||||
*/
|
*/
|
||||||
getLastCurve: function() {
|
getLastCurve: function() {
|
||||||
var curves = this.getCurves();
|
var curves = this.getCurves();
|
||||||
|
@ -262,8 +262,8 @@ var Path = PathItem.extend(/** @lends Path# */{
|
||||||
* Specifies whether the path is closed. If it is closed, Paper.js connects
|
* Specifies whether the path is closed. If it is closed, Paper.js connects
|
||||||
* the first and last segments.
|
* the first and last segments.
|
||||||
*
|
*
|
||||||
* @type Boolean
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Boolean
|
||||||
*
|
*
|
||||||
* @example {@paperscript}
|
* @example {@paperscript}
|
||||||
* var myPath = new Path();
|
* var myPath = new Path();
|
||||||
|
@ -805,8 +805,8 @@ var Path = PathItem.extend(/** @lends Path# */{
|
||||||
/**
|
/**
|
||||||
* The approximate length of the path.
|
* The approximate length of the path.
|
||||||
*
|
*
|
||||||
* @type Number
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Number
|
||||||
*/
|
*/
|
||||||
getLength: function() {
|
getLength: function() {
|
||||||
if (this._length == null) {
|
if (this._length == null) {
|
||||||
|
@ -823,8 +823,8 @@ var Path = PathItem.extend(/** @lends Path# */{
|
||||||
* The area that the path's geometry is covering. Self-intersecting paths
|
* The area that the path's geometry is covering. Self-intersecting paths
|
||||||
* can contain sub-areas that cancel each other out.
|
* can contain sub-areas that cancel each other out.
|
||||||
*
|
*
|
||||||
* @type Number
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Number
|
||||||
*/
|
*/
|
||||||
getArea: function() {
|
getArea: function() {
|
||||||
if (this._area == null) {
|
if (this._area == null) {
|
||||||
|
@ -844,8 +844,8 @@ var Path = PathItem.extend(/** @lends Path# */{
|
||||||
/**
|
/**
|
||||||
* Specifies whether the path is oriented clock-wise.
|
* Specifies whether the path is oriented clock-wise.
|
||||||
*
|
*
|
||||||
* @type Boolean
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Boolean
|
||||||
*/
|
*/
|
||||||
isClockwise: function() {
|
isClockwise: function() {
|
||||||
if (this._clockwise !== undefined)
|
if (this._clockwise !== undefined)
|
||||||
|
@ -873,8 +873,8 @@ var Path = PathItem.extend(/** @lends Path# */{
|
||||||
* construction of paths, position of path curves, individual segment points
|
* construction of paths, position of path curves, individual segment points
|
||||||
* and bounding boxes of symbol and raster items.
|
* and bounding boxes of symbol and raster items.
|
||||||
*
|
*
|
||||||
* @type Boolean
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Boolean
|
||||||
* @see Project#selectedItems
|
* @see Project#selectedItems
|
||||||
* @see Segment#selected
|
* @see Segment#selected
|
||||||
* @see Point#selected
|
* @see Point#selected
|
||||||
|
@ -907,8 +907,8 @@ var Path = PathItem.extend(/** @lends Path# */{
|
||||||
* Specifies whether the path and all its segments are selected. Cannot be
|
* Specifies whether the path and all its segments are selected. Cannot be
|
||||||
* `true` on an empty path.
|
* `true` on an empty path.
|
||||||
*
|
*
|
||||||
* @type Boolean
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Boolean
|
||||||
*
|
*
|
||||||
* @example {@paperscript}
|
* @example {@paperscript}
|
||||||
* // A path is fully selected, if all of its segments are selected:
|
* // A path is fully selected, if all of its segments are selected:
|
||||||
|
|
|
@ -981,8 +981,8 @@ Path.inject(/** @lends Path# */{
|
||||||
/**
|
/**
|
||||||
* Returns a point that is guaranteed to be inside the path.
|
* Returns a point that is guaranteed to be inside the path.
|
||||||
*
|
*
|
||||||
* @type Point
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Point
|
||||||
*/
|
*/
|
||||||
getInteriorPoint: function() {
|
getInteriorPoint: function() {
|
||||||
var bounds = this.getBounds(),
|
var bounds = this.getBounds(),
|
||||||
|
|
|
@ -170,8 +170,8 @@ var PathItem = Item.extend(/** @lends PathItem# */{
|
||||||
* The path's geometry, formatted as SVG style path data.
|
* The path's geometry, formatted as SVG style path data.
|
||||||
*
|
*
|
||||||
* @name PathItem#getPathData
|
* @name PathItem#getPathData
|
||||||
* @type String
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type String
|
||||||
*/
|
*/
|
||||||
|
|
||||||
setPathData: function(data) {
|
setPathData: function(data) {
|
||||||
|
|
|
@ -181,8 +181,8 @@ var Segment = Base.extend(/** @lends Segment# */{
|
||||||
/**
|
/**
|
||||||
* The anchor point of the segment.
|
* The anchor point of the segment.
|
||||||
*
|
*
|
||||||
* @type Point
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Point
|
||||||
*/
|
*/
|
||||||
getPoint: function() {
|
getPoint: function() {
|
||||||
return this._point;
|
return this._point;
|
||||||
|
@ -199,8 +199,8 @@ var Segment = Base.extend(/** @lends Segment# */{
|
||||||
* The handle point relative to the anchor point of the segment that
|
* The handle point relative to the anchor point of the segment that
|
||||||
* describes the in tangent of the segment.
|
* describes the in tangent of the segment.
|
||||||
*
|
*
|
||||||
* @type Point
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Point
|
||||||
*/
|
*/
|
||||||
getHandleIn: function() {
|
getHandleIn: function() {
|
||||||
return this._handleIn;
|
return this._handleIn;
|
||||||
|
@ -216,8 +216,8 @@ var Segment = Base.extend(/** @lends Segment# */{
|
||||||
* The handle point relative to the anchor point of the segment that
|
* The handle point relative to the anchor point of the segment that
|
||||||
* describes the out tangent of the segment.
|
* describes the out tangent of the segment.
|
||||||
*
|
*
|
||||||
* @type Point
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Point
|
||||||
*/
|
*/
|
||||||
getHandleOut: function() {
|
getHandleOut: function() {
|
||||||
return this._handleOut;
|
return this._handleOut;
|
||||||
|
@ -255,8 +255,10 @@ var Segment = Base.extend(/** @lends Segment# */{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specifies whether the {@link #point} of the segment is selected.
|
* Specifies whether the {@link #point} of the segment is selected.
|
||||||
* @type Boolean
|
*
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Boolean
|
||||||
|
*
|
||||||
* @example {@paperscript}
|
* @example {@paperscript}
|
||||||
* var path = new Path.Circle({
|
* var path = new Path.Circle({
|
||||||
* center: [80, 50],
|
* center: [80, 50],
|
||||||
|
@ -311,8 +313,8 @@ var Segment = Base.extend(/** @lends Segment# */{
|
||||||
* The index of the segment in the {@link Path#segments} array that the
|
* The index of the segment in the {@link Path#segments} array that the
|
||||||
* segment belongs to.
|
* segment belongs to.
|
||||||
*
|
*
|
||||||
* @type Number
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Number
|
||||||
*/
|
*/
|
||||||
getIndex: function() {
|
getIndex: function() {
|
||||||
return this._index !== undefined ? this._index : null;
|
return this._index !== undefined ? this._index : null;
|
||||||
|
@ -321,8 +323,8 @@ var Segment = Base.extend(/** @lends Segment# */{
|
||||||
/**
|
/**
|
||||||
* The path that the segment belongs to.
|
* The path that the segment belongs to.
|
||||||
*
|
*
|
||||||
* @type Path
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Path
|
||||||
*/
|
*/
|
||||||
getPath: function() {
|
getPath: function() {
|
||||||
return this._path || null;
|
return this._path || null;
|
||||||
|
@ -332,8 +334,8 @@ var Segment = Base.extend(/** @lends Segment# */{
|
||||||
* The curve that the segment belongs to. For the last segment of an open
|
* The curve that the segment belongs to. For the last segment of an open
|
||||||
* path, the previous segment is returned.
|
* path, the previous segment is returned.
|
||||||
*
|
*
|
||||||
* @type Curve
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Curve
|
||||||
*/
|
*/
|
||||||
getCurve: function() {
|
getCurve: function() {
|
||||||
var path = this._path,
|
var path = this._path,
|
||||||
|
@ -351,8 +353,8 @@ var Segment = Base.extend(/** @lends Segment# */{
|
||||||
/**
|
/**
|
||||||
* The curve location that describes this segment's position ont the path.
|
* The curve location that describes this segment's position ont the path.
|
||||||
*
|
*
|
||||||
* @type CurveLocation
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type CurveLocation
|
||||||
*/
|
*/
|
||||||
getLocation: function() {
|
getLocation: function() {
|
||||||
var curve = this.getCurve();
|
var curve = this.getCurve();
|
||||||
|
@ -369,8 +371,8 @@ var Segment = Base.extend(/** @lends Segment# */{
|
||||||
* belongs to. If the segments belongs to a closed path, the first segment
|
* belongs to. If the segments belongs to a closed path, the first segment
|
||||||
* is returned for the last segment of the path.
|
* is returned for the last segment of the path.
|
||||||
*
|
*
|
||||||
* @type Segment
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Segment
|
||||||
*/
|
*/
|
||||||
getNext: function() {
|
getNext: function() {
|
||||||
var segments = this._path && this._path._segments;
|
var segments = this._path && this._path._segments;
|
||||||
|
@ -383,8 +385,8 @@ var Segment = Base.extend(/** @lends Segment# */{
|
||||||
* segment belongs to. If the segments belongs to a closed path, the last
|
* segment belongs to. If the segments belongs to a closed path, the last
|
||||||
* segment is returned for the first segment of the path.
|
* segment is returned for the first segment of the path.
|
||||||
*
|
*
|
||||||
* @type Segment
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Segment
|
||||||
*/
|
*/
|
||||||
getPrevious: function() {
|
getPrevious: function() {
|
||||||
var segments = this._path && this._path._segments;
|
var segments = this._path && this._path._segments;
|
||||||
|
|
|
@ -120,8 +120,9 @@ var Project = PaperScopeItem.extend(/** @lends Project# */{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The reference to the project's view.
|
* The reference to the project's view.
|
||||||
* @type View
|
*
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type View
|
||||||
*/
|
*/
|
||||||
getView: function() {
|
getView: function() {
|
||||||
return this._view;
|
return this._view;
|
||||||
|
@ -131,8 +132,8 @@ var Project = PaperScopeItem.extend(/** @lends Project# */{
|
||||||
* The currently active path style. All selected items and newly
|
* The currently active path style. All selected items and newly
|
||||||
* created items will be styled with this style.
|
* created items will be styled with this style.
|
||||||
*
|
*
|
||||||
* @type Style
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Style
|
||||||
*
|
*
|
||||||
* @example {@paperscript}
|
* @example {@paperscript}
|
||||||
* project.currentStyle = {
|
* project.currentStyle = {
|
||||||
|
@ -165,8 +166,8 @@ var Project = PaperScopeItem.extend(/** @lends Project# */{
|
||||||
/**
|
/**
|
||||||
* The index of the project in the {@link PaperScope#projects} list.
|
* The index of the project in the {@link PaperScope#projects} list.
|
||||||
*
|
*
|
||||||
* @type Number
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Number
|
||||||
*/
|
*/
|
||||||
getIndex: function() {
|
getIndex: function() {
|
||||||
return this._index;
|
return this._index;
|
||||||
|
@ -175,8 +176,8 @@ var Project = PaperScopeItem.extend(/** @lends Project# */{
|
||||||
/**
|
/**
|
||||||
* Gives access to the project's configurable options.
|
* Gives access to the project's configurable options.
|
||||||
*
|
*
|
||||||
* @type Object
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Object
|
||||||
* @deprecated use {@link PaperScope#settings} instead.
|
* @deprecated use {@link PaperScope#settings} instead.
|
||||||
*/
|
*/
|
||||||
getOptions: function() {
|
getOptions: function() {
|
||||||
|
@ -196,8 +197,8 @@ var Project = PaperScopeItem.extend(/** @lends Project# */{
|
||||||
* The layer which is currently active. New items will be created on this
|
* The layer which is currently active. New items will be created on this
|
||||||
* layer by default.
|
* layer by default.
|
||||||
*
|
*
|
||||||
* @type Layer
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Layer
|
||||||
*/
|
*/
|
||||||
getActiveLayer: function() {
|
getActiveLayer: function() {
|
||||||
return this._activeLayer || new Layer({ project: this });
|
return this._activeLayer || new Layer({ project: this });
|
||||||
|
@ -213,8 +214,8 @@ var Project = PaperScopeItem.extend(/** @lends Project# */{
|
||||||
/**
|
/**
|
||||||
* The selected items contained within the project.
|
* The selected items contained within the project.
|
||||||
*
|
*
|
||||||
* @type Item[]
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Item[]
|
||||||
*/
|
*/
|
||||||
getSelectedItems: function() {
|
getSelectedItems: function() {
|
||||||
// TODO: Return groups if their children are all selected,
|
// TODO: Return groups if their children are all selected,
|
||||||
|
@ -306,8 +307,8 @@ var Project = PaperScopeItem.extend(/** @lends Project# */{
|
||||||
* @option [options.tolerance={@link PaperScope#settings}.hitTolerance]
|
* @option [options.tolerance={@link PaperScope#settings}.hitTolerance]
|
||||||
* {Number} the tolerance of the hit-test
|
* {Number} the tolerance of the hit-test
|
||||||
* @option options.class {Function} only hit-test again a certain item class
|
* @option options.class {Function} only hit-test again a certain item class
|
||||||
* and its sub-classes: {@code Group, Layer, Path, CompoundPath, Shape,
|
* and its sub-classes: {@values Group, Layer, Path, CompoundPath,
|
||||||
* Raster, PlacedSymbol, PointText}, etc
|
* Shape, Raster, PlacedSymbol, PointText, ...}
|
||||||
* @option options.fill {Boolean} hit-test the fill of items
|
* @option options.fill {Boolean} hit-test the fill of items
|
||||||
* @option options.stroke {Boolean} hit-test the stroke of path items,
|
* @option options.stroke {Boolean} hit-test the stroke of path items,
|
||||||
* taking into account the setting of stroke color and width
|
* taking into account the setting of stroke color and width
|
||||||
|
|
|
@ -105,8 +105,8 @@ var Symbol = Base.extend(/** @lends Symbol# */{
|
||||||
/**
|
/**
|
||||||
* The symbol definition.
|
* The symbol definition.
|
||||||
*
|
*
|
||||||
* @type Item
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Item
|
||||||
*/
|
*/
|
||||||
getDefinition: function() {
|
getDefinition: function() {
|
||||||
return this._definition;
|
return this._definition;
|
||||||
|
|
|
@ -662,8 +662,8 @@ var Color = Base.extend(new function() {
|
||||||
/**
|
/**
|
||||||
* Converts the color another type.
|
* Converts the color another type.
|
||||||
*
|
*
|
||||||
* @param {String('rgb', 'gray', 'hsb', 'hsl')} type the color type to
|
* @param {String} type the color type to convert to. Possible values:
|
||||||
* convert to.
|
* {@values 'rgb', 'gray', 'hsb', 'hsl'}
|
||||||
* @return {Color} the converted color as a new instance
|
* @return {Color} the converted color as a new instance
|
||||||
*/
|
*/
|
||||||
convert: function(type) {
|
convert: function(type) {
|
||||||
|
@ -673,8 +673,9 @@ var Color = Base.extend(new function() {
|
||||||
/**
|
/**
|
||||||
* The type of the color as a string.
|
* The type of the color as a string.
|
||||||
*
|
*
|
||||||
* @type String('rgb', 'gray', 'hsb', 'hsl')
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type String
|
||||||
|
* @values 'rgb', 'gray', 'hsb', 'hsl'
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* var color = new Color(1, 0, 0);
|
* var color = new Color(1, 0, 0);
|
||||||
|
@ -694,8 +695,8 @@ var Color = Base.extend(new function() {
|
||||||
* The color components that define the color, including the alpha value
|
* The color components that define the color, including the alpha value
|
||||||
* if defined.
|
* if defined.
|
||||||
*
|
*
|
||||||
* @type Number[]
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Number[]
|
||||||
*/
|
*/
|
||||||
getComponents: function() {
|
getComponents: function() {
|
||||||
var components = this._components.slice();
|
var components = this._components.slice();
|
||||||
|
@ -708,8 +709,8 @@ var Color = Base.extend(new function() {
|
||||||
* The color's alpha value as a number between `0` and `1`.
|
* The color's alpha value as a number between `0` and `1`.
|
||||||
* All colors of the different subclasses support alpha values.
|
* All colors of the different subclasses support alpha values.
|
||||||
*
|
*
|
||||||
* @type Number
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Number
|
||||||
* @default 1
|
* @default 1
|
||||||
*
|
*
|
||||||
* @example {@paperscript}
|
* @example {@paperscript}
|
||||||
|
|
|
@ -130,8 +130,8 @@ var Gradient = Base.extend(/** @lends Gradient# */{
|
||||||
/**
|
/**
|
||||||
* The gradient stops on the gradient ramp.
|
* The gradient stops on the gradient ramp.
|
||||||
*
|
*
|
||||||
* @type GradientStop[]
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type GradientStop[]
|
||||||
*/
|
*/
|
||||||
getStops: function() {
|
getStops: function() {
|
||||||
return this._stops;
|
return this._stops;
|
||||||
|
@ -161,8 +161,8 @@ var Gradient = Base.extend(/** @lends Gradient# */{
|
||||||
/**
|
/**
|
||||||
* Specifies whether the gradient is radial or linear.
|
* Specifies whether the gradient is radial or linear.
|
||||||
*
|
*
|
||||||
* @type Boolean
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Boolean
|
||||||
*/
|
*/
|
||||||
getRadial: function() {
|
getRadial: function() {
|
||||||
return this._radial;
|
return this._radial;
|
||||||
|
|
|
@ -74,8 +74,8 @@ var GradientStop = Base.extend(/** @lends GradientStop# */{
|
||||||
/**
|
/**
|
||||||
* The ramp-point of the gradient stop as a value between `0` and `1`.
|
* The ramp-point of the gradient stop as a value between `0` and `1`.
|
||||||
*
|
*
|
||||||
* @type Number
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Number
|
||||||
*
|
*
|
||||||
* @example {@paperscript height=300}
|
* @example {@paperscript height=300}
|
||||||
* // Animating a gradient's ramp points:
|
* // Animating a gradient's ramp points:
|
||||||
|
@ -123,8 +123,8 @@ var GradientStop = Base.extend(/** @lends GradientStop# */{
|
||||||
/**
|
/**
|
||||||
* The color of the gradient stop.
|
* The color of the gradient stop.
|
||||||
*
|
*
|
||||||
* @type Color
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Color
|
||||||
*
|
*
|
||||||
* @example {@paperscript height=300}
|
* @example {@paperscript height=300}
|
||||||
* // Animating a gradient's ramp points:
|
* // Animating a gradient's ramp points:
|
||||||
|
|
|
@ -297,8 +297,9 @@ var Style = Base.extend(new function() {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The view that this style belongs to.
|
* The view that this style belongs to.
|
||||||
* @type View
|
*
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type View
|
||||||
*/
|
*/
|
||||||
getView: function() {
|
getView: function() {
|
||||||
return this._project.getView();
|
return this._project.getView();
|
||||||
|
@ -320,8 +321,8 @@ var Style = Base.extend(new function() {
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @private
|
||||||
* @deprecated use {@link #fontFamily} instead.
|
* @deprecated use {@link #fontFamily} instead.
|
||||||
*/
|
*/
|
||||||
getFont: '#getFontFamily',
|
getFont: '#getFontFamily',
|
||||||
|
@ -371,8 +372,8 @@ var Style = Base.extend(new function() {
|
||||||
*
|
*
|
||||||
* @name Style#strokeWidth
|
* @name Style#strokeWidth
|
||||||
* @property
|
* @property
|
||||||
* @default 1
|
|
||||||
* @type Number
|
* @type Number
|
||||||
|
* @default 1
|
||||||
*
|
*
|
||||||
* @example {@paperscript}
|
* @example {@paperscript}
|
||||||
* // Setting an item's stroke width:
|
* // Setting an item's stroke width:
|
||||||
|
@ -394,8 +395,9 @@ var Style = Base.extend(new function() {
|
||||||
*
|
*
|
||||||
* @name Style#strokeCap
|
* @name Style#strokeCap
|
||||||
* @property
|
* @property
|
||||||
|
* @type String
|
||||||
|
* @values 'round', 'square', 'butt'
|
||||||
* @default 'butt'
|
* @default 'butt'
|
||||||
* @type String('round', 'square', 'butt')
|
|
||||||
*
|
*
|
||||||
* @example {@paperscript height=200}
|
* @example {@paperscript height=200}
|
||||||
* // A look at the different stroke caps:
|
* // A look at the different stroke caps:
|
||||||
|
@ -427,8 +429,9 @@ var Style = Base.extend(new function() {
|
||||||
*
|
*
|
||||||
* @name Style#strokeJoin
|
* @name Style#strokeJoin
|
||||||
* @property
|
* @property
|
||||||
|
* @type String
|
||||||
|
* @values 'miter', 'round', 'bevel'
|
||||||
* @default 'miter'
|
* @default 'miter'
|
||||||
* @type String('miter', 'round', 'bevel')
|
|
||||||
*
|
*
|
||||||
* @example {@paperscript height=120}
|
* @example {@paperscript height=120}
|
||||||
* // A look at the different stroke joins:
|
* // A look at the different stroke joins:
|
||||||
|
@ -458,8 +461,8 @@ var Style = Base.extend(new function() {
|
||||||
*
|
*
|
||||||
* @name Style#strokeScaling
|
* @name Style#strokeScaling
|
||||||
* @property
|
* @property
|
||||||
* @default true
|
|
||||||
* @type Boolean
|
* @type Boolean
|
||||||
|
* @default true
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -467,8 +470,8 @@ var Style = Base.extend(new function() {
|
||||||
*
|
*
|
||||||
* @name Style#dashOffset
|
* @name Style#dashOffset
|
||||||
* @property
|
* @property
|
||||||
* @default 0
|
|
||||||
* @type Number
|
* @type Number
|
||||||
|
* @default 0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -484,8 +487,8 @@ var Style = Base.extend(new function() {
|
||||||
*
|
*
|
||||||
* @name Style#dashArray
|
* @name Style#dashArray
|
||||||
* @property
|
* @property
|
||||||
* @default []
|
|
||||||
* @type Array
|
* @type Array
|
||||||
|
* @default []
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -527,8 +530,9 @@ var Style = Base.extend(new function() {
|
||||||
*
|
*
|
||||||
* @name Style#fillRule
|
* @name Style#fillRule
|
||||||
* @property
|
* @property
|
||||||
|
* @type String
|
||||||
|
* @values 'nonzero', 'evenodd'
|
||||||
* @default 'nonzero'
|
* @default 'nonzero'
|
||||||
* @type String('nonzero', 'evenodd')
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -560,18 +564,18 @@ var Style = Base.extend(new function() {
|
||||||
* The shadow's blur radius.
|
* The shadow's blur radius.
|
||||||
*
|
*
|
||||||
* @property
|
* @property
|
||||||
* @default 0
|
|
||||||
* @name Style#shadowBlur
|
* @name Style#shadowBlur
|
||||||
* @type Number
|
* @type Number
|
||||||
|
* @default 0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The shadow's offset.
|
* The shadow's offset.
|
||||||
*
|
*
|
||||||
* @property
|
* @property
|
||||||
* @default 0
|
|
||||||
* @name Style#shadowOffset
|
* @name Style#shadowOffset
|
||||||
* @type Point
|
* @type Point
|
||||||
|
* @default 0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -591,8 +595,8 @@ var Style = Base.extend(new function() {
|
||||||
* The font-family to be used in text content.
|
* The font-family to be used in text content.
|
||||||
*
|
*
|
||||||
* @name Style#fontFamily
|
* @name Style#fontFamily
|
||||||
* @default 'sans-serif'
|
|
||||||
* @type String
|
* @type String
|
||||||
|
* @default 'sans-serif'
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -600,8 +604,8 @@ var Style = Base.extend(new function() {
|
||||||
* The font-weight to be used in text content.
|
* The font-weight to be used in text content.
|
||||||
*
|
*
|
||||||
* @name Style#fontWeight
|
* @name Style#fontWeight
|
||||||
* @default 'normal'
|
|
||||||
* @type String|Number
|
* @type String|Number
|
||||||
|
* @default 'normal'
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -609,8 +613,8 @@ var Style = Base.extend(new function() {
|
||||||
* optional units `'px'`, `'pt'` and `'em'`.
|
* optional units `'px'`, `'pt'` and `'em'`.
|
||||||
*
|
*
|
||||||
* @name Style#fontSize
|
* @name Style#fontSize
|
||||||
* @default 10
|
|
||||||
* @type Number|String
|
* @type Number|String
|
||||||
|
* @default 10
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -618,8 +622,8 @@ var Style = Base.extend(new function() {
|
||||||
* The font-family to be used in text content, as one string.
|
* The font-family to be used in text content, as one string.
|
||||||
*
|
*
|
||||||
* @name Style#font
|
* @name Style#font
|
||||||
* @default 'sans-serif'
|
|
||||||
* @type String
|
* @type String
|
||||||
|
* @default 'sans-serif'
|
||||||
* @deprecated use {@link #fontFamily} instead.
|
* @deprecated use {@link #fontFamily} instead.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -627,8 +631,8 @@ var Style = Base.extend(new function() {
|
||||||
* The text leading of text content.
|
* The text leading of text content.
|
||||||
*
|
*
|
||||||
* @name Style#leading
|
* @name Style#leading
|
||||||
* @default fontSize * 1.2
|
|
||||||
* @type Number|String
|
* @type Number|String
|
||||||
|
* @default fontSize * 1.2
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -637,7 +641,8 @@ var Style = Base.extend(new function() {
|
||||||
* The justification of text paragraphs.
|
* The justification of text paragraphs.
|
||||||
*
|
*
|
||||||
* @name Style#justification
|
* @name Style#justification
|
||||||
|
* @type String
|
||||||
|
* @values 'left', 'right', 'center'
|
||||||
* @default 'left'
|
* @default 'left'
|
||||||
* @type String('left', 'right', 'center')
|
|
||||||
*/
|
*/
|
||||||
});
|
});
|
||||||
|
|
|
@ -61,8 +61,8 @@ var PointText = TextItem.extend(/** @lends PointText# */{
|
||||||
/**
|
/**
|
||||||
* The PointText's anchor point
|
* The PointText's anchor point
|
||||||
*
|
*
|
||||||
* @type Point
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Point
|
||||||
*/
|
*/
|
||||||
getPoint: function() {
|
getPoint: function() {
|
||||||
// Se Item#getPosition for an explanation why we create new LinkedPoint
|
// Se Item#getPosition for an explanation why we create new LinkedPoint
|
||||||
|
|
|
@ -57,8 +57,8 @@ var TextItem = Item.extend(/** @lends TextItem# */{
|
||||||
/**
|
/**
|
||||||
* The text contents of the text item.
|
* The text contents of the text item.
|
||||||
*
|
*
|
||||||
* @type String
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type String
|
||||||
*
|
*
|
||||||
* @example {@paperscript}
|
* @example {@paperscript}
|
||||||
* // Setting the content of a PointText item:
|
* // Setting the content of a PointText item:
|
||||||
|
@ -105,8 +105,8 @@ var TextItem = Item.extend(/** @lends TextItem# */{
|
||||||
* The font-family to be used in text content.
|
* The font-family to be used in text content.
|
||||||
*
|
*
|
||||||
* @name TextItem#fontFamily
|
* @name TextItem#fontFamily
|
||||||
* @default 'sans-serif'
|
|
||||||
* @type String
|
* @type String
|
||||||
|
* @default 'sans-serif'
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -114,8 +114,8 @@ var TextItem = Item.extend(/** @lends TextItem# */{
|
||||||
* The font-weight to be used in text content.
|
* The font-weight to be used in text content.
|
||||||
*
|
*
|
||||||
* @name TextItem#fontWeight
|
* @name TextItem#fontWeight
|
||||||
* @default 'normal'
|
|
||||||
* @type String|Number
|
* @type String|Number
|
||||||
|
* @default 'normal'
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -123,8 +123,8 @@ var TextItem = Item.extend(/** @lends TextItem# */{
|
||||||
* optional units `'px'`, `'pt'` and `'em'`.
|
* optional units `'px'`, `'pt'` and `'em'`.
|
||||||
*
|
*
|
||||||
* @name TextItem#fontSize
|
* @name TextItem#fontSize
|
||||||
* @default 10
|
|
||||||
* @type Number|String
|
* @type Number|String
|
||||||
|
* @default 10
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -133,16 +133,16 @@ var TextItem = Item.extend(/** @lends TextItem# */{
|
||||||
* @deprecated use {@link #fontFamily} instead.
|
* @deprecated use {@link #fontFamily} instead.
|
||||||
*
|
*
|
||||||
* @name TextItem#font
|
* @name TextItem#font
|
||||||
* @default 'sans-serif'
|
|
||||||
* @type String
|
* @type String
|
||||||
|
* @default 'sans-serif'
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The text leading of text content.
|
* The text leading of text content.
|
||||||
*
|
*
|
||||||
* @name TextItem#leading
|
* @name TextItem#leading
|
||||||
* @default fontSize * 1.2
|
|
||||||
* @type Number|String
|
* @type Number|String
|
||||||
|
* @default fontSize * 1.2
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -151,21 +151,22 @@ var TextItem = Item.extend(/** @lends TextItem# */{
|
||||||
* The justification of text paragraphs.
|
* The justification of text paragraphs.
|
||||||
*
|
*
|
||||||
* @name TextItem#justification
|
* @name TextItem#justification
|
||||||
|
* @type String
|
||||||
|
* @values 'left', 'right', 'center'
|
||||||
* @default 'left'
|
* @default 'left'
|
||||||
* @type String('left', 'right', 'center')
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @private
|
||||||
* @deprecated use {@link #style} instead.
|
* @deprecated use {@link #style} instead.
|
||||||
*/
|
*/
|
||||||
getCharacterStyle: '#getStyle',
|
getCharacterStyle: '#getStyle',
|
||||||
setCharacterStyle: '#setStyle',
|
setCharacterStyle: '#setStyle',
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @private
|
||||||
* @deprecated use {@link #style} instead.
|
* @deprecated use {@link #style} instead.
|
||||||
*/
|
*/
|
||||||
getParagraphStyle: '#getStyle',
|
getParagraphStyle: '#getStyle',
|
||||||
|
|
|
@ -30,14 +30,14 @@
|
||||||
* // has moved at least 10 points:
|
* // has moved at least 10 points:
|
||||||
* tool.distanceThreshold = 10;
|
* tool.distanceThreshold = 10;
|
||||||
*
|
*
|
||||||
* function onMouseDown(event) {
|
* tool.onMouseDown = function(event) {
|
||||||
* // Create a new path every time the mouse is clicked
|
* // Create a new path every time the mouse is clicked
|
||||||
* path = new Path();
|
* path = new Path();
|
||||||
* path.add(event.point);
|
* path.add(event.point);
|
||||||
* path.strokeColor = 'black';
|
* path.strokeColor = 'black';
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* function onMouseDrag(event) {
|
* tool.onMouseDrag = function(event) {
|
||||||
* // Add a point to the path every time the mouse is dragged
|
* // Add a point to the path every time the mouse is dragged
|
||||||
* path.add(event.point);
|
* path.add(event.point);
|
||||||
* }
|
* }
|
||||||
|
@ -61,7 +61,7 @@ var Tool = PaperScopeItem.extend(/** @lends Tool# */{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Activates this tool, meaning {@link PaperScope#tool} will
|
* Activates this tool, meaning {@link PaperScope#tool} will
|
||||||
* point to it and it will be the one that recieves mouse events.
|
* point to it and it will be the one that receives tool events.
|
||||||
*
|
*
|
||||||
* @name Tool#activate
|
* @name Tool#activate
|
||||||
* @function
|
* @function
|
||||||
|
@ -78,8 +78,8 @@ var Tool = PaperScopeItem.extend(/** @lends Tool# */{
|
||||||
* The minimum distance the mouse has to drag before firing the onMouseDrag
|
* The minimum distance the mouse has to drag before firing the onMouseDrag
|
||||||
* event, since the last onMouseDrag event.
|
* event, since the last onMouseDrag event.
|
||||||
*
|
*
|
||||||
* @type Number
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Number
|
||||||
*/
|
*/
|
||||||
getMinDistance: function() {
|
getMinDistance: function() {
|
||||||
return this._minDistance;
|
return this._minDistance;
|
||||||
|
@ -97,8 +97,8 @@ var Tool = PaperScopeItem.extend(/** @lends Tool# */{
|
||||||
* The maximum distance the mouse has to drag before firing the onMouseDrag
|
* The maximum distance the mouse has to drag before firing the onMouseDrag
|
||||||
* event, since the last onMouseDrag event.
|
* event, since the last onMouseDrag event.
|
||||||
*
|
*
|
||||||
* @type Number
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Number
|
||||||
*/
|
*/
|
||||||
getMaxDistance: function() {
|
getMaxDistance: function() {
|
||||||
return this._maxDistance;
|
return this._maxDistance;
|
||||||
|
@ -114,8 +114,8 @@ var Tool = PaperScopeItem.extend(/** @lends Tool# */{
|
||||||
|
|
||||||
// DOCS: document Tool#fixedDistance
|
// DOCS: document Tool#fixedDistance
|
||||||
/**
|
/**
|
||||||
* @type Number
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Number
|
||||||
*/
|
*/
|
||||||
getFixedDistance: function() {
|
getFixedDistance: function() {
|
||||||
return this._minDistance == this._maxDistance
|
return this._minDistance == this._maxDistance
|
||||||
|
@ -131,7 +131,7 @@ var Tool = PaperScopeItem.extend(/** @lends Tool# */{
|
||||||
*
|
*
|
||||||
* The function to be called when the mouse button is pushed down. The
|
* The function to be called when the mouse button is pushed down. The
|
||||||
* function receives a {@link ToolEvent} object which contains information
|
* function receives a {@link ToolEvent} object which contains information
|
||||||
* about the mouse event.
|
* about the tool event.
|
||||||
*
|
*
|
||||||
* @name Tool#onMouseDown
|
* @name Tool#onMouseDown
|
||||||
* @property
|
* @property
|
||||||
|
@ -139,7 +139,7 @@ var Tool = PaperScopeItem.extend(/** @lends Tool# */{
|
||||||
*
|
*
|
||||||
* @example {@paperscript}
|
* @example {@paperscript}
|
||||||
* // Creating circle shaped paths where the user presses the mouse button:
|
* // Creating circle shaped paths where the user presses the mouse button:
|
||||||
* function onMouseDown(event) {
|
* tool.onMouseDown = function(event) {
|
||||||
* // Create a new circle shaped path with a radius of 10
|
* // Create a new circle shaped path with a radius of 10
|
||||||
* // at the position of the mouse (event.point):
|
* // at the position of the mouse (event.point):
|
||||||
* var path = new Path.Circle({
|
* var path = new Path.Circle({
|
||||||
|
@ -153,7 +153,7 @@ var Tool = PaperScopeItem.extend(/** @lends Tool# */{
|
||||||
/**
|
/**
|
||||||
* The function to be called when the mouse position changes while the mouse
|
* The function to be called when the mouse position changes while the mouse
|
||||||
* is being dragged. The function receives a {@link ToolEvent} object which
|
* is being dragged. The function receives a {@link ToolEvent} object which
|
||||||
* contains information about the mouse event.
|
* contains information about the tool event.
|
||||||
*
|
*
|
||||||
* @name Tool#onMouseDrag
|
* @name Tool#onMouseDrag
|
||||||
* @property
|
* @property
|
||||||
|
@ -167,7 +167,7 @@ var Tool = PaperScopeItem.extend(/** @lends Tool# */{
|
||||||
* strokeColor: 'black'
|
* strokeColor: 'black'
|
||||||
* });
|
* });
|
||||||
*
|
*
|
||||||
* function onMouseDrag(event) {
|
* tool.onMouseDrag = function(event) {
|
||||||
* // Add a segment to the path at the position of the mouse:
|
* // Add a segment to the path at the position of the mouse:
|
||||||
* path.add(event.point);
|
* path.add(event.point);
|
||||||
* }
|
* }
|
||||||
|
@ -176,7 +176,7 @@ var Tool = PaperScopeItem.extend(/** @lends Tool# */{
|
||||||
/**
|
/**
|
||||||
* The function to be called the mouse moves within the project view. The
|
* The function to be called the mouse moves within the project view. The
|
||||||
* function receives a {@link ToolEvent} object which contains information
|
* function receives a {@link ToolEvent} object which contains information
|
||||||
* about the mouse event.
|
* about the tool event.
|
||||||
*
|
*
|
||||||
* @name Tool#onMouseMove
|
* @name Tool#onMouseMove
|
||||||
* @property
|
* @property
|
||||||
|
@ -192,7 +192,7 @@ var Tool = PaperScopeItem.extend(/** @lends Tool# */{
|
||||||
* fillColor: 'black'
|
* fillColor: 'black'
|
||||||
* });
|
* });
|
||||||
*
|
*
|
||||||
* function onMouseMove(event) {
|
* tool.onMouseMove = function(event) {
|
||||||
* // Whenever the user moves the mouse, move the path
|
* // Whenever the user moves the mouse, move the path
|
||||||
* // to that position:
|
* // to that position:
|
||||||
* path.position = event.point;
|
* path.position = event.point;
|
||||||
|
@ -202,7 +202,7 @@ var Tool = PaperScopeItem.extend(/** @lends Tool# */{
|
||||||
/**
|
/**
|
||||||
* The function to be called when the mouse button is released. The function
|
* The function to be called when the mouse button is released. The function
|
||||||
* receives a {@link ToolEvent} object which contains information about the
|
* receives a {@link ToolEvent} object which contains information about the
|
||||||
* mouse event.
|
* tool event.
|
||||||
*
|
*
|
||||||
* @name Tool#onMouseUp
|
* @name Tool#onMouseUp
|
||||||
* @property
|
* @property
|
||||||
|
@ -210,7 +210,7 @@ var Tool = PaperScopeItem.extend(/** @lends Tool# */{
|
||||||
*
|
*
|
||||||
* @example {@paperscript}
|
* @example {@paperscript}
|
||||||
* // Creating circle shaped paths where the user releases the mouse:
|
* // Creating circle shaped paths where the user releases the mouse:
|
||||||
* function onMouseUp(event) {
|
* tool.onMouseUp = function(event) {
|
||||||
* // Create a new circle shaped path with a radius of 10
|
* // Create a new circle shaped path with a radius of 10
|
||||||
* // at the position of the mouse (event.point):
|
* // at the position of the mouse (event.point):
|
||||||
* var path = new Path.Circle({
|
* var path = new Path.Circle({
|
||||||
|
@ -246,7 +246,7 @@ var Tool = PaperScopeItem.extend(/** @lends Tool# */{
|
||||||
* fillColor: 'red'
|
* fillColor: 'red'
|
||||||
* });
|
* });
|
||||||
*
|
*
|
||||||
* function onKeyDown(event) {
|
* tool.onKeyDown = function(event) {
|
||||||
* if (event.key == 'space') {
|
* if (event.key == 'space') {
|
||||||
* // Scale the path by 110%:
|
* // Scale the path by 110%:
|
||||||
* path.scale(1.1);
|
* path.scale(1.1);
|
||||||
|
@ -271,7 +271,7 @@ var Tool = PaperScopeItem.extend(/** @lends Tool# */{
|
||||||
* @type Function
|
* @type Function
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* function onKeyUp(event) {
|
* tool.onKeyUp = function(event) {
|
||||||
* if (event.key == 'space') {
|
* if (event.key == 'space') {
|
||||||
* console.log('The spacebar was released!');
|
* console.log('The spacebar was released!');
|
||||||
* }
|
* }
|
||||||
|
@ -411,10 +411,10 @@ var Tool = PaperScopeItem.extend(/** @lends Tool# */{
|
||||||
*
|
*
|
||||||
* @name Tool#on
|
* @name Tool#on
|
||||||
* @function
|
* @function
|
||||||
* @param {String('mousedown', 'mouseup', 'mousedrag', 'mousemove',
|
* @param {String} type the event type: {@values 'mousedown', 'mouseup',
|
||||||
* 'keydown', 'keyup')} type the event type
|
* 'mousedrag', 'mousemove', 'keydown', 'keyup'}
|
||||||
* @param {Function} function The function to be called when the event
|
* @param {Function} function the function to be called when the event
|
||||||
* occurs
|
* occurs, receiving a {@link ToolEvent} object as its sole argument
|
||||||
* @return {Tool} this tool itself, so calls can be chained
|
* @return {Tool} this tool itself, so calls can be chained
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
|
@ -423,8 +423,8 @@ var Tool = PaperScopeItem.extend(/** @lends Tool# */{
|
||||||
* @name Tool#on
|
* @name Tool#on
|
||||||
* @function
|
* @function
|
||||||
* @param {Object} param an object literal containing one or more of the
|
* @param {Object} param an object literal containing one or more of the
|
||||||
* following properties: {@code mousedown, mouseup, mousedrag, mousemove,
|
* following properties: {@values mousedown, mouseup, mousedrag,
|
||||||
* keydown, keyup}
|
* mousemove, keydown, keyup}
|
||||||
* @return {Tool} this tool itself, so calls can be chained
|
* @return {Tool} this tool itself, so calls can be chained
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -433,9 +433,9 @@ var Tool = PaperScopeItem.extend(/** @lends Tool# */{
|
||||||
*
|
*
|
||||||
* @name Tool#off
|
* @name Tool#off
|
||||||
* @function
|
* @function
|
||||||
* @param {String('mousedown', 'mouseup', 'mousedrag', 'mousemove',
|
* @param {String} type the event type: {@values 'mousedown', 'mouseup',
|
||||||
* 'keydown', 'keyup')} type the event type
|
* 'mousedrag', 'mousemove', 'keydown', 'keyup'}
|
||||||
* @param {Function} function The function to be detached
|
* @param {Function} function the function to be detached
|
||||||
* @return {Tool} this tool itself, so calls can be chained
|
* @return {Tool} this tool itself, so calls can be chained
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
|
@ -444,8 +444,8 @@ var Tool = PaperScopeItem.extend(/** @lends Tool# */{
|
||||||
* @name Tool#off
|
* @name Tool#off
|
||||||
* @function
|
* @function
|
||||||
* @param {Object} param an object literal containing one or more of the
|
* @param {Object} param an object literal containing one or more of the
|
||||||
* following properties: {@code mousedown, mouseup, mousedrag, mousemove,
|
* following properties: {@values mousedown, mouseup, mousedrag,
|
||||||
* keydown, keyup}
|
* mousemove, keydown, keyup}
|
||||||
* @return {Tool} this tool itself, so calls can be chained
|
* @return {Tool} this tool itself, so calls can be chained
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -454,8 +454,8 @@ var Tool = PaperScopeItem.extend(/** @lends Tool# */{
|
||||||
*
|
*
|
||||||
* @name Tool#emit
|
* @name Tool#emit
|
||||||
* @function
|
* @function
|
||||||
* @param {String('mousedown', 'mouseup', 'mousedrag', 'mousemove',
|
* @param {String} type the event type: {@values 'mousedown', 'mouseup',
|
||||||
* 'keydown', 'keyup')} type the event type
|
* 'mousedrag', 'mousemove', 'keydown', 'keyup'}
|
||||||
* @param {Object} event an object literal containing properties describing
|
* @param {Object} event an object literal containing properties describing
|
||||||
* the event
|
* the event
|
||||||
* @return {Boolean} {@true if the event had listeners}
|
* @return {Boolean} {@true if the event had listeners}
|
||||||
|
@ -466,8 +466,8 @@ var Tool = PaperScopeItem.extend(/** @lends Tool# */{
|
||||||
*
|
*
|
||||||
* @name Tool#responds
|
* @name Tool#responds
|
||||||
* @function
|
* @function
|
||||||
* @param {String('mousedown', 'mouseup', 'mousedrag', 'mousemove',
|
* @param {String} type the event type: {@values 'mousedown', 'mouseup',
|
||||||
* 'keydown', 'keyup')} type the event type
|
* 'mousedrag', 'mousemove', 'keydown', 'keyup'}
|
||||||
* @return {Boolean} {@true if the tool has one or more event handlers of
|
* @return {Boolean} {@true if the tool has one or more event handlers of
|
||||||
* the specified type}
|
* the specified type}
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -44,7 +44,8 @@ var ToolEvent = Event.extend(/** @lends ToolEvent# */{
|
||||||
* The type of tool event.
|
* The type of tool event.
|
||||||
*
|
*
|
||||||
* @name ToolEvent#type
|
* @name ToolEvent#type
|
||||||
* @type String('mousedown', 'mouseup', 'mousemove', 'mousedrag')
|
* @type String
|
||||||
|
* @values 'mousedown', 'mouseup', 'mousemove', 'mousedrag'
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -62,8 +63,8 @@ var ToolEvent = Event.extend(/** @lends ToolEvent# */{
|
||||||
* console.log(event.point);
|
* console.log(event.point);
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* @type Point
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Point
|
||||||
*/
|
*/
|
||||||
getPoint: function() {
|
getPoint: function() {
|
||||||
return this._choosePoint(this._point, this.tool._point);
|
return this._choosePoint(this._point, this.tool._point);
|
||||||
|
@ -77,8 +78,8 @@ var ToolEvent = Event.extend(/** @lends ToolEvent# */{
|
||||||
* The position of the mouse in project coordinates when the previous
|
* The position of the mouse in project coordinates when the previous
|
||||||
* event was fired.
|
* event was fired.
|
||||||
*
|
*
|
||||||
* @type Point
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Point
|
||||||
*/
|
*/
|
||||||
getLastPoint: function() {
|
getLastPoint: function() {
|
||||||
return this._choosePoint(this._lastPoint, this.tool._lastPoint);
|
return this._choosePoint(this._lastPoint, this.tool._lastPoint);
|
||||||
|
@ -92,8 +93,8 @@ var ToolEvent = Event.extend(/** @lends ToolEvent# */{
|
||||||
* The position of the mouse in project coordinates when the mouse button
|
* The position of the mouse in project coordinates when the mouse button
|
||||||
* was last clicked.
|
* was last clicked.
|
||||||
*
|
*
|
||||||
* @type Point
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Point
|
||||||
*/
|
*/
|
||||||
getDownPoint: function() {
|
getDownPoint: function() {
|
||||||
return this._choosePoint(this._downPoint, this.tool._downPoint);
|
return this._choosePoint(this._downPoint, this.tool._downPoint);
|
||||||
|
@ -109,8 +110,8 @@ var ToolEvent = Event.extend(/** @lends ToolEvent# */{
|
||||||
* artwork based on the moving direction of the mouse, as returned by
|
* artwork based on the moving direction of the mouse, as returned by
|
||||||
* {@link #delta}.
|
* {@link #delta}.
|
||||||
*
|
*
|
||||||
* @type Point
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Point
|
||||||
*/
|
*/
|
||||||
getMiddlePoint: function() {
|
getMiddlePoint: function() {
|
||||||
// For explanations, see getDelta()
|
// For explanations, see getDelta()
|
||||||
|
@ -130,8 +131,8 @@ var ToolEvent = Event.extend(/** @lends ToolEvent# */{
|
||||||
* mouse when the event was fired. In case of the mouseup event, the
|
* mouse when the event was fired. In case of the mouseup event, the
|
||||||
* difference to the mousedown position is returned.
|
* difference to the mousedown position is returned.
|
||||||
*
|
*
|
||||||
* @type Point
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Point
|
||||||
*/
|
*/
|
||||||
getDelta: function() {
|
getDelta: function() {
|
||||||
// Do not put the calculated delta into delta, since this only reserved
|
// Do not put the calculated delta into delta, since this only reserved
|
||||||
|
@ -151,8 +152,8 @@ var ToolEvent = Event.extend(/** @lends ToolEvent# */{
|
||||||
/**
|
/**
|
||||||
* The number of times the mouse event was fired.
|
* The number of times the mouse event was fired.
|
||||||
*
|
*
|
||||||
* @type Number
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Number
|
||||||
*/
|
*/
|
||||||
getCount: function() {
|
getCount: function() {
|
||||||
// Return downCount for both mouse down and up, since
|
// Return downCount for both mouse down and up, since
|
||||||
|
@ -174,8 +175,8 @@ var ToolEvent = Event.extend(/** @lends ToolEvent# */{
|
||||||
* {@link CompoundPath} items, the most top level group or compound path
|
* {@link CompoundPath} items, the most top level group or compound path
|
||||||
* that it is contained within is returned.
|
* that it is contained within is returned.
|
||||||
*
|
*
|
||||||
* @type Item
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Item
|
||||||
*/
|
*/
|
||||||
getItem: function() {
|
getItem: function() {
|
||||||
if (!this._item) {
|
if (!this._item) {
|
||||||
|
|
|
@ -287,8 +287,8 @@ var View = Base.extend(Emitter, /** @lends View# */{
|
||||||
/**
|
/**
|
||||||
* The underlying native element.
|
* The underlying native element.
|
||||||
*
|
*
|
||||||
* @type HTMLCanvasElement
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type HTMLCanvasElement
|
||||||
*/
|
*/
|
||||||
getElement: function() {
|
getElement: function() {
|
||||||
return this._element;
|
return this._element;
|
||||||
|
@ -300,9 +300,8 @@ var View = Base.extend(Emitter, /** @lends View# */{
|
||||||
* It is `1` for normal displays, and `2` or more for
|
* It is `1` for normal displays, and `2` or more for
|
||||||
* high-resolution displays.
|
* high-resolution displays.
|
||||||
*
|
*
|
||||||
* @type Number
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Number
|
||||||
*/
|
*/
|
||||||
getPixelRatio: function() {
|
getPixelRatio: function() {
|
||||||
return this._pixelRatio;
|
return this._pixelRatio;
|
||||||
|
@ -313,8 +312,8 @@ var View = Base.extend(Emitter, /** @lends View# */{
|
||||||
* It is `72` for normal displays, and `144` for high-resolution
|
* It is `72` for normal displays, and `144` for high-resolution
|
||||||
* displays with a pixel-ratio of `2`.
|
* displays with a pixel-ratio of `2`.
|
||||||
*
|
*
|
||||||
* @type Number
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Number
|
||||||
*/
|
*/
|
||||||
getResolution: function() {
|
getResolution: function() {
|
||||||
return this._pixelRatio * 72;
|
return this._pixelRatio * 72;
|
||||||
|
@ -324,8 +323,8 @@ var View = Base.extend(Emitter, /** @lends View# */{
|
||||||
* The size of the view. Changing the view's size will resize it's
|
* The size of the view. Changing the view's size will resize it's
|
||||||
* underlying element.
|
* underlying element.
|
||||||
*
|
*
|
||||||
* @type Size
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Size
|
||||||
*/
|
*/
|
||||||
getViewSize: function() {
|
getViewSize: function() {
|
||||||
var size = this._viewSize;
|
var size = this._viewSize;
|
||||||
|
@ -360,8 +359,8 @@ var View = Base.extend(Emitter, /** @lends View# */{
|
||||||
/**
|
/**
|
||||||
* The bounds of the currently visible area in project coordinates.
|
* The bounds of the currently visible area in project coordinates.
|
||||||
*
|
*
|
||||||
* @type Rectangle
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Rectangle
|
||||||
*/
|
*/
|
||||||
getBounds: function() {
|
getBounds: function() {
|
||||||
if (!this._bounds)
|
if (!this._bounds)
|
||||||
|
@ -373,8 +372,8 @@ var View = Base.extend(Emitter, /** @lends View# */{
|
||||||
/**
|
/**
|
||||||
* The size of the visible area in project coordinates.
|
* The size of the visible area in project coordinates.
|
||||||
*
|
*
|
||||||
* @type Size
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Size
|
||||||
*/
|
*/
|
||||||
getSize: function() {
|
getSize: function() {
|
||||||
return this.getBounds().getSize();
|
return this.getBounds().getSize();
|
||||||
|
@ -383,8 +382,8 @@ var View = Base.extend(Emitter, /** @lends View# */{
|
||||||
/**
|
/**
|
||||||
* The center of the visible area in project coordinates.
|
* The center of the visible area in project coordinates.
|
||||||
*
|
*
|
||||||
* @type Point
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Point
|
||||||
*/
|
*/
|
||||||
getCenter: function() {
|
getCenter: function() {
|
||||||
return this.getBounds().getCenter();
|
return this.getBounds().getCenter();
|
||||||
|
@ -398,8 +397,8 @@ var View = Base.extend(Emitter, /** @lends View# */{
|
||||||
/**
|
/**
|
||||||
* The zoom factor by which the project coordinates are magnified.
|
* The zoom factor by which the project coordinates are magnified.
|
||||||
*
|
*
|
||||||
* @type Number
|
|
||||||
* @bean
|
* @bean
|
||||||
|
* @type Number
|
||||||
*/
|
*/
|
||||||
getZoom: function() {
|
getZoom: function() {
|
||||||
return this._zoom;
|
return this._zoom;
|
||||||
|
@ -521,7 +520,7 @@ var View = Base.extend(Emitter, /** @lends View# */{
|
||||||
* var path = new Path.Rectangle(new Point(50, 25), new Size(50, 50));
|
* var path = new Path.Rectangle(new Point(50, 25), new Size(50, 50));
|
||||||
* path.fillColor = 'black';
|
* path.fillColor = 'black';
|
||||||
*
|
*
|
||||||
* function onFrame(event) {
|
* view.onFrame = function(event) {
|
||||||
* // Every frame, rotate the path by 3 degrees:
|
* // Every frame, rotate the path by 3 degrees:
|
||||||
* path.rotate(3);
|
* path.rotate(3);
|
||||||
* }
|
* }
|
||||||
|
@ -541,7 +540,7 @@ var View = Base.extend(Emitter, /** @lends View# */{
|
||||||
* var path = new Path.Circle(view.bounds.center, 30);
|
* var path = new Path.Circle(view.bounds.center, 30);
|
||||||
* path.fillColor = 'red';
|
* path.fillColor = 'red';
|
||||||
*
|
*
|
||||||
* function onResize(event) {
|
* view.onResize = function(event) {
|
||||||
* // Whenever the view is resized, move the path to its center:
|
* // Whenever the view is resized, move the path to its center:
|
||||||
* path.position = view.center;
|
* path.position = view.center;
|
||||||
* }
|
* }
|
||||||
|
@ -557,9 +556,12 @@ var View = Base.extend(Emitter, /** @lends View# */{
|
||||||
*
|
*
|
||||||
* @name View#on
|
* @name View#on
|
||||||
* @function
|
* @function
|
||||||
* @param {String('frame', 'resize')} type the event type
|
* @param {String} type the type of event: {@values 'frame', 'resize',
|
||||||
* @param {Function} function The function to be called when the event
|
* mousedown', 'mouseup', 'mousedrag', 'click', 'doubleclick',
|
||||||
* occurs
|
* 'mousemove', 'mouseenter', 'mouseleave'}
|
||||||
|
* @param {Function} function the function to be called when the event
|
||||||
|
* occurs, receiving a {@link MouseEvent} or {@link Event} object as its
|
||||||
|
* sole argument
|
||||||
* @return {View} this view itself, so calls can be chained
|
* @return {View} this view itself, so calls can be chained
|
||||||
*
|
*
|
||||||
* @example {@paperscript}
|
* @example {@paperscript}
|
||||||
|
@ -581,7 +583,7 @@ var View = Base.extend(Emitter, /** @lends View# */{
|
||||||
* @name View#on
|
* @name View#on
|
||||||
* @function
|
* @function
|
||||||
* @param {Object} param an object literal containing one or more of the
|
* @param {Object} param an object literal containing one or more of the
|
||||||
* following properties: `frame, resize`
|
* following properties: {@values frame, resize}
|
||||||
* @return {View} this view itself, so calls can be chained
|
* @return {View} this view itself, so calls can be chained
|
||||||
*
|
*
|
||||||
* @example {@paperscript}
|
* @example {@paperscript}
|
||||||
|
@ -605,8 +607,8 @@ var View = Base.extend(Emitter, /** @lends View# */{
|
||||||
*
|
*
|
||||||
* @name View#off
|
* @name View#off
|
||||||
* @function
|
* @function
|
||||||
* @param {String('frame', 'resize')} type the event type
|
* @param {String} type the event type: {@values 'frame', 'resize'}
|
||||||
* @param {Function} function The function to be detached
|
* @param {Function} function the function to be detached
|
||||||
* @return {View} this view itself, so calls can be chained
|
* @return {View} this view itself, so calls can be chained
|
||||||
*
|
*
|
||||||
* @example {@paperscript}
|
* @example {@paperscript}
|
||||||
|
@ -636,7 +638,7 @@ var View = Base.extend(Emitter, /** @lends View# */{
|
||||||
* @name View#off
|
* @name View#off
|
||||||
* @function
|
* @function
|
||||||
* @param {Object} param an object literal containing one or more of the
|
* @param {Object} param an object literal containing one or more of the
|
||||||
* following properties: `frame, resize`
|
* following properties: {@values frame, resize}
|
||||||
* @return {View} this view itself, so calls can be chained
|
* @return {View} this view itself, so calls can be chained
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -645,7 +647,7 @@ var View = Base.extend(Emitter, /** @lends View# */{
|
||||||
*
|
*
|
||||||
* @name View#emit
|
* @name View#emit
|
||||||
* @function
|
* @function
|
||||||
* @param {String('frame', 'resize')} type the event type
|
* @param {String} type the event type: {@values 'frame', 'resize'}
|
||||||
* @param {Object} event an object literal containing properties describing
|
* @param {Object} event an object literal containing properties describing
|
||||||
* the event
|
* the event
|
||||||
* @return {Boolean} {@true if the event had listeners}
|
* @return {Boolean} {@true if the event had listeners}
|
||||||
|
@ -656,7 +658,7 @@ var View = Base.extend(Emitter, /** @lends View# */{
|
||||||
*
|
*
|
||||||
* @name View#responds
|
* @name View#responds
|
||||||
* @function
|
* @function
|
||||||
* @param {String('frame', 'resize')} type the event type
|
* @param {String} type the event type: {@values 'frame', 'resize'}
|
||||||
* @return {Boolean} {@true if the view has one or more event handlers of
|
* @return {Boolean} {@true if the view has one or more event handlers of
|
||||||
* the specified type}
|
* the specified type}
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue