Diffstat (limited to 'frontend/gamma/js/MochiKit/Visual.js') (more/less context) (show 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 | |||
@@ -3,17 +3,17 @@ | |||
3 | MochiKit.Visual 1.5 | 3 | MochiKit.Visual 1.5 |
4 | 4 | ||
5 | See <http://mochikit.com/> for documentation, downloads, license, etc. | 5 | See <http://mochikit.com/> for documentation, downloads, license, etc. |
6 | 6 | ||
7 | (c) 2005 Bob Ippolito and others. All rights Reserved. | 7 | (c) 2005 Bob Ippolito and others. All rights Reserved. |
8 | 8 | ||
9 | ***/ | 9 | ***/ |
10 | 10 | ||
11 | MochiKit.Base._module('Visual', '1.5', ['Base', 'DOM', 'Style', 'Color', 'Position']); | 11 | MochiKit.Base.module(MochiKit, 'Visual', '1.5', ['Base', 'DOM', 'Style', 'Color', 'Position']); |
12 | 12 | ||
13 | MochiKit.Visual._RoundCorners = function (e, options) { | 13 | MochiKit.Visual._RoundCorners = function (e, options) { |
14 | e = MochiKit.DOM.getElement(e); | 14 | e = MochiKit.DOM.getElement(e); |
15 | this._setOptions(options); | 15 | this._setOptions(options); |
16 | if (this.options.__unstable__wrapElement) { | 16 | if (this.options.__unstable__wrapElement) { |
17 | e = this._doWrap(e); | 17 | e = this._doWrap(e); |
18 | } | 18 | } |
19 | 19 | ||
@@ -464,16 +464,21 @@ MochiKit.Visual.Transitions.pulse = function (pos, pulses) { | |||
464 | return (Math.floor(pos) % 2 == 0) ? decimals : 1 - decimals; | 464 | return (Math.floor(pos) % 2 == 0) ? decimals : 1 - decimals; |
465 | }; | 465 | }; |
466 | 466 | ||
467 | /** @id MochiKit.Visual.Transitions.parabolic */ | 467 | /** @id MochiKit.Visual.Transitions.parabolic */ |
468 | MochiKit.Visual.Transitions.parabolic = function (pos) { | 468 | MochiKit.Visual.Transitions.parabolic = function (pos) { |
469 | return pos * pos; | 469 | return pos * pos; |
470 | }; | 470 | }; |
471 | 471 | ||
472 | /** @id MochiKit.Visual.Transitions.spring */ | ||
473 | MochiKit.Visual.Transitions.spring = function (pos) { | ||
474 | return 1 - (Math.cos(pos * 2.5 * Math.PI) * Math.exp(-pos * 6)); | ||
475 | }; | ||
476 | |||
472 | /** @id MochiKit.Visual.Transitions.none */ | 477 | /** @id MochiKit.Visual.Transitions.none */ |
473 | MochiKit.Visual.Transitions.none = function (pos) { | 478 | MochiKit.Visual.Transitions.none = function (pos) { |
474 | return 0; | 479 | return 0; |
475 | }; | 480 | }; |
476 | 481 | ||
477 | /** @id MochiKit.Visual.Transitions.full */ | 482 | /** @id MochiKit.Visual.Transitions.full */ |
478 | MochiKit.Visual.Transitions.full = function (pos) { | 483 | MochiKit.Visual.Transitions.full = function (pos) { |
479 | return 1; | 484 | return 1; |
@@ -529,16 +534,21 @@ MochiKit.Base.update(MochiKit.Visual.ScopedQueue.prototype, { | |||
529 | }, this.effects); | 534 | }, this.effects); |
530 | timestamp = finish || timestamp; | 535 | timestamp = finish || timestamp; |
531 | break; | 536 | break; |
532 | case 'break': | 537 | case 'break': |
533 | ma(function (e) { | 538 | ma(function (e) { |
534 | e.finalize(); | 539 | e.finalize(); |
535 | }, this.effects); | 540 | }, this.effects); |
536 | break; | 541 | break; |
542 | case 'replace': | ||
543 | ma(function (e) { | ||
544 | e.cancel(); | ||
545 | }, this.effects); | ||
546 | break; | ||
537 | } | 547 | } |
538 | 548 | ||
539 | effect.startOn += timestamp; | 549 | effect.startOn += timestamp; |
540 | effect.finishOn += timestamp; | 550 | effect.finishOn += timestamp; |
541 | if (!effect.options.queue.limit || | 551 | if (!effect.options.queue.limit || |
542 | this.effects.length < effect.options.queue.limit) { | 552 | this.effects.length < effect.options.queue.limit) { |
543 | this.effects.push(effect); | 553 | this.effects.push(effect); |
544 | } | 554 | } |
@@ -657,18 +667,22 @@ MochiKit.Visual.Base.prototype = { | |||
657 | render: function (pos) { | 667 | render: function (pos) { |
658 | if (this.state == 'idle') { | 668 | if (this.state == 'idle') { |
659 | this.state = 'running'; | 669 | this.state = 'running'; |
660 | this.event('beforeSetup'); | 670 | this.event('beforeSetup'); |
661 | this.setup(); | 671 | this.setup(); |
662 | this.event('afterSetup'); | 672 | this.event('afterSetup'); |
663 | } | 673 | } |
664 | if (this.state == 'running') { | 674 | if (this.state == 'running') { |
665 | if (this.options.transition) { | 675 | var trans = this.options.transition; |
666 | pos = this.options.transition(pos); | 676 | if (typeof(trans) == "string") { |
677 | trans = MochiKit.Visual.Transitions[trans]; | ||
678 | } | ||
679 | if (typeof(trans) == "function") { | ||
680 | pos = trans(pos); | ||
667 | } | 681 | } |
668 | pos *= (this.options.to - this.options.from); | 682 | pos *= (this.options.to - this.options.from); |
669 | pos += this.options.from; | 683 | pos += this.options.from; |
670 | this.event('beforeUpdate'); | 684 | this.event('beforeUpdate'); |
671 | this.update(pos); | 685 | this.update(pos); |
672 | this.event('afterUpdate'); | 686 | this.event('afterUpdate'); |
673 | } | 687 | } |
674 | }, | 688 | }, |
@@ -1681,18 +1695,18 @@ MochiKit.Visual.squish = function (element, /* optional */ options) { | |||
1681 | ***/ | 1695 | ***/ |
1682 | var d = MochiKit.DOM; | 1696 | var d = MochiKit.DOM; |
1683 | var b = MochiKit.Base; | 1697 | var b = MochiKit.Base; |
1684 | var s = MochiKit.Style; | 1698 | var s = MochiKit.Style; |
1685 | var elementDimensions = s.getElementDimensions(element, true); | 1699 | var elementDimensions = s.getElementDimensions(element, true); |
1686 | var elemClip; | 1700 | var elemClip; |
1687 | options = b.update({ | 1701 | options = b.update({ |
1688 | restoreAfterFinish: true, | 1702 | restoreAfterFinish: true, |
1689 | scaleMode: {originalHeight: elementDimensions.w, | 1703 | scaleMode: {originalHeight: elementDimensions.h, |
1690 | originalWidth: elementDimensions.h}, | 1704 | originalWidth: elementDimensions.w}, |
1691 | beforeSetupInternal: function (effect) { | 1705 | beforeSetupInternal: function (effect) { |
1692 | elemClip = s.makeClipping(effect.element); | 1706 | elemClip = s.makeClipping(effect.element); |
1693 | }, | 1707 | }, |
1694 | afterFinishInternal: function (effect) { | 1708 | afterFinishInternal: function (effect) { |
1695 | s.hideElement(effect.element); | 1709 | s.hideElement(effect.element); |
1696 | s.undoClipping(effect.element, elemClip); | 1710 | s.undoClipping(effect.element, elemClip); |
1697 | } | 1711 | } |
1698 | }, options); | 1712 | }, options); |
@@ -1953,23 +1967,10 @@ MochiKit.Visual.fold = function (element, /* optional */ options) { | |||
1953 | } | 1967 | } |
1954 | }); | 1968 | }); |
1955 | } | 1969 | } |
1956 | }, options); | 1970 | }, options); |
1957 | return new v.Scale(element, 5, options); | 1971 | return new v.Scale(element, 5, options); |
1958 | }; | 1972 | }; |
1959 | 1973 | ||
1960 | 1974 | ||
1961 | /* end of Rico adaptation */ | 1975 | MochiKit.Base.nameFunctions(MochiKit.Visual); |
1962 | |||
1963 | MochiKit.Visual.__new__ = function () { | ||
1964 | var m = MochiKit.Base; | ||
1965 | |||
1966 | // Backwards compatibility aliases | ||
1967 | m._deprecated(this, 'Color', 'MochiKit.Color.Color', '1.1'); | ||
1968 | m._deprecated(this, 'getElementsComputedStyle', 'MochiKit.Style.getStyle', '1.1'); | ||
1969 | |||
1970 | m.nameFunctions(this); | ||
1971 | }; | ||
1972 | |||
1973 | MochiKit.Visual.__new__(); | ||
1974 | |||
1975 | MochiKit.Base._exportSymbols(this, MochiKit.Visual); | 1976 | MochiKit.Base._exportSymbols(this, MochiKit.Visual); |