From a3024011a91d3941f81481dd4d600e9684eb0fd4 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Thu, 2 Feb 2012 00:11:51 -0800 Subject: upgrading to Montage v0.6 Signed-off-by: Valerio Virgillito --- node_modules/montage/ui/flow.reel/flow.js | 658 ++++++++++++++++++++++++------ 1 file changed, 536 insertions(+), 122 deletions(-) (limited to 'node_modules/montage/ui/flow.reel/flow.js') diff --git a/node_modules/montage/ui/flow.reel/flow.js b/node_modules/montage/ui/flow.reel/flow.js index c0a6b32f..21556e41 100644 --- a/node_modules/montage/ui/flow.reel/flow.js +++ b/node_modules/montage/ui/flow.reel/flow.js @@ -1,18 +1,90 @@ -/* -This file contains proprietary software owned by Motorola Mobility, Inc.
-No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
-(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. -
*/ - var Montage = require("montage").Montage, Component = require("ui/component").Component; var Flow = exports.Flow = Montage.create(Component, { - + + // TODO: Review _externalUpdate + + _externalUpdate: { + enumerable: false, + value: true + }, + + _isCameraUpdated: { + enumerable: false, + value: false + }, + + // Camera rotation based in CSS3 rotate3D axis/angle system + + _cameraRotationAxisX: { + enumerable: false, + value: 0 + }, + + _cameraRotationAxisY: { + enumerable: false, + value: 0 + }, + + _cameraRotationAxisZ: { + enumerable: false, + value: 1 + }, + + _cameraRotationAngle: { + enumerable: false, + value: 0 + }, + + cameraRotationAxisX: { + get: function () { + return this._cameraRotationAxisX; + }, + set: function (value) { + this._cameraRotationAxisX = value; + this._isCameraUpdated = true; + this.needsDraw = true; + } + }, + + cameraRotationAxisY: { + get: function () { + return this._cameraRotationAxisY; + }, + set: function (value) { + this._cameraRotationAxisY = value; + this._isCameraUpdated = true; + this.needsDraw = true; + } + }, + + cameraRotationAxisZ: { + get: function () { + return this._cameraRotationAxisZ; + }, + set: function (value) { + this._cameraRotationAxisZ = value; + this._isCameraUpdated = true; + this.needsDraw = true; + } + }, + + cameraRotationAngle: { + get: function () { + return this._cameraRotationAngle; + }, + set: function (value) { + this._cameraRotationAngle = value; + this._isCameraUpdated = true; + this.needsDraw = true; + } + }, + _path: { enumerable: false, value: { - value: function (slide) { + value: function (slide) { return { translateX: slide.time, translateY: 0, @@ -29,7 +101,7 @@ var Flow = exports.Flow = Montage.create(Component, { } } }, - + path: { get: function () { return this._path; @@ -39,12 +111,12 @@ var Flow = exports.Flow = Montage.create(Component, { this.needsDraw = true; } }, - + _rotationOrder: { enumerable: false, value: "xyz" }, - + rotationOrder: { get: function () { return this._rotationOrder; @@ -55,7 +127,7 @@ var Flow = exports.Flow = Montage.create(Component, { case "yxz": case "yzx": case "zxy": - case "zyx": + case "zyx": this._rotationOrder=value; break; default: @@ -65,33 +137,7 @@ var Flow = exports.Flow = Montage.create(Component, { this.needsDraw = true; } }, - - numberOfNodes: { - value: null - }, - - _nodeOffset: { - enumerable: false, - value: { - value: function (nodeNumber) { - return { - time: nodeNumber*100, - speed: 0 - } - } - } - }, - - nodeOffset: { - get: function () { - return this._nodeOffset; - }, - set: function (value) { - this._nodeOffset = value; - this.needsDraw = true; - } - }, - + _width: { enumerable: false, value: null @@ -101,19 +147,19 @@ var Flow = exports.Flow = Montage.create(Component, { enumerable: false, value: null }, - + _repetitionComponents: { enumerable: false, value: null }, - + prepareForDraw: { enumerable: false, value: function () { - this._repetitionComponents=this._repetition._childComponents; + this._repetitionComponents = this._repetition._childComponents; } }, - + draw: { enumerable: false, value: function () { @@ -131,87 +177,96 @@ var Flow = exports.Flow = Montage.create(Component, { jPath, iOffset, iStyle; - - for (i=0; ii*this._scale) { + this.startAnimating(i, x); + } + } + } + } + this.stopAnimating(this._selectedSlideIndex); + + if (!this.isAnimating) { + this._animationInterval=function () { + var animatingLength=self.animating.length, + n, j, i, _iterations=8, + time=Date.now(), + interval1=self.lastDrawTime?(time-self.lastDrawTime)*0.015*this._elasticScrollingSpeed:0, + interval=interval1/_iterations, + mW=self._scale, x, + epsilon=.5; + + for (n=0; n<_iterations; n++) { + for (j=0; ji*self._scale-epsilon) { + self.stopAnimating(i); + animatingLength--; + } else { + j++; + } + } else { + if (self.slide[i].x