diff --git a/src/item/Raster.js b/src/item/Raster.js index 96840cd3..fd87797e 100644 --- a/src/item/Raster.js +++ b/src/item/Raster.js @@ -616,7 +616,7 @@ var Raster = Item.extend(/** @lends Raster# */{ var that = this; return new HitResult('pixel', that, { offset: point.add(that._size.divide(2)).round(), - // Inject as Bootstrap accessor, so #toString renders well too + // Inject as Straps.js accessor, so #toString renders well too color: { get: function() { return that.getPixel(this.offset); diff --git a/src/paper.js b/src/paper.js index fe82b5d8..49b7d26d 100644 --- a/src/paper.js +++ b/src/paper.js @@ -33,7 +33,7 @@ // Allow the minification of the undefined variable by defining it as a local // parameter inside the paper scope. var paper = new function(undefined) { -// Inline Bootstrap core (the Base class) inside the paper scope first: +// Inline Straps.js core (the Base class) inside the paper scope first: /*#*/ include('../bower_components/straps/straps.js', { exports: false }); /*#*/ if (__options.stats) { diff --git a/src/path/Curve.js b/src/path/Curve.js index c3e61998..7791a3d1 100644 --- a/src/path/Curve.js +++ b/src/path/Curve.js @@ -267,7 +267,7 @@ var Curve = Base.extend(/** @lends Curve# */{ * @type Number * @bean */ - // Hide parameters from Bootstrap so it injects bean too + // Hide parameters from Straps.js so it injects bean too getLength: function(/* from, to */) { var from = arguments[0], to = arguments[1], diff --git a/src/style/Color.js b/src/style/Color.js index ed73d5fe..59a55ba1 100644 --- a/src/style/Color.js +++ b/src/style/Color.js @@ -132,8 +132,9 @@ var Color = Base.extend(new function() { }, 'hsb-rgb': function(h, s, b) { - var h = (h / 60) % 6, // Scale to 0..6 - i = Math.floor(h), // 0..5 + // Scale h to 0..6 with modulo for negative values too + h = (((h / 60) % 6) + 6) % 6; + var i = Math.floor(h), // 0..5 f = h - i, i = hsbIndices[i], v = [ @@ -164,7 +165,8 @@ var Color = Base.extend(new function() { }, 'hsl-rgb': function(h, s, l) { - h /= 360; + // Scale h to 0..1 with modulo for negative values too + h = (((h / 360) % 1) + 1) % 1; if (s === 0) return [l, l, l]; var t3s = [ h + 1 / 3, h, h - 1 / 3 ], @@ -647,24 +649,6 @@ var Color = Base.extend(new function() { this._owner._changed(/*#=*/ Change.STYLE); }, - /** - * Returns a copy of the components array with all values clamped to - * valid numbers, based on the type of property they represent. - */ - _clamp: function() { - var components = this._components.slice(), - properties = this._properties; - if (this._type !== 'gradient') { - for (var i = 0, l = properties.length; i < l; i++) { - var value = components[i]; - components[i] = properties[i] === 'hue' - ? ((value % 360) + 360) % 360 - : value < 0 ? 0 : value > 1 ? 1 : value; - } - } - return components; - }, - /** * @return {Number[]} the converted components as an array */ @@ -673,11 +657,11 @@ var Color = Base.extend(new function() { return this._type === type ? this._components.slice() : (converter = converters[this._type + '-' + type]) - ? converter.apply(this, this._clamp()) + ? converter.apply(this, this._components) // Convert to and from rgb if no direct converter exists : converters['rgb-' + type].apply(this, converters[this._type + '-rgb'].apply(this, - this._clamp())); + this._components)); }, /** @@ -834,7 +818,7 @@ var Color = Base.extend(new function() { convert(components[2]) ]; if (alpha < 1) - components.push(val < 0 ? 0 : val); + components.push(alpha < 0 ? 0 : alpha); return hex ? '#' + ((1 << 24) + (components[0] << 16) + (components[1] << 8)