Clean up PORT comments.

This commit is contained in:
Jürg Lehni 2011-05-29 19:20:10 +01:00
parent f9eca3efbf
commit 9d00541987
6 changed files with 18 additions and 38 deletions

View file

@ -57,7 +57,7 @@ var GradientColor = this.GradientColor = Color.extend({
}, },
setOrigin: function(origin) { setOrigin: function(origin) {
// PORT: add clone to Scriptographer // PORT: Add clone to Scriptographer
origin = Point.read(arguments).clone(); origin = Point.read(arguments).clone();
this._origin = origin; this._origin = origin;
if (this._destination) if (this._destination)
@ -76,7 +76,7 @@ var GradientColor = this.GradientColor = Color.extend({
}, },
setDestination: function(destination) { setDestination: function(destination) {
// PORT: add clone to Scriptographer // PORT: Add clone to Scriptographer
destination = Point.read(arguments).clone(); destination = Point.read(arguments).clone();
this._destination = destination; this._destination = destination;
this._radius = this._destination.getDistance(this._origin); this._radius = this._destination.getDistance(this._origin);
@ -94,7 +94,7 @@ var GradientColor = this.GradientColor = Color.extend({
}, },
setHilite: function(hilite) { setHilite: function(hilite) {
// PORT: add clone to Scriptographer // PORT: Add clone to Scriptographer
hilite = Point.read(arguments).clone(); hilite = Point.read(arguments).clone();
var vector = hilite.subtract(this._origin); var vector = hilite.subtract(this._origin);
if (vector.getLength() > this._radius) { if (vector.getLength() > this._radius) {

View file

@ -125,7 +125,8 @@ var PathStyle = this.PathStyle = Base.extend(new function() {
&& style.equals(childStyle))) { && style.equals(childStyle))) {
// If there is another item with a different style, // If there is another item with a different style,
// the style is not defined: // the style is not defined:
// PORT: Change this in Sg (currently returns null) // PORT: Change this in Scriptographer
// (currently returns null)
return undefined; return undefined;
} }
} }

View file

@ -241,7 +241,7 @@ var Curve = this.Curve = Base.extend({
&& this._segment2._handleIn.isZero(); && this._segment2._handleIn.isZero();
}, },
// PORT: Add support for start parameter to Sg // PORT: Add support for start parameter to Scriptographer
// DOCS: document Curve#getParameter(length, start) // DOCS: document Curve#getParameter(length, start)
/** /**
* @param {Number} length * @param {Number} length
@ -328,7 +328,7 @@ var Curve = this.Curve = Base.extend({
x, y; x, y;
// Handle special case at beginning / end of curve // Handle special case at beginning / end of curve
// PORT: Change in Sg too, so 0.000000000001 won't be // PORT: Change in Scriptographer too, so 0.000000000001 won't be
// required anymore // required anymore
if (t == 0 || t == 1) { if (t == 0 || t == 1) {
var point; var point;

View file

@ -275,7 +275,7 @@ var Path = this.Path = PathItem.extend({
this._project._selectItem(this, count == 1); this._project._selectItem(this, count == 1);
}, },
// PORT: Add support for adding multiple segments at once to Sg // PORT: Add support for adding multiple segments at once to Scriptographer
// DOCS: find a way to document the variable segment parameters of Path#add // DOCS: find a way to document the variable segment parameters of Path#add
/** /**
* Adds one or more segments to the end of the segment list of this path. * Adds one or more segments to the end of the segment list of this path.
@ -293,7 +293,7 @@ var Path = this.Path = PathItem.extend({
: this._add([ Segment.read(arguments) ])[0]; : this._add([ Segment.read(arguments) ])[0];
}, },
// PORT: Add support for adding multiple segments at once to Sg // PORT: Add support for adding multiple segments at once to Scriptographer
/** /**
* Inserts one or more segments at a given index in the list of this path's * Inserts one or more segments at a given index in the list of this path's
* segments. * segments.
@ -311,17 +311,17 @@ var Path = this.Path = PathItem.extend({
: this._add([ Segment.read(arguments, 1) ], index)[0]; : this._add([ Segment.read(arguments, 1) ], index)[0];
}, },
// PORT: Add to Sg // PORT: Add to Scriptographer
addSegment: function(segment) { addSegment: function(segment) {
return this._add([ Segment.read(arguments) ])[0]; return this._add([ Segment.read(arguments) ])[0];
}, },
// PORT: Add to Sg // PORT: Add to Scriptographer
insertSegment: function(index, segment) { insertSegment: function(index, segment) {
return this._add([ Segment.read(arguments, 1) ], index)[0]; return this._add([ Segment.read(arguments, 1) ], index)[0];
}, },
// PORT: Add to Sg // PORT: Add to Scriptographer
/** /**
* Adds an array of segments (or types that can be converted to segments) * Adds an array of segments (or types that can be converted to segments)
* to the end of the {@link #segments} array. * to the end of the {@link #segments} array.
@ -340,7 +340,7 @@ var Path = this.Path = PathItem.extend({
return this._add(Segment.readAll(segments)); return this._add(Segment.readAll(segments));
}, },
// PORT: Add to Sg // PORT: Add to Scriptographer
/** /**
* Inserts an array of segments at a given index in the path's * Inserts an array of segments at a given index in the path's
* {@link #segments} array. * {@link #segments} array.
@ -355,7 +355,7 @@ var Path = this.Path = PathItem.extend({
return this._add(Segment.readAll(segments), index); return this._add(Segment.readAll(segments), index);
}, },
// PORT: Add to Sg // PORT: Add to Scriptographer
/** /**
* Removes the segment at the specified index of the path's * Removes the segment at the specified index of the path's
* {@link #segments} array. * {@link #segments} array.
@ -368,7 +368,7 @@ var Path = this.Path = PathItem.extend({
return segments[0] || null; return segments[0] || null;
}, },
// PORT: Add to Sg // PORT: Add to Scriptographer
/** /**
* Removes the segments from the specified 'from' index to the specified * Removes the segments from the specified 'from' index to the specified
* 'to' index from the path's {@link #segments} array. * 'to' index from the path's {@link #segments} array.
@ -592,7 +592,7 @@ var Path = this.Path = PathItem.extend({
}, },
// TODO: getLocationAt(point, precision) // TODO: getLocationAt(point, precision)
// PORT: Rename functions and add new isParameter argument in Sg // PORT: Rename functions and add new isParameter argument in Scriptographer
// DOCS: document Path#getLocationAt // DOCS: document Path#getLocationAt
/** /**
* @param {Number} offset * @param {Number} offset

View file

@ -21,7 +21,7 @@ var Event = this.Event = Base.extend({
this.event = event; this.event = event;
}, },
// PORT: Add to Sg // PORT: Add to Scriptographer
preventDefault: function() { preventDefault: function() {
DomEvent.preventDefault(this.event); DomEvent.preventDefault(this.event);
}, },

View file

@ -14,10 +14,6 @@
* All rights reserved. * All rights reserved.
*/ */
/**
* @namespace
* @name Key
*/
var Key = this.Key = new function() { var Key = this.Key = new function() {
// TODO: make sure the keys are called the same as in Scriptographer // TODO: make sure the keys are called the same as in Scriptographer
// Missing: tab, cancel, clear, page-down, page-up, comma, minus, period, // Missing: tab, cancel, clear, page-down, page-up, comma, minus, period,
@ -76,7 +72,7 @@ var Key = this.Key = new function() {
// Call the onKeyDown or onKeyUp handler if present // Call the onKeyDown or onKeyUp handler if present
// When the handler function returns false, prevent the // When the handler function returns false, prevent the
// default behaviour of the key event: // default behaviour of the key event:
// PORT: Add to Sg // PORT: Add to Scriptographer
var keyEvent = new KeyEvent(down, key, character, event); var keyEvent = new KeyEvent(down, key, character, event);
if (tool[handler](keyEvent) === false) if (tool[handler](keyEvent) === false)
keyEvent.preventDefault(); keyEvent.preventDefault();
@ -131,25 +127,8 @@ var Key = this.Key = new function() {
}); });
return { return {
/** @lends Key */
modifiers: modifiers, modifiers: modifiers,
/**
* Checks whether the specified key is pressed.
*
* @example
* function onMouseDown(event) {
* if(Key.isDown('shift')) {
* console.log('The shift key is currently pressed.')
* }
* }
*
* @param {String} key One of: 'backspace', 'enter', 'shift', 'control',
* 'option', 'pause', 'caps-lock', 'escape', 'space', 'end', 'home',
* 'left', 'up', 'right', 'down', 'delete', 'command'
* @return {boolean} {@true if the key is pressed}
*/
isDown: function(key) { isDown: function(key) {
return !!keyMap[key]; return !!keyMap[key];
} }