diff options
Diffstat (limited to 'node_modules/montage/ui/flow.reel')
-rw-r--r-- | node_modules/montage/ui/flow.reel/flow.html | 48 | ||||
-rw-r--r-- | node_modules/montage/ui/flow.reel/flow.js | 1002 |
2 files changed, 778 insertions, 272 deletions
diff --git a/node_modules/montage/ui/flow.reel/flow.html b/node_modules/montage/ui/flow.reel/flow.html index 646c87f8..8a9603bf 100644 --- a/node_modules/montage/ui/flow.reel/flow.html +++ b/node_modules/montage/ui/flow.reel/flow.html | |||
@@ -9,24 +9,43 @@ | |||
9 | <title></title> | 9 | <title></title> |
10 | <script type="text/montage-serialization"> | 10 | <script type="text/montage-serialization"> |
11 | { | 11 | { |
12 | "repetition1": { | 12 | "repetition": { |
13 | "module": "montage/ui/repetition.reel", | 13 | "prototype": "montage/ui/repetition.reel", |
14 | "name": "Repetition", | ||
15 | "properties": { | 14 | "properties": { |
16 | "element": { | 15 | "element": { |
17 | "#": "montage-flow-repetition" | 16 | "#": "montage-flow-repetition" |
18 | } | 17 | } |
19 | } | 18 | } |
20 | }, | 19 | }, |
20 | "translateComposer": { | ||
21 | "prototype": "montage/ui/composer/translate-composer", | ||
22 | "properties": { | ||
23 | "component": {"@": "owner"}, | ||
24 | "maxTranslateX": 250000, | ||
25 | "invertAxis": true | ||
26 | }, | ||
27 | "bindings": { | ||
28 | "element": {"<-": "@owner._element"} | ||
29 | } | ||
30 | }, | ||
21 | "owner": { | 31 | "owner": { |
22 | "module": "montage/ui/flow.reel", | 32 | "prototype": "montage/ui/flow.reel", |
23 | "name": "Flow", | ||
24 | "properties": { | 33 | "properties": { |
25 | "element": { | 34 | "element": { |
26 | "#": "montage-flow" | 35 | "#": "montage-flow" |
27 | }, | 36 | }, |
28 | "_repetition": { | 37 | "_repetition": { |
29 | "@": "repetition1" | 38 | "@": "repetition" |
39 | }, | ||
40 | "_translateComposer": { | ||
41 | "@": "translateComposer" | ||
42 | } | ||
43 | }, | ||
44 | "bindings": { | ||
45 | "translateX": {"<-": "@translateComposer.translateX"}, | ||
46 | "isSelectionEnabled": { | ||
47 | "boundObject": {"@": "repetition"}, | ||
48 | "boundObjectPropertyPath": "isSelectionEnabled" | ||
30 | } | 49 | } |
31 | } | 50 | } |
32 | } | 51 | } |
@@ -47,14 +66,23 @@ | |||
47 | -webkit-transform-style: preserve-3d; | 66 | -webkit-transform-style: preserve-3d; |
48 | -webkit-transform: translateZ(0); | 67 | -webkit-transform: translateZ(0); |
49 | } | 68 | } |
50 | .montage-flow-repetition > * { | 69 | .montage-flow-repetition > div { |
51 | position: absolute !important; | 70 | position: absolute; |
71 | top: 50%; | ||
72 | left: 50%; | ||
73 | width: 0; | ||
74 | height: 0; | ||
75 | -webkit-transform: translateZ(0); | ||
76 | -webkit-transform-style: preserve-3d; | ||
77 | } | ||
78 | .montage-flow-pointer-events-none { | ||
79 | pointer-events: none; | ||
52 | } | 80 | } |
53 | </style> | 81 | </style> |
54 | </head> | 82 | </head> |
55 | <body> | 83 | <body> |
56 | <div id="montage-flow" class="montage-flow"> | 84 | <div data-montage-id="montage-flow" class="montage-flow"> |
57 | <div id="montage-flow-repetition" class="montage-flow-repetition"></div> | 85 | <div data-montage-id="montage-flow-repetition" class="montage-flow-repetition"></div> |
58 | </div> | 86 | </div> |
59 | </body> | 87 | </body> |
60 | </html> | 88 | </html> |
diff --git a/node_modules/montage/ui/flow.reel/flow.js b/node_modules/montage/ui/flow.reel/flow.js index 089353a8..929e61b8 100644 --- a/node_modules/montage/ui/flow.reel/flow.js +++ b/node_modules/montage/ui/flow.reel/flow.js | |||
@@ -5,145 +5,319 @@ | |||
5 | </copyright> */ | 5 | </copyright> */ |
6 | 6 | ||
7 | var Montage = require("montage").Montage, | 7 | var Montage = require("montage").Montage, |
8 | Component = require("ui/component").Component; | 8 | Component = require("ui/component").Component, |
9 | FlowBezierSpline = require("ui/flow-bezier-spline").FlowBezierSpline; | ||
9 | 10 | ||
10 | var Flow = exports.Flow = Montage.create(Component, { | 11 | var Flow = exports.Flow = Montage.create(Component, { |
11 | 12 | ||
12 | // TODO: Review _externalUpdate | 13 | _splinePaths: { |
14 | enumerable: false, | ||
15 | value: null | ||
16 | }, | ||
13 | 17 | ||
14 | _externalUpdate: { | 18 | splinePaths: { |
15 | enumerable: false, | 19 | enumerable: false, |
16 | value: true | 20 | get: function () { |
21 | if (!this._splinePaths) { | ||
22 | this._splinePaths = []; | ||
23 | } | ||
24 | return this._splinePaths; | ||
25 | }, | ||
26 | set: function (value) { | ||
27 | this._splinePaths = value; | ||
28 | } | ||
17 | }, | 29 | }, |
18 | 30 | ||
19 | _isCameraUpdated: { | 31 | appendPath: { |
32 | value: function (path) { | ||
33 | var splinePath = Object.create(FlowBezierSpline), | ||
34 | pathKnots = path.knots, | ||
35 | length = path.knots.length, | ||
36 | knots = [], | ||
37 | nextHandlers = [], | ||
38 | previousHandlers = [], | ||
39 | densities = [], | ||
40 | i; | ||
41 | |||
42 | for (i = 0; i < length; i++) { | ||
43 | knots[i] = pathKnots[i].knotPosition; | ||
44 | previousHandlers[i] = pathKnots[i].previousHandlerPosition; | ||
45 | nextHandlers[i] = pathKnots[i].nextHandlerPosition; | ||
46 | densities[i] = pathKnots[i].previousDensity; // TODO: implement previous/next density | ||
47 | // TODO: add rotations, arbitrary CSS and units | ||
48 | } | ||
49 | splinePath.knots = knots; | ||
50 | splinePath.previousHandlers = previousHandlers; | ||
51 | splinePath.nextHandlers = nextHandlers; | ||
52 | splinePath.densities = densities; | ||
53 | splinePath._computeDensitySummation(); | ||
54 | this.splinePaths.push(splinePath); | ||
55 | this._paths.push(path); | ||
56 | } | ||
57 | }, | ||
58 | |||
59 | _paths: { | ||
20 | enumerable: false, | 60 | enumerable: false, |
21 | value: false | 61 | value: null |
22 | }, | 62 | }, |
23 | 63 | ||
24 | // Camera rotation based in CSS3 rotate3D axis/angle system | 64 | paths: { // TODO: listen for changes? |
65 | get: function () { | ||
66 | return this._paths; | ||
67 | }, | ||
68 | set: function (value) { | ||
69 | var length = value.length, | ||
70 | i; | ||
25 | 71 | ||
26 | _cameraRotationAxisX: { | 72 | if (length) { |
73 | this._paths = []; | ||
74 | for (i = 0; i < length; i++) { | ||
75 | this.appendPath(value[i]); | ||
76 | } | ||
77 | } | ||
78 | } | ||
79 | }, | ||
80 | |||
81 | _cameraPosition: { | ||
27 | enumerable: false, | 82 | enumerable: false, |
28 | value: 0 | 83 | value: [0, 0, 800] |
29 | }, | 84 | }, |
30 | 85 | ||
31 | _cameraRotationAxisY: { | 86 | _cameraTargetPoint: { |
32 | enumerable: false, | 87 | enumerable: false, |
33 | value: 0 | 88 | value: [0, 0, 0] |
34 | }, | 89 | }, |
35 | 90 | ||
36 | _cameraRotationAxisZ: { | 91 | _cameraFov: { |
37 | enumerable: false, | 92 | enumerable: false, |
38 | value: 1 | 93 | value: 50 |
39 | }, | 94 | }, |
40 | 95 | ||
41 | _cameraRotationAngle: { | 96 | // TODO: Implement camera roll |
97 | |||
98 | _cameraRoll: { | ||
42 | enumerable: false, | 99 | enumerable: false, |
43 | value: 0 | 100 | value: 0 |
44 | }, | 101 | }, |
45 | 102 | ||
46 | cameraRotationAxisX: { | 103 | cameraPosition: { |
47 | get: function () { | 104 | get: function () { |
48 | return this._cameraRotationAxisX; | 105 | return this._cameraPosition; |
49 | }, | 106 | }, |
50 | set: function (value) { | 107 | set: function (value) { |
51 | this._cameraRotationAxisX = value; | 108 | this._cameraPosition = value; |
52 | this._isCameraUpdated = true; | 109 | this._isCameraUpdated = true; |
53 | this.needsDraw = true; | 110 | this.needsDraw = true; |
54 | } |