A lot of work on documentation.

- @values lists
- Improve event documentation
- Compound path
- etc.
This commit is contained in:
Jürg Lehni 2016-01-08 20:45:54 +01:00
parent 64f997a3bc
commit f2ae7840cf
34 changed files with 357 additions and 277 deletions

View file

@ -50,8 +50,8 @@ var Line = Base.extend(/** @lends Line# */{
/**
* The starting point of the line.
*
* @type Point
* @bean
* @type Point
*/
getPoint: function() {
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.
*
* @type Point
* @bean
* @type Point
*/
getVector: function() {
return new Point(this._vx, this._vy);
@ -70,8 +70,8 @@ var Line = Base.extend(/** @lends Line# */{
/**
* The length of the line.
*
* @type Number
* @bean
* @type Number
*/
getLength: function() {
return this.getVector().getLength();

View file

@ -688,8 +688,8 @@ var Matrix = Base.extend(/** @lends Matrix# */{
* The transform values as an array, in the same sequence as they are passed
* to {@link #initialize(a, c, b, d, tx, ty)}.
*
* @type Number[]
* @bean
* @type Number[]
*/
getValues: function() {
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.
*
* @type Point
* @bean
* @type Point
*/
getTranslation: function() {
// 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.
*
* @type Point
* @bean
* @type Point
* @see #decompose()
*/
getScaling: function() {
@ -720,8 +720,8 @@ var Matrix = Base.extend(/** @lends Matrix# */{
/**
* The rotation angle of the matrix, if it can be decomposed.
*
* @type Number
* @bean
* @type Number
* @see #decompose()
*/
getRotation: function() {

View file

@ -245,8 +245,8 @@ var Point = Base.extend(/** @lends Point# */{
* = 0`, `y = 0`) to the point's location. Setting the length changes the
* location but keeps the vector's angle.
*
* @type Number
* @bean
* @type Number
*/
getLength: function() {
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.
*
* @name Point#getAngle
* @bean
* @name Point#getAngle
* @type Number
*/
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.
*
* @name Point#getAngleInRadians
* @bean
* @name Point#getAngleInRadians
* @type Number
*/
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
* quadrant `4`.
*
* @type Number
* @bean
* @type Number
*
* @example
* var point = new Point({

View file

@ -237,8 +237,8 @@ var Rectangle = Base.extend(/** @lends Rectangle# */{
/**
* The top-left point of the rectangle
*
* @type Point
* @bean
* @type Point
*/
getPoint: function(_dontLink) {
var ctor = _dontLink ? Point : LinkedPoint;
@ -255,8 +255,8 @@ var Rectangle = Base.extend(/** @lends Rectangle# */{
/**
* The size of the rectangle
*
* @type Size
* @bean
* @type Size
*/
getSize: function(_dontLink) {
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
* doesn't move the whole rectangle; the right hand side stays where it was.
*
* @type Number
* @bean
* @type Number
*/
getLeft: function() {
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
* whole rectangle: the bottom won't move.
*
* @type Number
* @bean
* @type Number
*/
getTop: function() {
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
* doesn't move the whole rectangle; the left hand side stays where it was.
*
* @type Number
* @bean
* @type Number
*/
getRight: function() {
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
* whole rectangle: the top won't move.
*
* @type Number
* @bean
* @type Number
*/
getBottom: function() {
return this.y + this.height;
@ -367,8 +367,8 @@ var Rectangle = Base.extend(/** @lends Rectangle# */{
/**
* The center-x coordinate of the rectangle.
*
* @type Number
* @bean
* @type Number
* @ignore
*/
getCenterX: function() {
@ -383,8 +383,8 @@ var Rectangle = Base.extend(/** @lends Rectangle# */{
/**
* The center-y coordinate of the rectangle.
*
* @type Number
* @bean
* @type Number
* @ignore
*/
getCenterY: function() {
@ -401,8 +401,8 @@ var Rectangle = Base.extend(/** @lends Rectangle# */{
*
* The center point of the rectangle.
*
* @type Point
* @bean
* @type Point
*/
getCenter: function(_dontLink) {
var ctor = _dontLink ? Point : LinkedPoint;
@ -477,8 +477,8 @@ var Rectangle = Base.extend(/** @lends Rectangle# */{
/**
* The area of the rectangle.
*
* @type Number
* @bean
* @type Number
*/
getArea: function() {
return this.width * this.height;
@ -899,9 +899,9 @@ new function() {
* Paper.js draws the visual bounds of selected items on top of your
* project. This can be useful for debugging.
*
* @bean
* @type Boolean
* @default false
* @bean
*/
isSelected: function() {
return this._owner._boundsSelected;

View file

@ -40,7 +40,7 @@ Base.inject(/** @lends Base# */{
* The class name of the object as a string, if the prototype defines a
* `_class` value.
*
* @beans
* @bean
*/
getClassName: function() {
return this._class || '';

View file

@ -136,20 +136,23 @@ var PaperScope = Base.extend(/** @lends PaperScope# */{
/**
* The currently active project.
*
* @name PaperScope#project
* @type Project
*/
/**
* The list of all open projects within the current Paper.js context.
*
* @name PaperScope#projects
* @type Project[]
*/
/**
* The reference to the active project's view.
* @type View
*
* @bean
* @type View
*/
getView: function() {
return this.project && this.project.getView();
@ -157,13 +160,17 @@ var PaperScope = Base.extend(/** @lends PaperScope# */{
/**
* The reference to the active tool.
*
* @name PaperScope#tool
* @property
* @type Tool
*/
/**
* The list of available tools.
*
* @name PaperScope#tools
* @property
* @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
* refer to the local scope, even when calling into it from another scope.
* `paper.activate();` will have to be called in such a situation.
*
* @bean
* @type PaperScript
* @private
* @bean
*/
getPaper: function() {
return this;

View file

@ -12,7 +12,9 @@
/**
* @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# */{
_class: 'Event',
@ -24,16 +26,31 @@ var Event = Base.extend(/** @lends Event# */{
isPrevented: false,
isStopped: false,
/**
* Cancels the event if it is cancelable, without stopping further
* propagation of the event.
*/
preventDefault: function() {
this.isPrevented = true;
this.event.preventDefault();
},
/**
* Prevents further propagation of the current event.
*/
stopPropagation: function() {
this.isStopped = true;
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() {
this.stopPropagation();
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.
*
* @type Number
* @bean
* @type Number
*/
getTimeStamp: function() {
return this.event.timeStamp;
@ -52,8 +69,8 @@ var Event = Base.extend(/** @lends Event# */{
/**
* The current state of the keyboard modifiers.
*
* @type object
* @bean
* @type object
* @see Key.modifiers
*/
getModifiers: function() {

View file

@ -223,9 +223,10 @@ var Key = new function() {
/**
* Checks whether the specified key is pressed.
*
* @param {String} key any character or special key descriptor, e.g.:
* {@strings enter, space, shift, control, alt, meta, caps-lock,
* left, up, right, down, escape, delete, ...}
* @param {String} key any character or special key descriptor:
* {@values 'enter', 'space', 'shift', 'control', 'alt', 'meta',
* 'caps-lock', 'left', 'up', 'right', 'down', 'escape', 'delete',
* ...}
* @return {Boolean} {@true if the key is pressed}
*
* @example

View file

@ -31,10 +31,11 @@ var KeyEvent = Event.extend(/** @lends KeyEvent# */{
},
/**
* The type of key event.
* The type of mouse event.
*
* @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
* special key descriptor, e.g.: {@strings enter, space, shift, control,
* alt, meta, caps-lock, left, up, right, down, escape, delete, ...}
* special key descriptor.
*
* @name KeyEvent#key
* @type String
* @values 'enter', 'space', 'shift', 'control', 'alt', 'meta', 'caps-lock',
* 'left', 'up', 'right', 'down', 'escape', 'delete', ...
*/
/**

View file

@ -37,8 +37,9 @@ var MouseEvent = Event.extend(/** @lends MouseEvent# */{
* The type of mouse event.
*
* @name MouseEvent#type
* @type String('mousedown', 'mouseup', 'mousedrag', 'click',
* 'doubleclick', 'mousemove', 'mouseenter', 'mouseleave')
* @type String
* @values 'mousedown', 'mouseup', 'mousedrag', 'click', 'doubleclick',
* 'mousemove', 'mouseenter', mouseleave'
*/
/**

View file

@ -129,8 +129,8 @@ var Group = Item.extend(/** @lends Group# */{
* `true`, the first child in the group is automatically defined as the
* clipping mask.
*
* @type Boolean
* @bean
* @type Boolean
*
* @example {@paperscript}
* var star = new Path.Star({

View file

@ -35,22 +35,24 @@ var HitResult = Base.extend(/** @lends HitResult# */{
/**
* 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
* @property
* @type String('segment', 'handle-in', 'handle-out', 'curve', 'stroke',
* 'fill', 'bounds', 'center', 'pixel')
* @type String
* @values 'segment', 'handle-in', 'handle-out', 'curve', 'stroke', 'fill',
* 'bounds', 'center', 'pixel'
*/
/**
* If the HitResult has a {@link HitResult#type} of 'bounds', this property
* describes which corner of the bounding rectangle was hit.
* If the HitResult has a {@link HitResult#type} of `'bounds'`, this
* property describes which corner of the bounding rectangle was hit.
*
* @name HitResult#name
* @property
* @type String('top-left', 'top-right', 'bottom-left', 'bottom-right',
* 'left-center', 'top-center', 'right-center', 'bottom-center')
* @type String
* @values 'top-left', 'top-right', 'bottom-left', 'bottom-right',
* 'left-center', 'top-center', 'right-center', 'bottom- center'
*/
/**

View file

@ -267,8 +267,8 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
/**
* The unique id of the item.
*
* @type Number
* @bean
* @type Number
*/
getId: function() {
return this._id;
@ -278,16 +278,17 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
* The class name of the item as a string.
*
* @name Item#className
* @type String('Group', 'Layer', 'Path', 'CompoundPath', 'Shape',
* 'Raster', 'PlacedSymbol', 'PointText')
* @type String
* @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
* through its parent's children list.
*
* @type String
* @bean
* @type String
*
* @example {@paperscript}
* var path = new Path.Circle({
@ -339,9 +340,9 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
/**
* The path style of the item.
*
* @bean
* @name Item#getStyle
* @type Style
* @bean
*
* @example {@paperscript}
* // 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.
*
* @name Item#blendMode
* @type String('normal', 'multiply', 'screen', 'overlay', 'soft-light',
* 'hard-light', 'color-dodge', 'color-burn', 'darken', 'lighten',
* 'difference', 'exclusion', 'hue', 'saturation', 'luminosity', 'color',
* 'add', 'subtract', 'average', 'pin-light', 'negation', 'source-over',
* 'source-in', 'source-out', 'source-atop', 'destination-over',
* 'destination-in', 'destination-out', 'destination-atop', 'lighter',
* 'darker', 'copy', 'xor')
* @type String
* @values 'normal', 'multiply', 'screen', 'overlay', 'soft-light', 'hard-
* light', 'color-dodge', 'color-burn', 'darken', 'lighten',
* 'difference', 'exclusion', 'hue', 'saturation', 'luminosity',
* 'color', 'add', 'subtract', 'average', 'pin-light', 'negation',
* 'source- over', 'source-in', 'source-out', 'source-atop',
* 'destination-over', 'destination-in', 'destination-out',
* 'destination-atop', 'lighter', 'darker', 'copy', 'xor'
* @default 'normal'
*
* @example {@paperscript}
@ -549,9 +551,9 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
* construction of paths, position of path curves, individual segment points
* and bounding boxes of symbol and raster items.
*
* @bean
* @type Boolean
* @default false
* @bean
* @see Project#selectedItems
* @see Segment#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
* already contained within a clipping group.
*
* @bean
* @type Boolean
* @default false
* @bean
*/
isClipMask: function() {
return this._clipMask;
@ -652,8 +654,8 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
* A plain javascript object which can be used to store
* arbitrary data on the item.
*
* @type Object
* @bean
* @type Object
*
* @example
* 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
* {@link #bounds} rectangle.
*
* @type Point
* @bean
* @type Point
*
* @example {@paperscript}
* // 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}
* rectangle is used as pivot.
*
* @type Point
* @bean
* @type Point
* @default null
*/
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
* {@link #matrix}.
*
* @type Number
* @bean
* @type Number
*/
getRotation: function() {
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
* {@link #matrix}.
*
* @type Point
* @bean
* @type Point
*/
getScaling: function(_dontLink) {
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
* relation to its parent item in which it is contained.
*
* @type Matrix
* @bean
* @type Matrix
*/
getMatrix: function() {
return this._matrix;
@ -1097,8 +1099,8 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
* coordinate space. Note that the view's transformations resulting from
* zooming and panning are not factored in.
*
* @type Matrix
* @bean
* @type Matrix
*/
getGlobalMatrix: function(_dontClone) {
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}
* items, etc.).
*
* @bean
* @type Boolean
* @default true
* @bean
*/
getApplyMatrix: function() {
return this._applyMatrix;
@ -1691,8 +1693,8 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
* @option [options.tolerance={@link PaperScope#settings}.hitTolerance]
* {Number} the tolerance of the hit-test
* @option options.class {Function} only hit-test again a certain item class
* and its sub-classes: {@code Group, Layer, Path, CompoundPath, Shape,
* Raster, PlacedSymbol, PointText}, etc
* and its sub-classes: {@values Group, Layer, Path, CompoundPath,
* Shape, Raster, PlacedSymbol, PointText, ...}
* @option options.fill {Boolean} hit-test the fill of items
* @option options.stroke {Boolean} hit-test the stroke of path items,
* taking into account the setting of stroke color and width
@ -2754,8 +2756,9 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
*
* @name Item#strokeCap
* @property
* @type String
* @values 'round', 'square', 'butt'
* @default 'butt'
* @type String('round', 'square', 'butt')
*
* @example {@paperscript height=200}
* // A look at the different stroke caps:
@ -2787,9 +2790,9 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
*
* @name Item#strokeJoin
* @property
* @type String
* @values 'miter', 'round', 'bevel'
* @default 'miter'
* @type String('miter', 'round', 'bevel')
*
*
* @example {@paperscript height=120}
* // A look at the different stroke joins:
@ -2815,8 +2818,8 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
*
* @name Item#dashOffset
* @property
* @default 0
* @type Number
* @default 0
*/
/**
@ -2826,8 +2829,8 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
*
* @name Item#strokeScaling
* @property
* @default true
* @type Boolean
* @default true
*/
/**
@ -2846,8 +2849,8 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
*
* @name Item#dashArray
* @property
* @default []
* @type Array
* @default []
*/
/**
@ -2860,8 +2863,8 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
*
* @name Item#miterLimit
* @property
* @default 10
* @type Number
* @default 10
*/
/**
@ -2893,8 +2896,9 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
*
* @name Item#fillRule
* @property
* @type String
* @values 'nonzero', 'evenodd'
* @default 'nonzero'
* @type String('nonzero', 'evenodd')
*/
/**
@ -2926,18 +2930,18 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
* The shadow's blur radius.
*
* @property
* @default 0
* @name Item#shadowBlur
* @type Number
* @default 0
*/
/**
* The shadow's offset.
*
* @property
* @default 0
* @name Item#shadowOffset
* @type Point
* @default 0
*/
// 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 receives a {@link MouseEvent} object which contains
@ -3676,11 +3705,12 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
*
* @name Item#on
* @function
* @param {String('mousedown', 'mouseup', 'mousedrag', 'click',
* 'doubleclick', 'mousemove', 'mouseenter', 'mouseleave')} type the event
* type
* @param {Function} function The function to be called when the event
* occurs
* @param {String} type the type of event: {@values 'frame', mousedown',
* 'mouseup', 'mousedrag', 'click', 'doubleclick', '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 {Item} this item itself, so calls can be chained
*
* @example {@paperscript}
@ -3710,8 +3740,8 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
* @name Item#on
* @function
* @param {Object} object an object literal containing one or more of the
* following properties: {@code mousedown, mouseup, mousedrag, click,
* doubleclick, mousemove, mouseenter, mouseleave}
* following properties: {@values frame, mousedown, mouseup, mousedrag,
* click, doubleclick, mousemove, mouseenter, mouseleave}
* @return {Item} this item itself, so calls can be chained
*
* @example {@paperscript}
@ -3767,10 +3797,10 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
*
* @name Item#off
* @function
* @param {String('mousedown', 'mouseup', 'mousedrag', 'click',
* 'doubleclick', 'mousemove', 'mouseenter', 'mouseleave')} type the event
* type
* @param {Function} function The function to be detached
* @param {String} type the type of event: {@values 'frame', mousedown',
* 'mouseup', 'mousedrag', 'click', 'doubleclick', 'mousemove',
* 'mouseenter', 'mouseleave'}
* @param {Function} function the function to be detached
* @return {Item} this item itself, so calls can be chained
*/
/**
@ -3779,8 +3809,8 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
* @name Item#off
* @function
* @param {Object} object an object literal containing one or more of the
* following properties: {@code mousedown, mouseup, mousedrag, click,
* doubleclick, mousemove, mouseenter, mouseleave}
* following properties: {@values frame, mousedown, mouseup, mousedrag,
* click, doubleclick, mousemove, mouseenter, mouseleave}
* @return {Item} this item itself, so calls can be chained
*/
@ -3789,9 +3819,9 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
*
* @name Item#emit
* @function
* @param {String('mousedown', 'mouseup', 'mousedrag', 'click',
* 'doubleclick', 'mousemove', 'mouseenter', 'mouseleave')} type the event
* type
* @param {String} type the type of event: {@values 'frame', mousedown',
* 'mouseup', 'mousedrag', 'click', 'doubleclick', 'mousemove',
* 'mouseenter', 'mouseleave'}
* @param {Object} event an object literal containing properties describing
* the event
* @return {Boolean} {@true if the event had listeners}
@ -3802,9 +3832,9 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
*
* @name Item#responds
* @function
* @param {String('mousedown', 'mouseup', 'mousedrag', 'click',
* 'doubleclick', 'mousemove', 'mouseenter', 'mouseleave')} type the event
* type
* @param {String} type the type of event: {@values 'frame', mousedown',
* 'mouseup', 'mousedrag', 'click', 'doubleclick', 'mousemove',
* 'mouseenter', 'mouseleave'}
* @return {Boolean} {@true if the item has one or more event handlers of
* the specified type}
*/

View file

@ -91,8 +91,8 @@ var PlacedSymbol = Item.extend(/** @lends PlacedSymbol# */{
/**
* The symbol that the placed symbol refers to.
*
* @type Symbol
* @bean
* @type Symbol
*/
getSymbol: function() {
return this._symbol;

View file

@ -120,8 +120,8 @@ var Raster = Item.extend(/** @lends Raster# */{
/**
* The size of the raster in pixels.
*
* @type Size
* @bean
* @type Size
*/
getSize: function() {
var size = this._size;
@ -155,8 +155,8 @@ var Raster = Item.extend(/** @lends Raster# */{
/**
* The width of the raster in pixels.
*
* @type Number
* @bean
* @type Number
*/
getWidth: function() {
return this._size ? this._size.width : 0;
@ -169,8 +169,8 @@ var Raster = Item.extend(/** @lends Raster# */{
/**
* The height of the raster in pixels.
*
* @type Number
* @bean
* @type Number
*/
getHeight: function() {
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
* inch).
*
* @type Size
* @bean
* @type Size
*/
getResolution: function() {
var matrix = this._matrix,
@ -213,8 +213,8 @@ var Raster = Item.extend(/** @lends Raster# */{
/**
* The HTMLImageElement of the raster, if one is associated.
*
* @type HTMLImageElement|Canvas
* @bean
* @type HTMLImageElement|Canvas
*/
getImage: function() {
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
* case `null` is returned instead.
*
* @type Canvas
* @bean
* @type Canvas
*/
getCanvas: function() {
if (!this._canvas) {
@ -277,8 +277,8 @@ var Raster = Item.extend(/** @lends Raster# */{
/**
* The Canvas 2D drawing context of the raster.
*
* @type Context
* @bean
* @type Context
*/
getContext: function(modify) {
if (!this._context)

View file

@ -48,8 +48,9 @@ var Shape = Item.extend(/** @lends Shape# */{
/**
* The type of shape of the item as a string.
*
* @type String('rectangle', 'circle', 'ellipse')
* @bean
* @type String
* @values 'rectangle', 'circle', 'ellipse'
*/
getType: function() {
return this._type;
@ -70,8 +71,8 @@ var Shape = Item.extend(/** @lends Shape# */{
/**
* The size of the shape.
*
* @type Size
* @bean
* @type Size
*/
getSize: function() {
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
* for ellipses and rounded rectangles.
*
* @type Number|Size
* @bean
* @type Number|Size
*/
getRadius: function() {
var rad = this._radius;

View file

@ -13,10 +13,15 @@
/**
* @name CompoundPath
*
* @class A compound path contains two or more paths, holes are drawn
* where the paths overlap. All the paths in a compound path take on the
* style of the backmost path and can be accessed through its
* {@link Item#children} list.
* @class A compound path is a complex path that is made up of one or more
* simple sub-paths. It can have the `nonzero` fill rule, or the `evenodd` rule
* applied. Both rules use mathematical equations to determine if any region is
* 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
*/
@ -163,8 +168,8 @@ var CompoundPath = PathItem.extend(/** @lends CompoundPath# */{
/**
* Specifies whether the compound path is oriented clock-wise.
*
* @type Boolean
* @bean
* @type Boolean
*/
isClockwise: function() {
var child = this.getFirstChild();
@ -180,8 +185,8 @@ var CompoundPath = PathItem.extend(/** @lends CompoundPath# */{
/**
* The first Segment contained within the path.
*
* @type Segment
* @bean
* @type Segment
*/
getFirstSegment: function() {
var first = this.getFirstChild();
@ -191,8 +196,8 @@ var CompoundPath = PathItem.extend(/** @lends CompoundPath# */{
/**
* The last Segment contained within the path.
*
* @type Segment
* @bean
* @type Segment
*/
getLastSegment: function() {
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
* {@link Path} items.
*
* @type Curve[]
* @bean
* @type Curve[]
*/
getCurves: function() {
var children = this._children,
@ -217,8 +222,8 @@ var CompoundPath = PathItem.extend(/** @lends CompoundPath# */{
/**
* The first Curve contained within the path.
*
* @type Curve
* @bean
* @type Curve
*/
getFirstCurve: function() {
var first = this.getFirstChild();
@ -228,8 +233,8 @@ var CompoundPath = PathItem.extend(/** @lends CompoundPath# */{
/**
* The last Curve contained within the path.
*
* @type Curve
* @bean
* @type Curve
*/
getLastCurve: function() {
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
* can contain sub-areas that cancel each other out.
*
* @type Number
* @bean
* @type Number
*/
getArea: function() {
var children = this._children,

View file

@ -174,8 +174,8 @@ var Curve = Base.extend(/** @lends Curve# */{
/**
* The first anchor point of the curve.
*
* @type Point
* @bean
* @type Point
*/
getPoint1: function() {
return this._segment1._point;
@ -189,8 +189,8 @@ var Curve = Base.extend(/** @lends Curve# */{
/**
* The second anchor point of the curve.
*
* @type Point
* @bean
* @type Point
*/
getPoint2: function() {
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.
*
* @type Point
* @bean
* @type Point
*/
getHandle1: function() {
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.
*
* @type Point
* @bean
* @type Point
*/
getHandle2: function() {
return this._segment2._handleIn;
@ -234,8 +234,8 @@ var Curve = Base.extend(/** @lends Curve# */{
/**
* The first segment of the curve.
*
* @type Segment
* @bean
* @type Segment
*/
getSegment1: function() {
return this._segment1;
@ -244,8 +244,8 @@ var Curve = Base.extend(/** @lends Curve# */{
/**
* The second segment of the curve.
*
* @type Segment
* @bean
* @type Segment
*/
getSegment2: function() {
return this._segment2;
@ -254,8 +254,8 @@ var Curve = Base.extend(/** @lends Curve# */{
/**
* The path that the curve belongs to.
*
* @type Path
* @bean
* @type Path
*/
getPath: function() {
return this._path;
@ -264,8 +264,8 @@ var Curve = Base.extend(/** @lends Curve# */{
/**
* The index of the curve in the {@link Path#curves} array.
*
* @type Number
* @bean
* @type Number
*/
getIndex: function() {
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
* belongs to.
*
* @type Curve
* @bean
* @type Curve
*/
getNext: function() {
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
* belongs to.
*
* @type Curve
* @bean
* @type Curve
*/
getPrevious: function() {
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.
*
* @type Boolean
* @bean
* @type Boolean
*/
isSelected: function() {
return this.getPoint1().isSelected()
@ -345,8 +345,8 @@ var Curve = Base.extend(/** @lends Curve# */{
*
* Note that the handles are converted to absolute coordinates.
*
* @type Number[]
* @bean
* @type Number[]
*/
getValues: function(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.
*
* @type Point[]
* @bean
* @type Point[]
*/
getPoints: function() {
// Convert to array of absolute points
@ -373,8 +373,8 @@ var Curve = Base.extend(/** @lends Curve# */{
/**
* The approximated length of the curve.
*
* @type Number
* @bean
* @type Number
*/
getLength: function() {
if (this._length == null)
@ -385,16 +385,16 @@ var Curve = Base.extend(/** @lends Curve# */{
/**
* The area that the curve's geometry is covering.
*
* @type Number
* @bean
* @type Number
*/
getArea: function() {
return Curve.getArea(this.getValues());
},
/**
* @type Line
* @bean
* @type Line
* @private
*/
getLine: function() {

View file

@ -92,8 +92,8 @@ var CurveLocation = Base.extend(/** @lends CurveLocation# */{
/**
* The segment of the curve which is closer to the described location.
*
* @type Segment
* @bean
* @type Segment
*/
getSegment: function() {
// 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.
*
* @type Curve
* @bean
* @type Curve
*/
getCurve: function() {
var path = this._path,
@ -157,8 +157,8 @@ var CurveLocation = Base.extend(/** @lends CurveLocation# */{
/**
* The path that this locations is situated on.
*
* @type Item
* @bean
* @type Item
*/
getPath: function() {
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
* it is part of a {@link Path} item.
*
* @type Index
* @bean
* @type Index
*/
getIndex: function() {
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
* curve).
*
* @type Number
* @bean
* @type Number
*/
getParameter: function() {
var curve = this.getCurve(),
@ -197,8 +197,8 @@ var CurveLocation = Base.extend(/** @lends CurveLocation# */{
* The point which is defined by the {@link #curve} and
* {@link #parameter}.
*
* @type Point
* @bean
* @type Point
*/
getPoint: function() {
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
* within the curve is returned instead.
*
* @type Number
* @bean
* @type Number
*/
getOffset: function() {
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
* by this object.
*
* @type Number
* @bean
* @type Number
*/
getCurveOffset: function() {
var curve = this.getCurve(),
@ -246,8 +246,8 @@ var CurveLocation = Base.extend(/** @lends CurveLocation# */{
* result of a call to {@link PathItem#getIntersections(path)} /
* {@link Curve#getIntersections(curve)}.
*
* @type CurveLocation
* @bean
* @type CurveLocation
*/
getIntersection: function() {
return this._intersection;
@ -257,31 +257,31 @@ var CurveLocation = Base.extend(/** @lends CurveLocation# */{
* The tangential vector to the {@link #curve} at the given location.
*
* @name CurveLocation#getTangent
* @type Point
* @bean
* @type Point
*/
/**
* The normal vector to the {@link #curve} at the given location.
*
* @name CurveLocation#getNormal
* @type Point
* @bean
* @type Point
*/
/**
* The curvature of the {@link #curve} at the given location.
*
* @name CurveLocation#getCurvature
* @type Number
* @bean
* @type Number
*/
/**
* The distance from the queried point to the returned location.
*
* @type Number
* @bean
* @type Number
* @see Curve#getNearestLocation(point)
* @see Path#getNearestLocation(point)
*/

View file

@ -176,8 +176,8 @@ var Path = PathItem.extend(/** @lends Path# */{
/**
* The segments contained within the path.
*
* @type Segment[]
* @bean
* @type Segment[]
*/
getSegments: function() {
return this._segments;
@ -200,8 +200,8 @@ var Path = PathItem.extend(/** @lends Path# */{
/**
* The first Segment contained within the path.
*
* @type Segment
* @bean
* @type Segment
*/
getFirstSegment: function() {
return this._segments[0];
@ -210,8 +210,8 @@ var Path = PathItem.extend(/** @lends Path# */{
/**
* The last Segment contained within the path.
*
* @type Segment
* @bean
* @type Segment
*/
getLastSegment: function() {
return this._segments[this._segments.length - 1];
@ -220,8 +220,8 @@ var Path = PathItem.extend(/** @lends Path# */{
/**
* The curves contained within the path.
*
* @type Curve[]
* @bean
* @type Curve[]
*/
getCurves: function() {
var curves = this._curves,
@ -240,8 +240,8 @@ var Path = PathItem.extend(/** @lends Path# */{
/**
* The first Curve contained within the path.
*
* @type Curve
* @bean
* @type Curve
*/
getFirstCurve: function() {
return this.getCurves()[0];
@ -250,8 +250,8 @@ var Path = PathItem.extend(/** @lends Path# */{
/**
* The last Curve contained within the path.
*
* @type Curve
* @bean
* @type Curve
*/
getLastCurve: function() {
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
* the first and last segments.
*
* @type Boolean
* @bean
* @type Boolean
*
* @example {@paperscript}
* var myPath = new Path();
@ -805,8 +805,8 @@ var Path = PathItem.extend(/** @lends Path# */{
/**
* The approximate length of the path.
*
* @type Number
* @bean
* @type Number
*/
getLength: function() {
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
* can contain sub-areas that cancel each other out.
*
* @type Number
* @bean
* @type Number
*/
getArea: function() {
if (this._area == null) {
@ -844,8 +844,8 @@ var Path = PathItem.extend(/** @lends Path# */{
/**
* Specifies whether the path is oriented clock-wise.
*
* @type Boolean
* @bean
* @type Boolean
*/
isClockwise: function() {
if (this._clockwise !== undefined)
@ -873,8 +873,8 @@ var Path = PathItem.extend(/** @lends Path# */{
* construction of paths, position of path curves, individual segment points
* and bounding boxes of symbol and raster items.
*
* @type Boolean
* @bean
* @type Boolean
* @see Project#selectedItems
* @see Segment#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
* `true` on an empty path.
*
* @type Boolean
* @bean
* @type Boolean
*
* @example {@paperscript}
* // A path is fully selected, if all of its segments are selected:

View file

@ -981,8 +981,8 @@ Path.inject(/** @lends Path# */{
/**
* Returns a point that is guaranteed to be inside the path.
*
* @type Point
* @bean
* @type Point
*/
getInteriorPoint: function() {
var bounds = this.getBounds(),

View file

@ -170,8 +170,8 @@ var PathItem = Item.extend(/** @lends PathItem# */{
* The path's geometry, formatted as SVG style path data.
*
* @name PathItem#getPathData
* @type String
* @bean
* @type String
*/
setPathData: function(data) {

View file

@ -181,8 +181,8 @@ var Segment = Base.extend(/** @lends Segment# */{
/**
* The anchor point of the segment.
*
* @type Point
* @bean
* @type Point
*/
getPoint: function() {
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
* describes the in tangent of the segment.
*
* @type Point
* @bean
* @type Point
*/
getHandleIn: function() {
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
* describes the out tangent of the segment.
*
* @type Point
* @bean
* @type Point
*/
getHandleOut: function() {
return this._handleOut;
@ -255,8 +255,10 @@ var Segment = Base.extend(/** @lends Segment# */{
/**
* Specifies whether the {@link #point} of the segment is selected.
* @type Boolean
*
* @bean
* @type Boolean
*
* @example {@paperscript}
* var path = new Path.Circle({
* 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
* segment belongs to.
*
* @type Number
* @bean
* @type Number
*/
getIndex: function() {
return this._index !== undefined ? this._index : null;
@ -321,8 +323,8 @@ var Segment = Base.extend(/** @lends Segment# */{
/**
* The path that the segment belongs to.
*
* @type Path
* @bean
* @type Path
*/
getPath: function() {
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
* path, the previous segment is returned.
*
* @type Curve
* @bean
* @type Curve
*/
getCurve: function() {
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.
*
* @type CurveLocation
* @bean
* @type CurveLocation
*/
getLocation: function() {
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
* is returned for the last segment of the path.
*
* @type Segment
* @bean
* @type Segment
*/
getNext: function() {
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 is returned for the first segment of the path.
*
* @type Segment
* @bean
* @type Segment
*/
getPrevious: function() {
var segments = this._path && this._path._segments;

View file

@ -120,8 +120,9 @@ var Project = PaperScopeItem.extend(/** @lends Project# */{
/**
* The reference to the project's view.
* @type View
*
* @bean
* @type View
*/
getView: function() {
return this._view;
@ -131,8 +132,8 @@ var Project = PaperScopeItem.extend(/** @lends Project# */{
* The currently active path style. All selected items and newly
* created items will be styled with this style.
*
* @type Style
* @bean
* @type Style
*
* @example {@paperscript}
* project.currentStyle = {
@ -165,8 +166,8 @@ var Project = PaperScopeItem.extend(/** @lends Project# */{
/**
* The index of the project in the {@link PaperScope#projects} list.
*
* @type Number
* @bean
* @type Number
*/
getIndex: function() {
return this._index;
@ -175,8 +176,8 @@ var Project = PaperScopeItem.extend(/** @lends Project# */{
/**
* Gives access to the project's configurable options.
*
* @type Object
* @bean
* @type Object
* @deprecated use {@link PaperScope#settings} instead.
*/
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
* layer by default.
*
* @type Layer
* @bean
* @type Layer
*/
getActiveLayer: function() {
return this._activeLayer || new Layer({ project: this });
@ -213,8 +214,8 @@ var Project = PaperScopeItem.extend(/** @lends Project# */{
/**
* The selected items contained within the project.
*
* @type Item[]
* @bean
* @type Item[]
*/
getSelectedItems: function() {
// 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]
* {Number} the tolerance of the hit-test
* @option options.class {Function} only hit-test again a certain item class
* and its sub-classes: {@code Group, Layer, Path, CompoundPath, Shape,
* Raster, PlacedSymbol, PointText}, etc
* and its sub-classes: {@values Group, Layer, Path, CompoundPath,
* Shape, Raster, PlacedSymbol, PointText, ...}
* @option options.fill {Boolean} hit-test the fill of items
* @option options.stroke {Boolean} hit-test the stroke of path items,
* taking into account the setting of stroke color and width

View file

@ -105,8 +105,8 @@ var Symbol = Base.extend(/** @lends Symbol# */{
/**
* The symbol definition.
*
* @type Item
* @bean
* @type Item
*/
getDefinition: function() {
return this._definition;

View file

@ -662,8 +662,8 @@ var Color = Base.extend(new function() {
/**
* Converts the color another type.
*
* @param {String('rgb', 'gray', 'hsb', 'hsl')} type the color type to
* convert to.
* @param {String} type the color type to convert to. Possible values:
* {@values 'rgb', 'gray', 'hsb', 'hsl'}
* @return {Color} the converted color as a new instance
*/
convert: function(type) {
@ -673,8 +673,9 @@ var Color = Base.extend(new function() {
/**
* The type of the color as a string.
*
* @type String('rgb', 'gray', 'hsb', 'hsl')
* @bean
* @type String
* @values 'rgb', 'gray', 'hsb', 'hsl'
*
* @example
* 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
* if defined.
*
* @type Number[]
* @bean
* @type Number[]
*/
getComponents: function() {
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`.
* All colors of the different subclasses support alpha values.
*
* @type Number
* @bean
* @type Number
* @default 1
*
* @example {@paperscript}

View file

@ -130,8 +130,8 @@ var Gradient = Base.extend(/** @lends Gradient# */{
/**
* The gradient stops on the gradient ramp.
*
* @type GradientStop[]
* @bean
* @type GradientStop[]
*/
getStops: function() {
return this._stops;
@ -161,8 +161,8 @@ var Gradient = Base.extend(/** @lends Gradient# */{
/**
* Specifies whether the gradient is radial or linear.
*
* @type Boolean
* @bean
* @type Boolean
*/
getRadial: function() {
return this._radial;

View file

@ -74,8 +74,8 @@ var GradientStop = Base.extend(/** @lends GradientStop# */{
/**
* The ramp-point of the gradient stop as a value between `0` and `1`.
*
* @type Number
* @bean
* @type Number
*
* @example {@paperscript height=300}
* // Animating a gradient's ramp points:
@ -123,8 +123,8 @@ var GradientStop = Base.extend(/** @lends GradientStop# */{
/**
* The color of the gradient stop.
*
* @type Color
* @bean
* @type Color
*
* @example {@paperscript height=300}
* // Animating a gradient's ramp points:

View file

@ -297,8 +297,9 @@ var Style = Base.extend(new function() {
/**
* The view that this style belongs to.
* @type View
*
* @bean
* @type View
*/
getView: function() {
return this._project.getView();
@ -320,8 +321,8 @@ var Style = Base.extend(new function() {
},
/**
* @private
* @bean
* @private
* @deprecated use {@link #fontFamily} instead.
*/
getFont: '#getFontFamily',
@ -371,8 +372,8 @@ var Style = Base.extend(new function() {
*
* @name Style#strokeWidth
* @property
* @default 1
* @type Number
* @default 1
*
* @example {@paperscript}
* // Setting an item's stroke width:
@ -394,8 +395,9 @@ var Style = Base.extend(new function() {
*
* @name Style#strokeCap
* @property
* @type String
* @values 'round', 'square', 'butt'
* @default 'butt'
* @type String('round', 'square', 'butt')
*
* @example {@paperscript height=200}
* // A look at the different stroke caps:
@ -427,8 +429,9 @@ var Style = Base.extend(new function() {
*
* @name Style#strokeJoin
* @property
* @type String
* @values 'miter', 'round', 'bevel'
* @default 'miter'
* @type String('miter', 'round', 'bevel')
*
* @example {@paperscript height=120}
* // A look at the different stroke joins:
@ -458,8 +461,8 @@ var Style = Base.extend(new function() {
*
* @name Style#strokeScaling
* @property
* @default true
* @type Boolean
* @default true
*/
/**
@ -467,8 +470,8 @@ var Style = Base.extend(new function() {
*
* @name Style#dashOffset
* @property
* @default 0
* @type Number
* @default 0
*/
/**
@ -484,8 +487,8 @@ var Style = Base.extend(new function() {
*
* @name Style#dashArray
* @property
* @default []
* @type Array
* @default []
*/
/**
@ -527,8 +530,9 @@ var Style = Base.extend(new function() {
*
* @name Style#fillRule
* @property
* @type String
* @values 'nonzero', 'evenodd'
* @default 'nonzero'
* @type String('nonzero', 'evenodd')
*/
/**
@ -560,18 +564,18 @@ var Style = Base.extend(new function() {
* The shadow's blur radius.
*
* @property
* @default 0
* @name Style#shadowBlur
* @type Number
* @default 0
*/
/**
* The shadow's offset.
*
* @property
* @default 0
* @name Style#shadowOffset
* @type Point
* @default 0
*/
/**
@ -591,8 +595,8 @@ var Style = Base.extend(new function() {
* The font-family to be used in text content.
*
* @name Style#fontFamily
* @default 'sans-serif'
* @type String
* @default 'sans-serif'
*/
/**
@ -600,8 +604,8 @@ var Style = Base.extend(new function() {
* The font-weight to be used in text content.
*
* @name Style#fontWeight
* @default 'normal'
* @type String|Number
* @default 'normal'
*/
/**
@ -609,8 +613,8 @@ var Style = Base.extend(new function() {
* optional units `'px'`, `'pt'` and `'em'`.
*
* @name Style#fontSize
* @default 10
* @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.
*
* @name Style#font
* @default 'sans-serif'
* @type String
* @default 'sans-serif'
* @deprecated use {@link #fontFamily} instead.
*/
@ -627,8 +631,8 @@ var Style = Base.extend(new function() {
* The text leading of text content.
*
* @name Style#leading
* @default fontSize * 1.2
* @type Number|String
* @default fontSize * 1.2
*/
/**
@ -637,7 +641,8 @@ var Style = Base.extend(new function() {
* The justification of text paragraphs.
*
* @name Style#justification
* @type String
* @values 'left', 'right', 'center'
* @default 'left'
* @type String('left', 'right', 'center')
*/
});

View file

@ -61,8 +61,8 @@ var PointText = TextItem.extend(/** @lends PointText# */{
/**
* The PointText's anchor point
*
* @type Point
* @bean
* @type Point
*/
getPoint: function() {
// Se Item#getPosition for an explanation why we create new LinkedPoint

View file

@ -57,8 +57,8 @@ var TextItem = Item.extend(/** @lends TextItem# */{
/**
* The text contents of the text item.
*
* @type String
* @bean
* @type String
*
* @example {@paperscript}
* // 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.
*
* @name TextItem#fontFamily
* @default 'sans-serif'
* @type String
* @default 'sans-serif'
*/
/**
@ -114,8 +114,8 @@ var TextItem = Item.extend(/** @lends TextItem# */{
* The font-weight to be used in text content.
*
* @name TextItem#fontWeight
* @default 'normal'
* @type String|Number
* @default 'normal'
*/
/**
@ -123,8 +123,8 @@ var TextItem = Item.extend(/** @lends TextItem# */{
* optional units `'px'`, `'pt'` and `'em'`.
*
* @name TextItem#fontSize
* @default 10
* @type Number|String
* @default 10
*/
/**
@ -133,16 +133,16 @@ var TextItem = Item.extend(/** @lends TextItem# */{
* @deprecated use {@link #fontFamily} instead.
*
* @name TextItem#font
* @default 'sans-serif'
* @type String
* @default 'sans-serif'
*/
/**
* The text leading of text content.
*
* @name TextItem#leading
* @default fontSize * 1.2
* @type Number|String
* @default fontSize * 1.2
*/
/**
@ -151,21 +151,22 @@ var TextItem = Item.extend(/** @lends TextItem# */{
* The justification of text paragraphs.
*
* @name TextItem#justification
* @type String
* @values 'left', 'right', 'center'
* @default 'left'
* @type String('left', 'right', 'center')
*/
/**
* @private
* @bean
* @private
* @deprecated use {@link #style} instead.
*/
getCharacterStyle: '#getStyle',
setCharacterStyle: '#setStyle',
/**
* @private
* @bean
* @private
* @deprecated use {@link #style} instead.
*/
getParagraphStyle: '#getStyle',

View file

@ -30,14 +30,14 @@
* // has moved at least 10 points:
* tool.distanceThreshold = 10;
*
* function onMouseDown(event) {
* tool.onMouseDown = function(event) {
* // Create a new path every time the mouse is clicked
* path = new Path();
* path.add(event.point);
* path.strokeColor = 'black';
* }
*
* function onMouseDrag(event) {
* tool.onMouseDrag = function(event) {
* // Add a point to the path every time the mouse is dragged
* path.add(event.point);
* }
@ -61,7 +61,7 @@ var Tool = PaperScopeItem.extend(/** @lends Tool# */{
/**
* 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
* @function
@ -78,8 +78,8 @@ var Tool = PaperScopeItem.extend(/** @lends Tool# */{
* The minimum distance the mouse has to drag before firing the onMouseDrag
* event, since the last onMouseDrag event.
*
* @type Number
* @bean
* @type Number
*/
getMinDistance: function() {
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
* event, since the last onMouseDrag event.
*
* @type Number
* @bean
* @type Number
*/
getMaxDistance: function() {
return this._maxDistance;
@ -114,8 +114,8 @@ var Tool = PaperScopeItem.extend(/** @lends Tool# */{
// DOCS: document Tool#fixedDistance
/**
* @type Number
* @bean
* @type Number
*/
getFixedDistance: function() {
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
* function receives a {@link ToolEvent} object which contains information
* about the mouse event.
* about the tool event.
*
* @name Tool#onMouseDown
* @property
@ -139,7 +139,7 @@ var Tool = PaperScopeItem.extend(/** @lends Tool# */{
*
* @example {@paperscript}
* // 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
* // at the position of the mouse (event.point):
* 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
* 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
* @property
@ -167,7 +167,7 @@ var Tool = PaperScopeItem.extend(/** @lends Tool# */{
* strokeColor: 'black'
* });
*
* function onMouseDrag(event) {
* tool.onMouseDrag = function(event) {
* // Add a segment to the path at the position of the mouse:
* 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
* function receives a {@link ToolEvent} object which contains information
* about the mouse event.
* about the tool event.
*
* @name Tool#onMouseMove
* @property
@ -192,7 +192,7 @@ var Tool = PaperScopeItem.extend(/** @lends Tool# */{
* fillColor: 'black'
* });
*
* function onMouseMove(event) {
* tool.onMouseMove = function(event) {
* // Whenever the user moves the mouse, move the path
* // to that position:
* 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
* receives a {@link ToolEvent} object which contains information about the
* mouse event.
* tool event.
*
* @name Tool#onMouseUp
* @property
@ -210,7 +210,7 @@ var Tool = PaperScopeItem.extend(/** @lends Tool# */{
*
* @example {@paperscript}
* // 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
* // at the position of the mouse (event.point):
* var path = new Path.Circle({
@ -246,7 +246,7 @@ var Tool = PaperScopeItem.extend(/** @lends Tool# */{
* fillColor: 'red'
* });
*
* function onKeyDown(event) {
* tool.onKeyDown = function(event) {
* if (event.key == 'space') {
* // Scale the path by 110%:
* path.scale(1.1);
@ -271,7 +271,7 @@ var Tool = PaperScopeItem.extend(/** @lends Tool# */{
* @type Function
*
* @example
* function onKeyUp(event) {
* tool.onKeyUp = function(event) {
* if (event.key == 'space') {
* console.log('The spacebar was released!');
* }
@ -411,10 +411,10 @@ var Tool = PaperScopeItem.extend(/** @lends Tool# */{
*
* @name Tool#on
* @function
* @param {String('mousedown', 'mouseup', 'mousedrag', 'mousemove',
* 'keydown', 'keyup')} type the event type
* @param {Function} function The function to be called when the event
* occurs
* @param {String} type the event type: {@values 'mousedown', 'mouseup',
* 'mousedrag', 'mousemove', 'keydown', 'keyup'}
* @param {Function} function the function to be called when the event
* occurs, receiving a {@link ToolEvent} object as its sole argument
* @return {Tool} this tool itself, so calls can be chained
*/
/**
@ -423,8 +423,8 @@ var Tool = PaperScopeItem.extend(/** @lends Tool# */{
* @name Tool#on
* @function
* @param {Object} param an object literal containing one or more of the
* following properties: {@code mousedown, mouseup, mousedrag, mousemove,
* keydown, keyup}
* following properties: {@values mousedown, mouseup, mousedrag,
* mousemove, keydown, keyup}
* @return {Tool} this tool itself, so calls can be chained
*/
@ -433,9 +433,9 @@ var Tool = PaperScopeItem.extend(/** @lends Tool# */{
*
* @name Tool#off
* @function
* @param {String('mousedown', 'mouseup', 'mousedrag', 'mousemove',
* 'keydown', 'keyup')} type the event type
* @param {Function} function The function to be detached
* @param {String} type the event type: {@values 'mousedown', 'mouseup',
* 'mousedrag', 'mousemove', 'keydown', 'keyup'}
* @param {Function} function the function to be detached
* @return {Tool} this tool itself, so calls can be chained
*/
/**
@ -444,8 +444,8 @@ var Tool = PaperScopeItem.extend(/** @lends Tool# */{
* @name Tool#off
* @function
* @param {Object} param an object literal containing one or more of the
* following properties: {@code mousedown, mouseup, mousedrag, mousemove,
* keydown, keyup}
* following properties: {@values mousedown, mouseup, mousedrag,
* mousemove, keydown, keyup}
* @return {Tool} this tool itself, so calls can be chained
*/
@ -454,8 +454,8 @@ var Tool = PaperScopeItem.extend(/** @lends Tool# */{
*
* @name Tool#emit
* @function
* @param {String('mousedown', 'mouseup', 'mousedrag', 'mousemove',
* 'keydown', 'keyup')} type the event type
* @param {String} type the event type: {@values 'mousedown', 'mouseup',
* 'mousedrag', 'mousemove', 'keydown', 'keyup'}
* @param {Object} event an object literal containing properties describing
* the event
* @return {Boolean} {@true if the event had listeners}
@ -466,8 +466,8 @@ var Tool = PaperScopeItem.extend(/** @lends Tool# */{
*
* @name Tool#responds
* @function
* @param {String('mousedown', 'mouseup', 'mousedrag', 'mousemove',
* 'keydown', 'keyup')} type the event type
* @param {String} type the event type: {@values 'mousedown', 'mouseup',
* 'mousedrag', 'mousemove', 'keydown', 'keyup'}
* @return {Boolean} {@true if the tool has one or more event handlers of
* the specified type}
*/

View file

@ -44,7 +44,8 @@ var ToolEvent = Event.extend(/** @lends ToolEvent# */{
* The type of tool event.
*
* @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);
* }
*
* @type Point
* @bean
* @type Point
*/
getPoint: function() {
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
* event was fired.
*
* @type Point
* @bean
* @type Point
*/
getLastPoint: function() {
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
* was last clicked.
*
* @type Point
* @bean
* @type Point
*/
getDownPoint: function() {
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
* {@link #delta}.
*
* @type Point
* @bean
* @type Point
*/
getMiddlePoint: function() {
// 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
* difference to the mousedown position is returned.
*
* @type Point
* @bean
* @type Point
*/
getDelta: function() {
// 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.
*
* @type Number
* @bean
* @type Number
*/
getCount: function() {
// 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
* that it is contained within is returned.
*
* @type Item
* @bean
* @type Item
*/
getItem: function() {
if (!this._item) {

View file

@ -287,8 +287,8 @@ var View = Base.extend(Emitter, /** @lends View# */{
/**
* The underlying native element.
*
* @type HTMLCanvasElement
* @bean
* @type HTMLCanvasElement
*/
getElement: function() {
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
* high-resolution displays.
*
* @type Number
* @bean
* @type Number
*/
getPixelRatio: function() {
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
* displays with a pixel-ratio of `2`.
*
* @type Number
* @bean
* @type Number
*/
getResolution: function() {
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
* underlying element.
*
* @type Size
* @bean
* @type Size
*/
getViewSize: function() {
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.
*
* @type Rectangle
* @bean
* @type Rectangle
*/
getBounds: function() {
if (!this._bounds)
@ -373,8 +372,8 @@ var View = Base.extend(Emitter, /** @lends View# */{
/**
* The size of the visible area in project coordinates.
*
* @type Size
* @bean
* @type Size
*/
getSize: function() {
return this.getBounds().getSize();
@ -383,8 +382,8 @@ var View = Base.extend(Emitter, /** @lends View# */{
/**
* The center of the visible area in project coordinates.
*
* @type Point
* @bean
* @type Point
*/
getCenter: function() {
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.
*
* @type Number
* @bean
* @type Number
*/
getZoom: function() {
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));
* path.fillColor = 'black';
*
* function onFrame(event) {
* view.onFrame = function(event) {
* // Every frame, rotate the path by 3 degrees:
* path.rotate(3);
* }
@ -541,7 +540,7 @@ var View = Base.extend(Emitter, /** @lends View# */{
* var path = new Path.Circle(view.bounds.center, 30);
* path.fillColor = 'red';
*
* function onResize(event) {
* view.onResize = function(event) {
* // Whenever the view is resized, move the path to its center:
* path.position = view.center;
* }
@ -557,9 +556,12 @@ var View = Base.extend(Emitter, /** @lends View# */{
*
* @name View#on
* @function
* @param {String('frame', 'resize')} type the event type
* @param {Function} function The function to be called when the event
* occurs
* @param {String} type the type of event: {@values 'frame', 'resize',
* mousedown', 'mouseup', 'mousedrag', 'click', 'doubleclick',
* '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
*
* @example {@paperscript}
@ -581,7 +583,7 @@ var View = Base.extend(Emitter, /** @lends View# */{
* @name View#on
* @function
* @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
*
* @example {@paperscript}
@ -605,8 +607,8 @@ var View = Base.extend(Emitter, /** @lends View# */{
*
* @name View#off
* @function
* @param {String('frame', 'resize')} type the event type
* @param {Function} function The function to be detached
* @param {String} type the event type: {@values 'frame', 'resize'}
* @param {Function} function the function to be detached
* @return {View} this view itself, so calls can be chained
*
* @example {@paperscript}
@ -636,7 +638,7 @@ var View = Base.extend(Emitter, /** @lends View# */{
* @name View#off
* @function
* @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
*/
@ -645,7 +647,7 @@ var View = Base.extend(Emitter, /** @lends View# */{
*
* @name View#emit
* @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
* the event
* @return {Boolean} {@true if the event had listeners}
@ -656,7 +658,7 @@ var View = Base.extend(Emitter, /** @lends View# */{
*
* @name View#responds
* @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
* the specified type}
*/