diff options
Diffstat (limited to 'js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js')
-rw-r--r-- | js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | 781 |
1 files changed, 559 insertions, 222 deletions
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index 9bf51e60..a0e2376a 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | |||
@@ -1,295 +1,632 @@ | |||
1 | /* <copyright> | ||
2 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | ||
3 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> | ||
4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | ||
5 | </copyright> */ | ||
6 | |||
7 | var Montage = require("montage/core/core").Montage; | 1 | var Montage = require("montage/core/core").Montage; |
8 | var Component = require("montage/ui/component").Component; | 2 | var Component = require("montage/ui/component").Component; |
9 | var TimelineController = require("js/panels/Timeline/TimelineController").TimelineController; | 3 | var Layer = require("js/panels/Timeline/Layer.reel").Layer; |
4 | var TimelineTrack = require("js/panels/Timeline/TimelineTrack.reel").TimelineTrack; | ||
10 | 5 | ||
11 | var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | 6 | // var Track = require("js/panels/Timeline/Track.reel").Track; |
12 | 7 | ||
13 | tmpImg: { value: null}, | 8 | var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { |
14 | 9 | ||
15 | templateDidLoad: { | 10 | hasTemplate: { |
16 | value: function() { | 11 | value: true |
17 | /* | 12 | }, |
18 | this.tmpImg = document.createElement("img"); | 13 | |
19 | this.tmpImg.width = 1879; | 14 | /* === BEGIN: Models === */ |
20 | this.tmpImg.height = 440; | 15 | |
21 | this.tmpImg.src = "images/timeline/timeline.png"; | 16 | // Layer models: arrays for the data and repetition, current layer number, |
22 | */ | 17 | _arrLayers : { |
18 | value: [] | ||
19 | }, | ||
20 | arrLayers: { | ||
21 | get: function() { | ||
22 | return this._arrLayers; | ||
23 | }, | ||
24 | set: function(newVal) { | ||
25 | this._arrLayers = newVal; | ||
23 | } | 26 | } |
24 | }, | 27 | }, |
25 | 28 | ||
26 | prepareForDraw: { | 29 | _layerRepetition: { |
27 | value: function() { | 30 | value: null |
28 | this.element.style.background = "url('images/timeline/timeline.png')"; | 31 | }, |
29 | this.element.style.width = "100%"; | 32 | layerRepetition: { |
30 | this.element.style.height = "400px"; | 33 | get: function() { |
31 | this.element.style.backgroundPosition = "-5px -40px"; | 34 | return this._layerRepetition; |
35 | }, | ||
36 | set: function(newVal) { | ||
37 | this._layerRepetition = newVal; | ||
32 | } | 38 | } |
33 | }, | 39 | }, |
40 | |||
41 | currentLayerNumber:{ | ||
42 | value:0 | ||
43 | }, | ||
34 | 44 | ||
35 | init : { | 45 | millisecondsOffset:{ |
36 | value : function() | 46 | value:5000 |
37 | { | 47 | }, |
38 | this.buildTimelineView(); | ||
39 | 48 | ||
49 | // Track model | ||
50 | _arrTracks: { | ||
51 | serializable: true, | ||
52 | value: [] | ||
53 | }, | ||
54 | arrTracks: { | ||
55 | serializable: true, | ||
56 | get: function() { | ||
57 | return this._arrTracks; | ||
58 | }, | ||
59 | set: function(newVal) { | ||
60 | this._arrTracks = newVal; | ||
40 | } | 61 | } |
41 | }, | 62 | }, |
42 | 63 | _trackRepetition: { | |
43 | breadCrumbContainer:{ | 64 | serializable: true, |
44 | value:null, | 65 | value: null |
45 | writable:true, | ||
46 | enumerable:true | ||
47 | }, | 66 | }, |
48 | 67 | trackRepetition : { | |
49 | controlsContainer:{ | 68 | serializable: true, |
50 | value:null, | 69 | get: function() { |
51 | writable:true, | 70 | return this._trackRepetition; |
52 | enumerable:true | 71 | }, |
72 | set: function(newVal) { | ||
73 | this._trackRepetition = newVal; | ||
74 | } | ||
53 | }, | 75 | }, |
54 | 76 | ||
55 | timelineGutter:{ | 77 | _selectedKeyframes:{ |
56 | value:null, | 78 | value:[] |
57 | writable:true, | ||
58 | enumerable:true | ||
59 | }, | 79 | }, |
60 | 80 | ||
61 | userLayerContainer:{ | 81 | selectedKeyframes:{ |
62 | value:null, | 82 | serializable:true, |
63 | writable:true, | 83 | get:function () { |
64 | enumerable:true | 84 | return this._selectedKeyframes; |
85 | }, | ||
86 | set:function (newVal) { | ||
87 | this._selectedKeyframes = newVal; | ||
88 | } | ||
65 | }, | 89 | }, |
66 | 90 | ||
67 | currentLayerNumber:{ | ||
68 | value:1, | ||
69 | writable:true, | ||
70 | enumerable:true | ||
71 | }, | ||
72 | 91 | ||
73 | newLayerButton:{ | 92 | /* === END: Models === */ |
74 | value:null, | 93 | |
75 | writable:true, | 94 | /* === BEGIN: Draw cycle === */ |
76 | enumerable:true | 95 | |
96 | prepareForDraw: { | ||
97 | value: function() { | ||
98 | |||
99 | this.eventManager.addEventListener("deleteLayerClick", this, false); | ||
100 | this.eventManager.addEventListener("newLayer", this, false); | ||
101 | this.eventManager.addEventListener("deleteLayer", this, false); | ||
102 | this.eventManager.addEventListener( "layerBinding", this, false); | ||
103 | this.eventManager.addEventListener("elementAdded", this, false); | ||
104 | this.eventManager.addEventListener("elementDeleted", this, false); | ||
105 | this.eventManager.addEventListener("deleteSelection", this, false); | ||
106 | this.hashInstance=this.createLayerHashTable(); | ||
107 | this.hashTrackInstance=this.createTrackHashTable(); | ||
108 | this.initTimelineView(); | ||
109 | } | ||
110 | }, | ||
111 | _isLayer: { | ||
112 | value: false | ||
77 | }, | 113 | }, |
78 | 114 | ||
79 | deleteLayerButton:{ | 115 | _isLayerAdded:{ |
80 | value:null, | 116 | value:false |
81 | writable:true, | ||
82 | enumerable:true | ||
83 | }, | 117 | }, |
84 | 118 | ||
85 | newFolderButton:{ | 119 | addButtonClicked:{ |
86 | value:null, | 120 | value:true |
87 | writable:true, | ||
88 | enumerable:true | ||
89 | }, | 121 | }, |
90 | 122 | ||
91 | buildTimelineView : { | 123 | willDraw: { |
92 | value:function(){ | 124 | value: function() { |
93 | var timeline = document.getElementById("timelinePanel"); | 125 | if (this._isLayer) { |
94 | 126 | this.addButtonClicked=false; | |
95 | var mainTimelineContainer = document.createElement("div"); | 127 | this._isElementAdded=true; |
96 | mainTimelineContainer.style.backgroundColor = "#000000"; | 128 | NJevent('newLayer',this) |
97 | mainTimelineContainer.style.width = "100%"; | 129 | this._isLayer = false; |
98 | mainTimelineContainer.style.height = "100%"; | 130 | this.addButtonClicked=true; |
99 | mainTimelineContainer.style.overflow = "visible"; | 131 | } |
100 | |||
101 | timeline.appendChild(mainTimelineContainer); | ||
102 | |||
103 | this.breadCrumbContainer = document.createElement("div"); | ||
104 | this.breadCrumbContainer.style.width = "100%"; | ||
105 | this.breadCrumbContainer.style.height = "20px"; | ||
106 | this.breadCrumbContainer.style.backgroundColor = "#111111"; | ||
107 | |||
108 | var timeControllerContainer = document.createElement("div"); | ||
109 | timeControllerContainer.style.width = "auto"; | ||
110 | timeControllerContainer.style.height = "20px"; | ||
111 | timeControllerContainer.style.backgroundColor = "#000000"; | ||
112 | |||
113 | this.controlsContainer = document.createElement("div"); | ||
114 | this.controlsContainer.style.width = "200px"; | ||
115 | this.controlsContainer.style.height = "20px"; | ||
116 | this.controlsContainer.style.backgroundColor = "#440000"; | ||