Diffstat (limited to 'frontend/gamma/js/MochiKit/Visual.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/gamma/js/MochiKit/Visual.js | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/frontend/gamma/js/MochiKit/Visual.js b/frontend/gamma/js/MochiKit/Visual.js index 648d82a..372d99a 100644 --- a/frontend/gamma/js/MochiKit/Visual.js +++ b/frontend/gamma/js/MochiKit/Visual.js @@ -1,27 +1,27 @@ /*** MochiKit.Visual 1.5 See <http://mochikit.com/> for documentation, downloads, license, etc. (c) 2005 Bob Ippolito and others. All rights Reserved. ***/ -MochiKit.Base._module('Visual', '1.5', ['Base', 'DOM', 'Style', 'Color', 'Position']); +MochiKit.Base.module(MochiKit, 'Visual', '1.5', ['Base', 'DOM', 'Style', 'Color', 'Position']); MochiKit.Visual._RoundCorners = function (e, options) { e = MochiKit.DOM.getElement(e); this._setOptions(options); if (this.options.__unstable__wrapElement) { e = this._doWrap(e); } var color = this.options.color; var C = MochiKit.Color.Color; if (this.options.color === "fromElement") { color = C.fromBackground(e); } else if (!(color instanceof C)) { color = C.fromString(color); } this.isTransparent = (color.asRGB().a <= 0); @@ -456,32 +456,37 @@ MochiKit.Visual.Transitions.wobble = function (pos) { /** @id MochiKit.Visual.Transitions.pulse */ MochiKit.Visual.Transitions.pulse = function (pos, pulses) { if (pulses) { pos *= 2 * pulses; } else { pos *= 10; } var decimals = pos - Math.floor(pos); return (Math.floor(pos) % 2 == 0) ? decimals : 1 - decimals; }; /** @id MochiKit.Visual.Transitions.parabolic */ MochiKit.Visual.Transitions.parabolic = function (pos) { return pos * pos; }; +/** @id MochiKit.Visual.Transitions.spring */ +MochiKit.Visual.Transitions.spring = function (pos) { + return 1 - (Math.cos(pos * 2.5 * Math.PI) * Math.exp(-pos * 6)); +}; + /** @id MochiKit.Visual.Transitions.none */ MochiKit.Visual.Transitions.none = function (pos) { return 0; }; /** @id MochiKit.Visual.Transitions.full */ MochiKit.Visual.Transitions.full = function (pos) { return 1; }; /*** Core effects ***/ @@ -521,32 +526,37 @@ MochiKit.Base.update(MochiKit.Visual.ScopedQueue.prototype, { case 'end': var finish; // start effect after last queued effect has finished ma(function (e) { var i = e.finishOn; if (i >= (finish || i)) { finish = i; } }, this.effects); timestamp = finish || timestamp; break; case 'break': ma(function (e) { e.finalize(); }, this.effects); break; + case 'replace': + ma(function (e) { + e.cancel(); + }, this.effects); + break; } effect.startOn += timestamp; effect.finishOn += timestamp; if (!effect.options.queue.limit || this.effects.length < effect.options.queue.limit) { this.effects.push(effect); } if (!this.interval) { this.interval = this.startLoop(MochiKit.Base.bind(this.loop, this), 40); } }, /** @id MochiKit.Visual.ScopedQueue.prototype.startLoop */ @@ -649,34 +659,38 @@ MochiKit.Visual.Base.prototype = { if (frame > this.currentFrame) { this.render(pos); this.currentFrame = frame; } } }, /** @id MochiKit.Visual.Base.prototype.render */ render: function (pos) { if (this.state == 'idle') { this.state = 'running'; this.event('beforeSetup'); this.setup(); this.event('afterSetup'); } if (this.state == 'running') { - if (this.options.transition) { - pos = this.options.transition(pos); + var trans = this.options.transition; + if (typeof(trans) == "string") { + trans = MochiKit.Visual.Transitions[trans]; + } + if (typeof(trans) == "function") { + pos = trans(pos); } pos *= (this.options.to - this.options.from); pos += this.options.from; this.event('beforeUpdate'); this.update(pos); this.event('afterUpdate'); } }, /** @id MochiKit.Visual.Base.prototype.cancel */ cancel: function () { if (!this.options.sync) { MochiKit.Visual.Queues.get(typeof(this.options.queue) == 'string' ? 'global' : this.options.queue.scope).remove(this); } this.state = 'finished'; @@ -1673,34 +1687,34 @@ MochiKit.Visual.slideUp = function (element, /* optional */ options) { // Bug in opera makes the TD containing this element expand for a instance // after finish /** @id MochiKit.Visual.squish */ MochiKit.Visual.squish = function (element, /* optional */ options) { /*** Reduce an element and make it disappear. ***/ var d = MochiKit.DOM; var b = MochiKit.Base; var s = MochiKit.Style; var elementDimensions = s.getElementDimensions(element, true); var elemClip; options = b.update({ restoreAfterFinish: true, - scaleMode: {originalHeight: elementDimensions.w, - originalWidth: elementDimensions.h}, + scaleMode: {originalHeight: elementDimensions.h, + originalWidth: elementDimensions.w}, beforeSetupInternal: function (effect) { elemClip = s.makeClipping(effect.element); }, afterFinishInternal: function (effect) { s.hideElement(effect.element); s.undoClipping(effect.element, elemClip); } }, options); return new MochiKit.Visual.Scale(element, /Opera/.test(navigator.userAgent) ? 1 : 0, options); }; /** @id MochiKit.Visual.grow */ MochiKit.Visual.grow = function (element, /* optional */ options) { /*** @@ -1945,31 +1959,18 @@ MochiKit.Visual.fold = function (element, /* optional */ options) { scaleContent: false, scaleY: false, scaleMode: {originalHeight: elementDimensions.h, originalWidth: elementDimensions.w}, afterFinishInternal: function (effect) { s.hideElement(effect.element); s.undoClipping(effect.element, elemClip); s.setStyle(effect.element, oldStyle); } }); } }, options); return new v.Scale(element, 5, options); }; -/* end of Rico adaptation */ - -MochiKit.Visual.__new__ = function () { - var m = MochiKit.Base; - - // Backwards compatibility aliases - m._deprecated(this, 'Color', 'MochiKit.Color.Color', '1.1'); - m._deprecated(this, 'getElementsComputedStyle', 'MochiKit.Style.getStyle', '1.1'); - - m.nameFunctions(this); -}; - -MochiKit.Visual.__new__(); - +MochiKit.Base.nameFunctions(MochiKit.Visual); MochiKit.Base._exportSymbols(this, MochiKit.Visual); |