mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-03 19:45:44 -05:00
Fix a row of documentation issues.
This commit is contained in:
parent
71ed477bc4
commit
4e1db6a1d1
6 changed files with 25 additions and 15 deletions
|
@ -33,6 +33,5 @@ cd ..
|
||||||
if [ $MODE = "docs" ]
|
if [ $MODE = "docs" ]
|
||||||
then
|
then
|
||||||
# Build paper.js library for documentation
|
# Build paper.js library for documentation
|
||||||
./preprocess.sh stripped ../src/paper.js ../dist/docs/resources/js/paper.js\
|
./preprocess.sh stripped ../src/paper.js '{ "browser": true }' ../src/constants.js ../dist/docs/resources/js/paper.js
|
||||||
'{ "browser": true }'
|
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -14,6 +14,10 @@
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name Callback
|
||||||
|
* @namespace
|
||||||
|
*/
|
||||||
var Callback = {
|
var Callback = {
|
||||||
attach: function(type, func) {
|
attach: function(type, func) {
|
||||||
// If an object literal is passed, attach all callbacks defined in it
|
// If an object literal is passed, attach all callbacks defined in it
|
||||||
|
|
|
@ -362,8 +362,10 @@ new function() {
|
||||||
return setAttributes(svg, attrs);
|
return setAttributes(svg, attrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
Item.inject(/** @Lends Item# */{
|
Item.inject(/** @lends Item# */{
|
||||||
/**
|
/**
|
||||||
|
* {@grouptitle SVG Conversion}
|
||||||
|
*
|
||||||
* Exports the item and all its child items as an SVG DOM, all contained
|
* Exports the item and all its child items as an SVG DOM, all contained
|
||||||
* in one top level SVG group node.
|
* in one top level SVG group node.
|
||||||
*
|
*
|
||||||
|
@ -376,8 +378,10 @@ new function() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Project.inject(/** @Lends Project# */{
|
Project.inject(/** @lends Project# */{
|
||||||
/**
|
/**
|
||||||
|
* {@grouptitle SVG Conversion}
|
||||||
|
*
|
||||||
* Exports the project and all its layers and child items as an SVG DOM,
|
* Exports the project and all its layers and child items as an SVG DOM,
|
||||||
* all contained in one top level SVG group node.
|
* all contained in one top level SVG group node.
|
||||||
*
|
*
|
||||||
|
|
|
@ -421,7 +421,7 @@ new function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Item.inject(/** @Lends Item# */{
|
Item.inject(/** @lends Item# */{
|
||||||
/**
|
/**
|
||||||
* Converts the passed svg node into a Paper.js item and adds it to the
|
* Converts the passed svg node into a Paper.js item and adds it to the
|
||||||
* children of this item.
|
* children of this item.
|
||||||
|
@ -434,7 +434,7 @@ new function() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Project.inject(/** @Lends Project# */{
|
Project.inject(/** @lends Project# */{
|
||||||
/**
|
/**
|
||||||
* Converts the passed svg node into a Paper.js item and adds it to the
|
* Converts the passed svg node into a Paper.js item and adds it to the
|
||||||
* active layer of this project.
|
* active layer of this project.
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name CanvasView
|
* @name CanvasView
|
||||||
*
|
* @class
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
var CanvasView = View.extend(/** @lends CanvasView# */{
|
var CanvasView = View.extend(/** @lends CanvasView# */{
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
* @class The ProxyContext is a helper class that helps Canvas debugging
|
* @class The ProxyContext is a helper class that helps Canvas debugging
|
||||||
* by logging all interactions with a 2D Canvas context.
|
* by logging all interactions with a 2D Canvas context.
|
||||||
*
|
*
|
||||||
|
* @private
|
||||||
|
*
|
||||||
* @classexample
|
* @classexample
|
||||||
* view._context = new ProxyContext(view._context);
|
* view._context = new ProxyContext(view._context);
|
||||||
*/
|
*/
|
||||||
|
@ -46,11 +48,12 @@ var ProxyContext = new function() {
|
||||||
'createImageData(imagedata)', 'getImageData(sx,sy,sw,sh)',
|
'createImageData(imagedata)', 'getImageData(sx,sy,sw,sh)',
|
||||||
'putImageData(imagedata,dx,dy,dirtyX,dirtyY,dirtyWidth,dirtyHeight)'
|
'putImageData(imagedata,dx,dy,dirtyX,dirtyY,dirtyWidth,dirtyHeight)'
|
||||||
];
|
];
|
||||||
var param = {
|
var fields = /** @lends ProxyContext# */ {
|
||||||
initialize: function(context) {
|
initialize: function(context) {
|
||||||
this._ctx = context;
|
this._ctx = context;
|
||||||
this._indents = 0;
|
this._indents = 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
getIndentation: function() {
|
getIndentation: function() {
|
||||||
var str = '';
|
var str = '';
|
||||||
for (var i = 0; i < this._indents; i++) {
|
for (var i = 0; i < this._indents; i++) {
|
||||||
|
@ -60,11 +63,11 @@ var ProxyContext = new function() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Base.each(descriptions, function(description) {
|
Base.each(descriptions, function(description) {
|
||||||
var matches = description.match(/^([^(]+)(\()*/),
|
var match = description.match(/^([^(]+)(\()*/),
|
||||||
name = matches[1],
|
name = match[1],
|
||||||
isFunction = !!matches[2];
|
isFunction = !!match[2];
|
||||||
if (isFunction) {
|
if (isFunction) {
|
||||||
param[name] = function() {
|
fields[name] = function() {
|
||||||
if (name == 'restore') {
|
if (name == 'restore') {
|
||||||
this._indents--;
|
this._indents--;
|
||||||
}
|
}
|
||||||
|
@ -78,16 +81,16 @@ var ProxyContext = new function() {
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
var capitalized = Base.capitalize(name);
|
var capitalized = Base.capitalize(name);
|
||||||
param['set' + capitalized] = function(value) {
|
fields['set' + capitalized] = function(value) {
|
||||||
var logValue = value && value.substring ? '\'' + value + '\'' : value,
|
var logValue = value && value.substring ? '\'' + value + '\'' : value,
|
||||||
string = 'ctx.' + name + ' = ' + logValue + ';';
|
string = 'ctx.' + name + ' = ' + logValue + ';';
|
||||||
console.log(this.getIndentation() + string);
|
console.log(this.getIndentation() + string);
|
||||||
return this._ctx[name] = value;
|
return this._ctx[name] = value;
|
||||||
};
|
};
|
||||||
param['get' + capitalized] = function() {
|
fields['get' + capitalized] = function() {
|
||||||
return this._ctx[name];
|
return this._ctx[name];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return Base.extend(param);
|
return Base.extend(fields);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue