Merge remote-tracking branch 'origin/master'

This commit is contained in:
Jürg Lehni 2011-03-09 18:17:50 +00:00
commit c7cefcba3a
7 changed files with 18 additions and 16 deletions

View file

@ -30,15 +30,18 @@
var mouseDown = false;
function onMouseDown(event) {
point = point + vector;
mouseDown = true;
gradientColor.hilite = event.point;
}
function onMouseDrag(event) {
gradientColor.hilite = event.point;
point = point + (event.point - point) / 10;
gradientColor.hilite = point;
iterate();
}
function onMouseUp(event) {
vector.length = 10;
mouseDown = false;
}
@ -46,6 +49,13 @@
var vector = new Point(150, 0);
setInterval(draw, 30);
function draw() {
if (!mouseDown) {
iterate();
document.redraw();
}
}
function iterate() {
for(var i = 0, l = gradient.stops.length; i < l; i++)
gradient.stops[i].color.hue -= 20;
if (grow && vector.length > 300) {
@ -55,10 +65,7 @@
}
vector.length += (grow ? 1 : -1);
vector.angle += 5;
if (!mouseDown) {
gradientColor.hilite = point + vector;
document.redraw();
}
gradientColor.hilite = mouseDown ? point : point + vector;
}
</script>
</head>

View file

@ -165,8 +165,7 @@ var Color = this.Color = Base.extend(new function() {
},
setAlpha: function(alpha) {
// this._alpha = Math.min(Math.max(alpha, 0), 1);
this._alpha = alpha < 0 ? 0 : alpha > 1 ? 1 : alpha;
this._alpha = Math.min(Math.max(alpha, 0), 1);
this._cssString = null;
},

View file

@ -30,8 +30,7 @@ var GrayColor = this.GrayColor = Color.extend({
setGray: function(value) {
this._cssString = null;
// this._gray = Math.min(Math.max(value, 0), 1);
this._gray = value < 0 ? 0 : value > 1 ? 1 : value;
this._gray = Math.min(Math.max(value, 0), 1);
return this;
}
});

View file

@ -27,8 +27,7 @@ var HSBColor = this.HSBColor = Color.extend(new function() {
if (!this['set' + name]) {
this['set' + name] = function(value) {
this._cssString = null;
// this[internalName] = Math.min(Math.max(value, 0), 1);
this[internalName] = value < 0 ? 0 : value > 1 ? 1 : value;
this[internalName] = Math.min(Math.max(value, 0), 1);
return this;
};
}

View file

@ -25,8 +25,7 @@ var RGBColor = this.RGBColor = Color.extend(new function() {
};
this['set' + name] = function(value) {
this._cssString = null;
// this[internalName] = Math.min(Math.max(value, 0), 1);
this[internalName] = value < 0 ? 0 : value > 1 ? 1 : value;
this[internalName] = Math.min(Math.max(value, 0), 1);
return this;
};
}

View file

@ -51,7 +51,6 @@ var PlacedSymbol = this.PlacedSymbol = Item.extend({
},
draw: function(ctx, param) {
// TODO: we need to preserve strokewidth
ctx.save();
this.matrix.applyToContext(ctx);
Item.draw(this.symbol.getDefinition(), ctx, param);

View file

@ -61,7 +61,7 @@ var Tool = this.Tool = ToolHandler.extend(new function() {
mouseup: function(event) {
if (dragging) {
curPoint = null;
if (this.eventInterval != null)
if (that.eventInterval != null)
clearInterval(this.timer);
that.onHandleEvent('mouse-up',
viewToArtwork(event, that._document), null, null);