Undo commit 4445376c0204cb5a2e408c64b77a5b6fa09305ba since it clashes with magnification.

This commit is contained in:
Jürg Lehni 2012-12-21 16:41:57 +01:00
parent 1509a934b0
commit 734cc1cc61
7 changed files with 29 additions and 30 deletions

7
lib/bootstrap.js vendored
View file

@ -147,11 +147,8 @@ var Base = new function() { // Bootstrap scope
// with optional arguments and as beans should not declare
// the parameters and use the arguments array internally
// instead.
if (beans && (bean = name.match(/^(get|is)(([A-Z])(.*))$/))
// Reg-exp to detect non-hidden parameters. We only
// produce beans if there are no parameters or only
// hidden ones:
&& !/^function\s*\(.*\b[^_,].*\)/.test(val))
if (beans && val.length === 0
&& (bean = name.match(/^(get|is)(([A-Z])(.*))$/)))
beans.push([ bean[3].toLowerCase() + bean[4], bean[2] ]);
}
// No need to look up getter if this is a function already.

View file

@ -504,9 +504,9 @@ var Point = this.Point = Base.extend(/** @lends Point# */{
* @bean
* @type Number
*/
getAngle: function(_point) {
getAngle: function(/* point */) {
// Hide parameters from Bootstrap so it injects bean too
return this.getAngleInRadians(_point) * 180 / Math.PI;
return this.getAngleInRadians(arguments[0]) * 180 / Math.PI;
},
setAngle: function(angle) {
@ -542,9 +542,9 @@ var Point = this.Point = Base.extend(/** @lends Point# */{
* @bean
* @type Number
*/
getAngleInRadians: function(_point) {
getAngleInRadians: function(/* point */) {
// Hide parameters from Bootstrap so it injects bean too
if (_point === undefined) {
if (arguments[0] === undefined) {
if (this._angle == null)
this._angle = Math.atan2(this.y, this.x);
return this._angle;
@ -559,8 +559,8 @@ var Point = this.Point = Base.extend(/** @lends Point# */{
}
},
getAngleInDegrees: function(_point) {
return this.getAngle(_point);
getAngleInDegrees: function(/* point */) {
return this.getAngle(arguments[0]);
},
/**

View file

@ -167,10 +167,10 @@ var Rectangle = this.Rectangle = Base.extend(/** @lends Rectangle# */{
* @type Point
* @bean
*/
getPoint: function(_dontLink) {
getPoint: function(/* dontLink */) {
// Pass on the optional argument _dontLink which tells LinkedPoint to
// produce a normal point instead. Used internally for speed reasons.
return LinkedPoint.create(this, 'setPoint', this.x, this.y, _dontLink);
return LinkedPoint.create(this, 'setPoint', this.x, this.y, arguments[0]);
},
setPoint: function(point) {
@ -187,9 +187,9 @@ var Rectangle = this.Rectangle = Base.extend(/** @lends Rectangle# */{
* @type Size
* @bean
*/
getSize: function(_dontLink) {
getSize: function(/* dontLink */) {
return LinkedSize.create(this, 'setSize', this.width, this.height,
_dontLink);
arguments[0]);
},
setSize: function(size) {
@ -307,9 +307,9 @@ var Rectangle = this.Rectangle = Base.extend(/** @lends Rectangle# */{
* @type Point
* @bean
*/
getCenter: function(_dontLink) {
getCenter: function(/* dontLink */) {
return LinkedPoint.create(this, 'setCenter',
this.getCenterX(), this.getCenterY(), _dontLink);
this.getCenterX(), this.getCenterY(), arguments[0]);
},
setCenter: function(point) {
@ -725,9 +725,9 @@ var Rectangle = this.Rectangle = Base.extend(/** @lends Rectangle# */{
setY = 'set' + y,
get = 'get' + part,
set = 'set' + part;
this[get] = function(_dontLink) {
this[get] = function(/* dontLink */) {
return LinkedPoint.create(this, set,
this[getX](), this[getY](), _dontLink);
this[getX](), this[getY](), arguments[0]);
};
this[set] = function(point) {
point = Point.read(arguments);

View file

@ -512,7 +512,7 @@ var Item = this.Item = Base.extend(Callback, /** @lends Item# */{
* // Move the circle 100 points to the right
* circle.position.x += 100;
*/
getPosition: function(_dontLink) {
getPosition: function(/* dontLink */) {
// Cache position value.
// Pass true for dontLink in getCenter(), so receive back a normal point
var pos = this._position
@ -521,7 +521,7 @@ var Item = this.Item = Base.extend(Callback, /** @lends Item# */{
// use them to calculate the difference in #setPosition, as when it is
// modified, it would hold new values already and only then cause the
// calling of #setPosition.
return _dontLink ? pos
return arguments[0] ? pos
: LinkedPoint.create(this, 'setPosition', pos.x, pos.y);
},
@ -565,13 +565,13 @@ var Item = this.Item = Base.extend(Callback, /** @lends Item# */{
// Produce getters for bounds properties. These handle caching, matrices
// and redirect the call to the private _getBounds, which can be
// overridden by subclasses, see below.
this[name] = function(_matrix) {
this[name] = function(/* matrix */) {
var getter = this._boundsGetter,
// Allow subclasses to override _boundsGetter if they use
// the same calculations for multiple type of bounds.
// The default is name:
bounds = this._getCachedBounds(typeof getter == 'string'
? getter : getter && getter[name] || name, _matrix);
? getter : getter && getter[name] || name, arguments[0]);
// If we're returning 'bounds', create a LinkedRectangle that uses
// the setBounds() setter to update the Item whenever the bounds are
// changed:

View file

@ -154,13 +154,13 @@ var Raster = this.Raster = PlacedItem.extend(/** @lends Raster# */{
* @type Context
* @bean
*/
getContext: function(_notifyChange) {
getContext: function(/* notifyChange */) {
if (!this._context)
this._context = this.getCanvas().getContext('2d');
// Support a hidden parameter that indicates if the context will be used
// to modify the Raster object. We can notify such changes ahead since
// they are only used afterwards for redrawing.
if (_notifyChange)
if (arguments[0])
this._changed(/*#=*/ Change.PIXELS);
return this._context;
},

View file

@ -235,11 +235,13 @@ var Curve = this.Curve = Base.extend(/** @lends Curve# */{
* @bean
*/
// Hide parameters from Bootstrap so it injects bean too
getLength: function(_from, _to) {
var fullLength = arguments.length == 0 || _from == 0 && _to == 1;
getLength: function(/* from, to */) {
var from = arguments[0],
to = arguments[1],
fullLength = arguments.length == 0 || from == 0 && to == 1;
if (fullLength && this._length != null)
return this._length;
var length = Curve.getLength(this.getValues(), _from, _to);
var length = Curve.getLength(this.getValues(), from, to);
if (fullLength)
this._length = length;
return length;

View file

@ -131,7 +131,7 @@ var Path = this.Path = PathItem.extend(/** @lends Path# */{
* @type Curve[]
* @bean
*/
getCurves: function(_includeFill) {
getCurves: function(/* includeFill */) {
var curves = this._curves,
segments = this._segments;
if (!curves) {
@ -148,7 +148,7 @@ var Path = this.Path = PathItem.extend(/** @lends Path# */{
// If we're asked to include the closing curve for fill, even if the
// path is not closed for stroke, create a new uncached array and add
// the closing curve. Used in Path#contains()
if (_includeFill && !this._closed && this._style._fillColor) {
if (arguments[0] && !this._closed && this._style._fillColor) {
curves = curves.concat([
Curve.create(this, segments[segments.length - 1], segments[0])
]);