mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-05 20:32:00 -05:00
Convert "Note: " comments to "NOTE: " and do some cleanup.
This commit is contained in:
parent
7152942719
commit
b9c76f44e8
12 changed files with 21 additions and 24 deletions
|
@ -948,7 +948,6 @@ var Point = Base.extend(/** @lends Point# */{
|
||||||
* @class An internal version of Point that notifies its owner of each change
|
* @class An internal version of Point that notifies its owner of each change
|
||||||
* through setting itself again on the setter that corresponds to the getter
|
* through setting itself again on the setter that corresponds to the getter
|
||||||
* that produced this LinkedPoint.
|
* that produced this LinkedPoint.
|
||||||
* Note: This prototype is not exported.
|
|
||||||
*
|
*
|
||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -836,7 +836,6 @@ var Rectangle = Base.extend(/** @lends Rectangle# */{
|
||||||
* @class An internal version of Rectangle that notifies its owner of each
|
* @class An internal version of Rectangle that notifies its owner of each
|
||||||
* change through setting itself again on the setter that corresponds to the
|
* change through setting itself again on the setter that corresponds to the
|
||||||
* getter that produced this LinkedRectangle.
|
* getter that produced this LinkedRectangle.
|
||||||
* Note: This prototype is not exported.
|
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -524,7 +524,6 @@ var Size = Base.extend(/** @lends Size# */{
|
||||||
* @class An internal version of Size that notifies its owner of each change
|
* @class An internal version of Size that notifies its owner of each change
|
||||||
* through setting itself again on the setter that corresponds to the getter
|
* through setting itself again on the setter that corresponds to the getter
|
||||||
* that produced this LinkedSize.
|
* that produced this LinkedSize.
|
||||||
* Note: This prototype is not exported.
|
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -475,7 +475,7 @@ Base.inject(/** @lends Base# */{
|
||||||
return Base.deserialize(
|
return Base.deserialize(
|
||||||
typeof json === 'string' ? JSON.parse(json) : json,
|
typeof json === 'string' ? JSON.parse(json) : json,
|
||||||
// Provide our own create function to handle target and
|
// Provide our own create function to handle target and
|
||||||
// insertion
|
// insertion.
|
||||||
function(type, args) {
|
function(type, args) {
|
||||||
// If a target is provided and its of the right type,
|
// If a target is provided and its of the right type,
|
||||||
// import right into it.
|
// import right into it.
|
||||||
|
@ -483,8 +483,8 @@ Base.inject(/** @lends Base# */{
|
||||||
? target
|
? target
|
||||||
: Base.create(type.prototype),
|
: Base.create(type.prototype),
|
||||||
isTarget = obj === target;
|
isTarget = obj === target;
|
||||||
// Note: We don't set insert false for layers since
|
// NOTE: We don't set insert false for layers since we
|
||||||
// we want these to be created on the fly in the active
|
// want these to be created on the fly in the active
|
||||||
// project into which we're importing (except for if
|
// project into which we're importing (except for if
|
||||||
// it's a preexisting target layer).
|
// it's a preexisting target layer).
|
||||||
if (args.length === 1 && obj instanceof Item
|
if (args.length === 1 && obj instanceof Item
|
||||||
|
@ -494,7 +494,7 @@ Base.inject(/** @lends Base# */{
|
||||||
arg.insert = false;
|
arg.insert = false;
|
||||||
}
|
}
|
||||||
type.apply(obj, args);
|
type.apply(obj, args);
|
||||||
// Clear target to only use it once
|
// Clear target to only use it once.
|
||||||
if (isTarget)
|
if (isTarget)
|
||||||
target = null;
|
target = null;
|
||||||
return obj;
|
return obj;
|
||||||
|
|
|
@ -310,7 +310,7 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
||||||
},
|
},
|
||||||
|
|
||||||
setName: function(name) {
|
setName: function(name) {
|
||||||
// Note: Don't check if the name has changed and bail out if it has not,
|
// NOTE: Don't check if the name has changed and bail out if it has not,
|
||||||
// because setName is used internally also to update internal structures
|
// because setName is used internally also to update internal structures
|
||||||
// when an item is moved from one parent to another.
|
// when an item is moved from one parent to another.
|
||||||
|
|
||||||
|
@ -422,7 +422,7 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
||||||
// See #getPosition() below.
|
// See #getPosition() below.
|
||||||
beans: true,
|
beans: true,
|
||||||
|
|
||||||
// Note: These properties have their getter / setters produced in the
|
// NOTE: These properties have their getter / setters produced in the
|
||||||
// injection scope above.
|
// injection scope above.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -832,7 +832,7 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
||||||
* bounding types.
|
* bounding types.
|
||||||
*/
|
*/
|
||||||
_getBounds: function(getter, matrix, cacheItem) {
|
_getBounds: function(getter, matrix, cacheItem) {
|
||||||
// Note: We cannot cache these results here, since we do not get
|
// NOTE: We cannot cache these results here, since we do not get
|
||||||
// _changed() notifications here for changing geometry in children.
|
// _changed() notifications here for changing geometry in children.
|
||||||
// But cacheName is used in sub-classes such as PlacedSymbol and Raster.
|
// But cacheName is used in sub-classes such as PlacedSymbol and Raster.
|
||||||
var children = this._children;
|
var children = this._children;
|
||||||
|
@ -897,7 +897,7 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
||||||
// Do not transform by the internal matrix if there is a internalGetter.
|
// Do not transform by the internal matrix if there is a internalGetter.
|
||||||
var _matrix = internalGetter ? null : this._matrix.orNullIfIdentity(),
|
var _matrix = internalGetter ? null : this._matrix.orNullIfIdentity(),
|
||||||
cache = (!matrix || matrix.equals(_matrix)) && getter;
|
cache = (!matrix || matrix.equals(_matrix)) && getter;
|
||||||
// Note: This needs to happen before returning cached values, since even
|
// NOTE: This needs to happen before returning cached values, since even
|
||||||
// then, _boundsCache needs to be kept up-to-date.
|
// then, _boundsCache needs to be kept up-to-date.
|
||||||
Item._updateBoundsCache(this._parent || this._parentSymbol, cacheItem);
|
Item._updateBoundsCache(this._parent || this._parentSymbol, cacheItem);
|
||||||
if (cache && this._bounds && this._bounds[cache])
|
if (cache && this._bounds && this._bounds[cache])
|
||||||
|
@ -1382,7 +1382,7 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
||||||
},
|
},
|
||||||
|
|
||||||
equals: function(item) {
|
equals: function(item) {
|
||||||
// Note: We do not compare name and selected state.
|
// NOTE: We do not compare name and selected state.
|
||||||
// TODO: Consider not comparing locked and visible also?
|
// TODO: Consider not comparing locked and visible also?
|
||||||
return item === this || item && this._class === item._class
|
return item === this || item && this._class === item._class
|
||||||
&& this._style.equals(item._style)
|
&& this._style.equals(item._style)
|
||||||
|
|
|
@ -329,7 +329,7 @@ new function() { // Injection scope for PostScript-like drawing functions
|
||||||
}
|
}
|
||||||
|
|
||||||
var fields = {
|
var fields = {
|
||||||
// Note: Documentation for these methods is found in PathItem, as they
|
// NOTE: Documentation for these methods is found in PathItem, as they
|
||||||
// are considered abstract methods of PathItem and need to be defined in
|
// are considered abstract methods of PathItem and need to be defined in
|
||||||
// all implementing classes.
|
// all implementing classes.
|
||||||
moveTo: function(/* point */) {
|
moveTo: function(/* point */) {
|
||||||
|
|
|
@ -76,7 +76,7 @@ var Curve = Base.extend(/** @lends Curve# */{
|
||||||
seg2 = new Segment();
|
seg2 = new Segment();
|
||||||
} else if (count === 1) {
|
} else if (count === 1) {
|
||||||
// new Segment(segment);
|
// new Segment(segment);
|
||||||
// Note: This copies from existing segments through bean getters
|
// NOTE: This copies from existing segments through bean getters
|
||||||
if ('segment1' in arg0) {
|
if ('segment1' in arg0) {
|
||||||
seg1 = new Segment(arg0.segment1);
|
seg1 = new Segment(arg0.segment1);
|
||||||
seg2 = new Segment(arg0.segment2);
|
seg2 = new Segment(arg0.segment2);
|
||||||
|
@ -766,7 +766,7 @@ statics: {
|
||||||
* Private helper for both Curve.getBounds() and Path.getBounds(), which
|
* Private helper for both Curve.getBounds() and Path.getBounds(), which
|
||||||
* finds the 0-crossings of the derivative of a bezier curve polynomial, to
|
* finds the 0-crossings of the derivative of a bezier curve polynomial, to
|
||||||
* determine potential extremas when finding the bounds of a curve.
|
* determine potential extremas when finding the bounds of a curve.
|
||||||
* Note: padding is only used for Path.getBounds().
|
* NOTE: padding is only used for Path.getBounds().
|
||||||
*/
|
*/
|
||||||
_addBounds: function(v0, v1, v2, v3, coord, padding, min, max, roots) {
|
_addBounds: function(v0, v1, v2, v3, coord, padding, min, max, roots) {
|
||||||
// Code ported and further optimised from:
|
// Code ported and further optimised from:
|
||||||
|
@ -809,7 +809,7 @@ statics: {
|
||||||
}
|
}
|
||||||
}}, Base.each(
|
}}, Base.each(
|
||||||
['getBounds', 'getStrokeBounds', 'getHandleBounds', 'getRoughBounds'],
|
['getBounds', 'getStrokeBounds', 'getHandleBounds', 'getRoughBounds'],
|
||||||
// Note: Although Curve.getBounds() exists, we are using Path.getBounds() to
|
// NOTE: Although Curve.getBounds() exists, we are using Path.getBounds() to
|
||||||
// determine the bounds of Curve objects with defined segment1 and segment2
|
// determine the bounds of Curve objects with defined segment1 and segment2
|
||||||
// values Curve.getBounds() can be used directly on curve arrays, without
|
// values Curve.getBounds() can be used directly on curve arrays, without
|
||||||
// the need to create a Curve object first, as required by the code that
|
// the need to create a Curve object first, as required by the code that
|
||||||
|
@ -1158,7 +1158,7 @@ new function() { // // Scope to inject various curve evaluation methods
|
||||||
var methods = ['getPoint', 'getTangent', 'getNormal', 'getWeightedTangent',
|
var methods = ['getPoint', 'getTangent', 'getNormal', 'getWeightedTangent',
|
||||||
'getWeightedNormal', 'getCurvature'];
|
'getWeightedNormal', 'getCurvature'];
|
||||||
return Base.each(methods,
|
return Base.each(methods,
|
||||||
// Note: Although Curve.getBounds() exists, we are using Path.getBounds() to
|
// NOTE: Although Curve.getBounds() exists, we are using Path.getBounds() to
|
||||||
// determine the bounds of Curve objects with defined segment1 and segment2
|
// determine the bounds of Curve objects with defined segment1 and segment2
|
||||||
// values Curve.getBounds() can be used directly on curve arrays, without
|
// values Curve.getBounds() can be used directly on curve arrays, without
|
||||||
// the need to create a Curve object first, as required by the code that
|
// the need to create a Curve object first, as required by the code that
|
||||||
|
|
|
@ -317,7 +317,7 @@ var CurveLocation = Base.extend(/** @lends CurveLocation# */{
|
||||||
var res = this === loc,
|
var res = this === loc,
|
||||||
epsilon = /*#=*/Numerical.GEOMETRIC_EPSILON;
|
epsilon = /*#=*/Numerical.GEOMETRIC_EPSILON;
|
||||||
// NOTE: We need to compare both by (index + parameter) and by proximity
|
// NOTE: We need to compare both by (index + parameter) and by proximity
|
||||||
// of points. See: #784#issuecomment-143161586
|
// of points. See #784#issuecomment-143161586
|
||||||
if (!res && loc instanceof CurveLocation
|
if (!res && loc instanceof CurveLocation
|
||||||
&& this.getPath() === loc.getPath()
|
&& this.getPath() === loc.getPath()
|
||||||
&& this.getPoint().isClose(loc.getPoint(), epsilon)) {
|
&& this.getPoint().isClose(loc.getPoint(), epsilon)) {
|
||||||
|
|
|
@ -2290,7 +2290,7 @@ new function() { // Path Smoothing
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
// Note: Documentation for smooth() is in PathItem
|
// NOTE: Documentation for smooth() is in PathItem
|
||||||
smooth: function() {
|
smooth: function() {
|
||||||
// This code is based on the work by Oleg V. Polikarpotchkin,
|
// This code is based on the work by Oleg V. Polikarpotchkin,
|
||||||
// http://ov-p.spaces.live.com/blog/cns!39D56F0C7A08D703!147.entry
|
// http://ov-p.spaces.live.com/blog/cns!39D56F0C7A08D703!147.entry
|
||||||
|
@ -2401,7 +2401,7 @@ new function() { // PostScript-style drawing commands
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
// Note: Documentation for these methods is found in PathItem, as they
|
// NOTE: Documentation for these methods is found in PathItem, as they
|
||||||
// are considered abstract methods of PathItem and need to be defined in
|
// are considered abstract methods of PathItem and need to be defined in
|
||||||
// all implementing classes.
|
// all implementing classes.
|
||||||
moveTo: function(/* point */) {
|
moveTo: function(/* point */) {
|
||||||
|
|
|
@ -118,7 +118,7 @@ var Segment = Base.extend(/** @lends Segment# */{
|
||||||
if (count === 0) {
|
if (count === 0) {
|
||||||
// Nothing
|
// Nothing
|
||||||
} else if (count === 1) {
|
} else if (count === 1) {
|
||||||
// Note: This copies from existing segments through accessors.
|
// NOTE: This copies from existing segments through accessors.
|
||||||
if ('point' in arg0) {
|
if ('point' in arg0) {
|
||||||
point = arg0.point;
|
point = arg0.point;
|
||||||
handleIn = arg0.handleIn;
|
handleIn = arg0.handleIn;
|
||||||
|
@ -415,7 +415,8 @@ var Segment = Base.extend(/** @lends Segment# */{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverses the {@link #handleIn} and {@link #handleOut} vectors of this
|
* Reverses the {@link #handleIn} and {@link #handleOut} vectors of this
|
||||||
* segment. Note: the actual segment is modified, no copy is created.
|
* segment, modifying the actual segment without creating a copy.
|
||||||
|
*
|
||||||
* @return {Segment} the reversed segment
|
* @return {Segment} the reversed segment
|
||||||
*/
|
*/
|
||||||
reverse: function() {
|
reverse: function() {
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
/**
|
/**
|
||||||
* @name SegmentPoint
|
* @name SegmentPoint
|
||||||
* @class An internal version of Point that notifies its segment of each change
|
* @class An internal version of Point that notifies its segment of each change
|
||||||
* Note: This prototype is not exported.
|
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -165,7 +165,7 @@ var Style = Base.extend(new function() {
|
||||||
value._owner = owner;
|
value._owner = owner;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Note: We do not convert the values to Colors in the
|
// NOTE: We do not convert the values to Colors in the
|
||||||
// setter. This only happens once the getter is called.
|
// setter. This only happens once the getter is called.
|
||||||
this._values[key] = value;
|
this._values[key] = value;
|
||||||
// Notify the owner of the style change STYLE is always set,
|
// Notify the owner of the style change STYLE is always set,
|
||||||
|
|
Loading…
Reference in a new issue