mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-22 07:19:57 -05:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
8b7eea4663
14 changed files with 138 additions and 59 deletions
14
build/jsdoc-toolkit/app/plugins/grouptitle.js
Normal file
14
build/jsdoc-toolkit/app/plugins/grouptitle.js
Normal file
|
@ -0,0 +1,14 @@
|
|||
JSDOC.PluginManager.registerPlugin(
|
||||
"JSDOC.grouptitle",
|
||||
{
|
||||
beanSymbols: {},
|
||||
onSymbol: function(symbol) {
|
||||
var matches = symbol.desc.match(/\{@grouptitle ([^}]+)\}/),
|
||||
groupTitle;
|
||||
if (matches) {
|
||||
symbol.groupTitle = matches[1];
|
||||
symbol.desc = symbol.desc.replace(/\{@grouptitle ([^}]+)\}/, '');
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
|
@ -1,8 +1,8 @@
|
|||
/** Called automatically by JsDoc Toolkit. */
|
||||
load(JSDOC.opt.t + 'Symbol.js');
|
||||
load(JSDOC.opt.t + 'Utils.js');
|
||||
load(JSDOC.opt.t + 'Operator.js');
|
||||
load(JSDOC.opt.t + 'Render.js');
|
||||
load(JSDOC.opt.t + 'src/Symbol.js');
|
||||
load(JSDOC.opt.t + 'src/Utils.js');
|
||||
load(JSDOC.opt.t + 'src/Operator.js');
|
||||
load(JSDOC.opt.t + 'src/Render.js');
|
||||
|
||||
function publish(symbolSet) {
|
||||
var renderMode = JSDOC.opt.D.renderMode;
|
||||
|
|
|
@ -18,7 +18,8 @@ var Operator = new function() {
|
|||
&& (symbol.operator != 'none')
|
||||
) || ( // equals
|
||||
symbol.name == 'equals'
|
||||
&& symbol.returns.length && symbol.returns[0].type == 'boolean'
|
||||
&& symbol.returns.length
|
||||
&& symbol.returns[0].type.toLowerCase() == 'boolean'
|
||||
);
|
||||
},
|
||||
|
|
@ -14,7 +14,6 @@ var Render = new function() {
|
|||
example: 'example.tmpl',
|
||||
constructor: 'constructor.tmpl',
|
||||
html: 'html.tmpl',
|
||||
allClasses: 'allClasses.tmpl',
|
||||
menu: 'packages.tmpl',
|
||||
operator: 'operator.tmpl',
|
||||
packagesjs: 'packagesjs.tmpl'
|
||||
|
@ -24,16 +23,6 @@ var Render = new function() {
|
|||
templates[i] = new JSDOC.JsPlate(templatesDir + templates[i]);
|
||||
}
|
||||
|
||||
var processGroupTitle = function(symbol) {
|
||||
var matches = symbol.desc.match(/\{@grouptitle ([^}]+)\}/),
|
||||
groupTitle;
|
||||
if (matches) {
|
||||
groupTitle = matches[1];
|
||||
symbol.desc = symbol.desc.replace(/\{@grouptitle ([^}]+)\}/, '');
|
||||
}
|
||||
return groupTitle;
|
||||
};
|
||||
|
||||
var processInlineTags = function(str, param) {
|
||||
if (!param)
|
||||
param = {};
|
||||
|
@ -183,7 +172,6 @@ var Render = new function() {
|
|||
constructor: function(symbol) {
|
||||
var param = {
|
||||
symbol: symbol,
|
||||
groupTitle: processGroupTitle(symbol),
|
||||
id: symbol.getId(),
|
||||
name: symbol.alias.replace(/(#|\^).+$/, ''),
|
||||
description: processInlineTags(symbol.desc),
|
||||
|
@ -209,7 +197,6 @@ var Render = new function() {
|
|||
name = symbol.memberOf + '.' + name;
|
||||
var param = {
|
||||
name: name,
|
||||
groupTitle: processGroupTitle(symbol),
|
||||
id: symbol.getId(),
|
||||
signature: makeSignature(symbol.params),
|
||||
description: processInlineTags(symbol.desc),
|
||||
|
@ -227,7 +214,6 @@ var Render = new function() {
|
|||
name = symbol.memberOf + '.' + name;
|
||||
var param = {
|
||||
name: name,
|
||||
groupTitle: processGroupTitle(symbol),
|
||||
id: symbol.getId(),
|
||||
description: processInlineTags(symbol.desc),
|
||||
symbol: symbol
|
||||
|
@ -314,9 +300,6 @@ var Render = new function() {
|
|||
html: function(content) {
|
||||
return templates.html.process(content);
|
||||
},
|
||||
allClasses: function(symbol) {
|
||||
return templates.allClasses.process(symbol);
|
||||
},
|
||||
menu: function(html) {
|
||||
return templates.menu.process(html);
|
||||
},
|
|
@ -1,16 +0,0 @@
|
|||
<div align="center">{+new Link().toFile("index.html").withText("Class Index")+}</div>
|
||||
<hr />
|
||||
<h2>Classes</h2>
|
||||
<ul class="classList">
|
||||
<for each="thisClass" in="data">
|
||||
<li>{!
|
||||
if (thisClass.alias == "_global_") {
|
||||
output += "<i>"+new Link().toClass(thisClass.alias)+"</i>";
|
||||
}
|
||||
else {
|
||||
output += new Link().toClass(thisClass.alias);
|
||||
}
|
||||
!}</li>
|
||||
</for>
|
||||
</ul>
|
||||
<hr />
|
|
@ -1,4 +1,4 @@
|
|||
<if test="defined(data.groupTitle)"><h3>{+data.symbol.groupTitle+}</h3></if>
|
||||
<if test="defined(data.symbol.groupTitle)"><h3>{+data.symbol.groupTitle+}</h3></if>
|
||||
<div id="{+ data.id +}" class="member">
|
||||
<div id="{+ data.id +}-link" class="member-link">
|
||||
<a name="{+ data.id +}" href="#" onClick="return toggleMember('{+ data.id +}', false);"><tt><b>{+ data.name +}</b>{+ data.signature +}</tt></a>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<if test="defined(data.groupTitle)">
|
||||
<h3>{+data.groupTitle+}</h3>
|
||||
<if test="defined(data.symbol.groupTitle)">
|
||||
<h3>{+data.symbol.groupTitle+}</h3>
|
||||
</if>
|
||||
<div id="{+ data.id +}" class="member">
|
||||
<div id="{+ data.id +}-link" class="member-link">
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<if test="defined(data.groupTitle)">
|
||||
<h3>{+ data.groupTitle +}</h3>
|
||||
<if test="defined(data.symbol.groupTitle)">
|
||||
<h3>{+ data.symbol.groupTitle +}</h3>
|
||||
</if>
|
||||
<div id="{+ data.id +}" class="member">
|
||||
<div id="{+ data.id +}-link" class="member-link">
|
||||
|
|
104
src/item/Item.js
104
src/item/Item.js
|
@ -267,7 +267,7 @@ var Item = this.Item = Base.extend({
|
|||
/**
|
||||
* The blend mode of the item.
|
||||
*
|
||||
* @type String('normal','screen','multiply','difference','src-in','add','overlay','hard-light','dodge','burn','darken','lighten','exclusion')
|
||||
* @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')
|
||||
* @default 'normal'
|
||||
*
|
||||
* @example
|
||||
|
@ -810,6 +810,10 @@ var Item = this.Item = Base.extend({
|
|||
*
|
||||
* The color of the stroke.
|
||||
*
|
||||
* @property
|
||||
* @name Item#strokeColor
|
||||
* @type RGBColor|HSBColor|GrayColor
|
||||
*
|
||||
* @example
|
||||
* // Setting an item's stroke color:
|
||||
*
|
||||
|
@ -840,7 +844,8 @@ var Item = this.Item = Base.extend({
|
|||
*/
|
||||
|
||||
/**
|
||||
* The cap of the stroke.
|
||||
* The shape to be used at the end of open {@link Path} items, when they
|
||||
* have a stroke.
|
||||
*
|
||||
* @property
|
||||
* @name Item#strokeCap
|
||||
|
@ -848,7 +853,7 @@ var Item = this.Item = Base.extend({
|
|||
* @type String('round', 'square', 'butt')
|
||||
*
|
||||
* @example
|
||||
* // Setting an item's stroke color:
|
||||
* // Setting an item's stroke cap:
|
||||
*
|
||||
* // Create a line from { x: 0, y: 50 } to { x: 50, y: 50 };
|
||||
* var line = new Path.Line(new Point(0, 50), new Point(50, 50));
|
||||
|
@ -859,7 +864,7 @@ var Item = this.Item = Base.extend({
|
|||
*/
|
||||
|
||||
/**
|
||||
* The join of the stroke.
|
||||
* The shape to be used at the corners of paths when they have a stroke.
|
||||
*
|
||||
* @property
|
||||
* @name Item#strokeJoin
|
||||
|
@ -894,6 +899,10 @@ var Item = this.Item = Base.extend({
|
|||
|
||||
/**
|
||||
* The miter limit of the stroke.
|
||||
* When two line segments meet at a sharp angle and miter joins have been
|
||||
* specified for {@link #strokeJoin}, it is possible for the miter to extend
|
||||
* far beyond the {@link #strokeWidth} of the path. The miterLimit imposes a
|
||||
* limit on the ratio of the miter length to the {@link #strokeWidth}.
|
||||
*
|
||||
* @property
|
||||
* @default 10
|
||||
|
@ -913,7 +922,8 @@ var Item = this.Item = Base.extend({
|
|||
* @example
|
||||
* // Setting the fill color of a path to red:
|
||||
*
|
||||
* // Create a circle shaped path at { x: 50, y: 50 } with a radius of 10:
|
||||
* // Create a circle shaped path at { x: 50, y: 50 }
|
||||
* // with a radius of 10:
|
||||
* var circle = new Path.Circle(new Point(50, 50), 10);
|
||||
*
|
||||
* // Set the fill color of the circle to RGB red:
|
||||
|
@ -937,6 +947,7 @@ var Item = this.Item = Base.extend({
|
|||
*
|
||||
* // Create a circle at position { x: 10, y: 10 }
|
||||
* var circle = new Path.Circle(new Point(10, 10), 10);
|
||||
* circle.fillColor = 'black';
|
||||
* console.log(circle.bounds.width); // 20
|
||||
*
|
||||
* // Scale the path by 200% from its center point
|
||||
|
@ -949,6 +960,7 @@ var Item = this.Item = Base.extend({
|
|||
*
|
||||
* // Create a circle at position { x: 10, y: 10 }
|
||||
* var circle = new Path.Circle(new Point(10, 10), 10);
|
||||
* circle.fillColor = 'black';
|
||||
*
|
||||
* // Scale the path 200% from its bottom left corner
|
||||
* circle.scale(2, circle.bounds.bottomLeft);
|
||||
|
@ -1249,17 +1261,74 @@ var Item = this.Item = Base.extend({
|
|||
}, new function() {
|
||||
/**
|
||||
* {@grouptitle Remove On Event}
|
||||
*
|
||||
* Removes the item when the events specified in the passed object literal
|
||||
* occur.
|
||||
* The object literal can contain the following values:
|
||||
* Remove the item when the next {@link Tool#onMouseMove} event is
|
||||
* fired: {@code object.move = true}
|
||||
*
|
||||
* Remove the item when the next {@link Tool#onMouseDrag} event is
|
||||
* fired: {@code object.drag = true}
|
||||
*
|
||||
* Remove the item when the next {@link Tool#onMouseDown} event is
|
||||
* fired: {@code object.down = true}
|
||||
*
|
||||
* Remove the item when the next {@link Tool#onMouseUp} event is
|
||||
* fired: {@code object.up = true}
|
||||
*
|
||||
* @name Item#removeOn
|
||||
* @function
|
||||
* @param {Object} object
|
||||
*
|
||||
* @example
|
||||
* function onMouseDrag(event) {
|
||||
* // Create a circle shaped path at the mouse position,
|
||||
* // with a radius of 10:
|
||||
* var path = new Path.Circle(event.point, 10);
|
||||
* path.fillColor = 'black';
|
||||
*
|
||||
* // Remove the path on the next onMouseDrag or onMouseUp event:
|
||||
* path.removeOn({
|
||||
* drag: true,
|
||||
* up: true
|
||||
* });
|
||||
* }
|
||||
*/
|
||||
|
||||
/**
|
||||
* Removes the item when the next {@link Tool#onMouseMove} event is fired.
|
||||
*
|
||||
* @name Item#removeOnMove
|
||||
* @function
|
||||
*
|
||||
* @example
|
||||
* function onMouseMove(event) {
|
||||
* // Create a circle shaped path at the mouse position,
|
||||
* // with a radius of 10:
|
||||
* var path = new Path.Circle(event.point, 10);
|
||||
* path.fillColor = 'black';
|
||||
*
|
||||
* // On the next move event, automatically remove the path:
|
||||
* path.removeOnMove();
|
||||
* }
|
||||
*/
|
||||
|
||||
/**
|
||||
* Removes the item when the next {@link Tool#onMouseDown} event is fired.
|
||||
*
|
||||
*
|
||||
* @name Item#removeOnDown
|
||||
* @function
|
||||
*
|
||||
* @example
|
||||
* function onMouseDown(event) {
|
||||
* // Create a circle shaped path at the mouse position,
|
||||
* // with a radius of 10:
|
||||
* var path = new Path.Circle(event.point, 10);
|
||||
*
|
||||
* // Remove the path, next time the mouse is pressed:
|
||||
* path.removeOnDown();
|
||||
* }
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -1267,6 +1336,17 @@ var Item = this.Item = Base.extend({
|
|||
*
|
||||
* @name Item#removeOnDrag
|
||||
* @function
|
||||
*
|
||||
* @example
|
||||
* function onMouseDrag(event) {
|
||||
* // Create a circle shaped path at the mouse position,
|
||||
* // with a radius of 10:
|
||||
* var path = new Path.Circle(event.point, 10);
|
||||
* path.fillColor = 'black';
|
||||
*
|
||||
* // On the next drag event, automatically remove the path:
|
||||
* path.removeOnDrag();
|
||||
* }
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -1274,6 +1354,17 @@ var Item = this.Item = Base.extend({
|
|||
*
|
||||
* @name Item#removeOnUp
|
||||
* @function
|
||||
*
|
||||
* @example
|
||||
* function onMouseDown(event) {
|
||||
* // Create a circle shaped path at the mouse position,
|
||||
* // with a radius of 10:
|
||||
* var path = new Path.Circle(event.point, 10);
|
||||
* path.fillColor = 'black';
|
||||
*
|
||||
* // Remove the path, when the mouse is released:
|
||||
* path.removeOnUp();
|
||||
* }
|
||||
*/
|
||||
|
||||
var sets = {
|
||||
|
@ -1316,6 +1407,7 @@ var Item = this.Item = Base.extend({
|
|||
}
|
||||
}
|
||||
|
||||
// TODO: implement Item#removeOnFrame
|
||||
return Base.each(['down', 'drag', 'up', 'move'], function(name) {
|
||||
this['removeOn' + Base.capitalize(name)] = function() {
|
||||
var hash = {};
|
||||
|
|
|
@ -192,15 +192,16 @@ var PathStyle = this.PathStyle = Base.extend(new function() {
|
|||
*/
|
||||
|
||||
/**
|
||||
* The cap of the stroke.
|
||||
* The shape to be used at the end of open {@link Path} items, when they
|
||||
* have a stroke.
|
||||
*
|
||||
* @property
|
||||
* @name PathStyle#strokeCap
|
||||
* @name Item#strokeCap
|
||||
* @default 'butt'
|
||||
* @type String('round', 'square', 'butt')
|
||||
*
|
||||
* @example
|
||||
* // Setting an item's stroke color:
|
||||
* // Setting an item's stroke cap:
|
||||
*
|
||||
* // Create a line from { x: 0, y: 50 } to { x: 50, y: 50 };
|
||||
* var line = new Path.Line(new Point(0, 50), new Point(50, 50));
|
||||
|
@ -211,7 +212,7 @@ var PathStyle = this.PathStyle = Base.extend(new function() {
|
|||
*/
|
||||
|
||||
/**
|
||||
* The join of the stroke.
|
||||
* The shape to be used at the corners of paths when they have a stroke.
|
||||
*
|
||||
* @property
|
||||
* @name PathStyle#strokeJoin
|
||||
|
@ -248,10 +249,14 @@ var PathStyle = this.PathStyle = Base.extend(new function() {
|
|||
|
||||
/**
|
||||
* The miter limit of the stroke.
|
||||
* When two line segments meet at a sharp angle and miter joins have been
|
||||
* specified for {@link #strokeJoin}, it is possible for the miter to extend
|
||||
* far beyond the {@link #strokeWidth} of the path. The miterLimit imposes a
|
||||
* limit on the ratio of the miter length to the {@link #strokeWidth}.
|
||||
*
|
||||
* @property
|
||||
* @name PathStyle#miterLimit
|
||||
* @default 10
|
||||
* @name PathStyle#miterLimit
|
||||
* @type Number
|
||||
*/
|
||||
|
||||
|
|
|
@ -145,10 +145,10 @@ var Key = this.Key = new function() {
|
|||
*
|
||||
* @example
|
||||
* // Whenever the user clicks, create a circle shaped path. If the
|
||||
* // shift key is down, fill it with red, otherwise fill it with blue:
|
||||
* // 'a' key is pressed, fill it with red, otherwise fill it with blue:
|
||||
* function onMouseDown(event) {
|
||||
* var path = new Path.Circle(event.point, 10);
|
||||
* if(Key.isDown('shift')) {
|
||||
* if(Key.isDown('a')) {
|
||||
* path.fillColor = 'red';
|
||||
* } else {
|
||||
* path.fillColor = 'blue';
|
||||
|
|
|
@ -259,10 +259,10 @@ var View = this.View = Base.extend({
|
|||
* The function receives an event object which contains information about
|
||||
* the frame event:
|
||||
*
|
||||
* <b>event.count</b>: the number of times the frame event was fired.
|
||||
* <b>event.time</b>: the total amount of time passed since the first frame
|
||||
* <b>{@code event.count}</b>: the number of times the frame event was fired.
|
||||
* <b>{@code event.time}</b>: the total amount of time passed since the first frame
|
||||
* event in seconds.
|
||||
* <b>event.delta</b>: the time passed in seconds since the last frame
|
||||
* <b>{@code event.delta}</b>: the time passed in seconds since the last frame
|
||||
* event.
|
||||
*
|
||||
* @example
|
||||
|
|
Loading…
Reference in a new issue