diff options
Diffstat (limited to 'js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js')
-rw-r--r-- | js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | 1414 |
1 files changed, 744 insertions, 670 deletions
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index 033d0f79..7fb57396 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | |||
@@ -6,10 +6,7 @@ | |||
6 | 6 | ||
7 | var Montage = require("montage/core/core").Montage; | 7 | var Montage = require("montage/core/core").Montage; |
8 | var Component = require("montage/ui/component").Component; | 8 | var Component = require("montage/ui/component").Component; |
9 | var Layer = require("js/panels/Timeline/Layer.reel").Layer; | ||
10 | var TimelineTrack = require("js/panels/Timeline/TimelineTrack.reel").TimelineTrack; | ||
11 | var nj = require("js/lib/NJUtils").NJUtils; | 9 | var nj = require("js/lib/NJUtils").NJUtils; |
12 | var ElementMediator = require("js/mediators/element-mediator").ElementMediator; | ||
13 | 10 | ||
14 | var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | 11 | var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { |
15 | 12 | ||
@@ -19,19 +16,20 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
19 | 16 | ||
20 | /* === BEGIN: Models === */ | 17 | /* === BEGIN: Models === */ |
21 | _arrLayers:{ | 18 | _arrLayers:{ |
22 | serializable: true, | 19 | serializable:true, |
23 | value:[] | 20 | value:[] |
24 | }, | 21 | }, |
25 | 22 | ||
26 | arrLayers:{ | 23 | arrLayers:{ |
27 | serializable: true, | 24 | serializable:true, |
28 | get:function () { | 25 | get:function () { |
29 | return this._arrLayers; | 26 | return this._arrLayers; |
30 | }, | 27 | }, |
31 | set:function (newVal) { | 28 | set:function (newVal) { |
29 | // debugger; | ||
32 | this._arrLayers = newVal; | 30 | this._arrLayers = newVal; |
33 | this.needsDraw = true; | 31 | this.needsDraw = true; |
34 | this._cacheArrays(); | 32 | this.cacheTimeline(); |
35 | } | 33 | } |
36 | }, | 34 | }, |
37 | 35 | ||
@@ -50,12 +48,12 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
50 | 48 | ||
51 | 49 | ||
52 | _layerRepetition:{ | 50 | _layerRepetition:{ |
53 | serializable: true, | 51 | serializable:true, |
54 | value:null | 52 | value:null |
55 | }, | 53 | }, |
56 | 54 | ||
57 | layerRepetition:{ | 55 | layerRepetition:{ |
58 | serializable: true, | 56 | serializable:true, |
59 | get:function () { | 57 | get:function () { |
60 | return this._layerRepetition; | 58 | return this._layerRepetition; |
61 | }, | 59 | }, |
@@ -64,18 +62,9 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
64 | } | 62 | } |
65 | }, | 63 | }, |
66 | 64 | ||
67 | _cacheArrays : { | ||
68 | value: function() { | ||
69 | if (this._boolCacheArrays) { | ||
70 | this.application.ninja.currentDocument.tlArrLayers = this.arrLayers; | ||
71 | |||
72 | } | ||
73 | } | ||
74 | }, | ||
75 | |||
76 | // Set to false to skip array caching array sets in current document | 65 | // Set to false to skip array caching array sets in current document |
77 | _boolCacheArrays : { | 66 | _boolCacheArrays:{ |
78 | value: true | 67 | value:true |
79 | }, | 68 | }, |
80 | 69 | ||
81 | _currentLayerNumber:{ | 70 | _currentLayerNumber:{ |
@@ -89,93 +78,74 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
89 | set:function (newVal) { | 78 | set:function (newVal) { |
90 | if (newVal !== this._currentLayerNumber) { | 79 | if (newVal !== this._currentLayerNumber) { |
91 | this._currentLayerNumber = newVal; | 80 | this._currentLayerNumber = newVal; |
92 | this._setCurrentLayerNumber(); | 81 | this.cacheTimeline(); |
93 | } | 82 | } |
94 | } | 83 | } |
95 | }, | 84 | }, |
96 | 85 | ||
97 | _setCurrentLayerNumber:{ | 86 | _currentLayerSelected:{ |
98 | value:function(){ | 87 | value:null |
99 | if (this._boolCacheArrays) { | ||
100 | this.application.ninja.currentDocument.tllayerNumber = this.currentLayerNumber; | ||
101 | } | ||
102 | } | ||
103 | }, | 88 | }, |
104 | 89 | currentLayerSelected:{ | |
105 | _hashKey:{ | ||
106 | value:0 | ||
107 | }, | ||
108 | |||
109 | hashKey:{ | ||
110 | get:function () { | 90 | get:function () { |
111 | return this._hashKey; | 91 | return this._currentLayerSelected; |
112 | }, | 92 | }, |
113 | set:function (newVal) { | 93 | set:function (newVal) { |
114 | if (newVal !== this._hashKey) { | 94 | this._currentLayerSelected = newVal; |
115 | this._hashKey = newVal; | 95 | this.cacheTimeline(); |
116 | this._setHashKey(); | ||
117 | } | ||
118 | } | 96 | } |
119 | }, | 97 | }, |
120 | 98 | ||
121 | _setHashKey:{ | 99 | _selectedLayerID:{ |
122 | value:function(){ | 100 | value:false |
123 | if (this._boolCacheArrays) { | 101 | }, |
124 | this.application.ninja.currentDocument.hashKey = this.hashKey; | 102 | selectedLayerID:{ |
103 | get:function () { | ||
104 | return this._selectedLayerID; | ||
105 | }, | ||
106 | set:function (newVal) { | ||
107 | if (newVal === false) { | ||
108 | // We are clearing the timeline, so just set the value and return. | ||
109 | this._selectedLayerID = newVal; | ||
110 | return; | ||
111 | } | ||
112 | if (newVal !== this._selectedLayerID) { | ||
113 | var selectIndex = this.getLayerIndexByID(newVal); | ||
114 | this._selectedLayerID = newVal; | ||
115 | this._captureSelection = true; | ||
116 | this.selectLayer(selectIndex); | ||
125 | } | 117 | } |
126 | } | 118 | } |
127 | }, | 119 | }, |
128 | 120 | ||
129 | _currentLayerSelected:{ | 121 | _millisecondsOffset:{ |
130 | value: null | 122 | value:1000 |
131 | }, | ||
132 | currentLayerSelected : { | ||
133 | get: function() { | ||
134 | return this._currentLayerSelected; | ||
135 | }, | ||
136 | set: function(newVal) { | ||
137 | this._currentLayerSelected = newVal; | ||
138 | this.application.ninja.currentDocument.tlCurrentLayerSelected = newVal; | ||
139 | } | ||
140 | }, | ||
141 | |||
142 | _selectedLayerID:{ | ||
143 | value: false | ||
144 | }, | ||
145 | selectedLayerID : { | ||
146 | get: function() { | ||
147 | return this._selectedLayerID; | ||
148 | }, | ||
149 | set: function(newVal) { | ||
150 | if (newVal === false) { | ||
151 | // We are clearing the timeline, so just set the value and return. | ||
152 | this._selectedLayerID = newVal; | ||
153 | return; | ||
154 | } | ||
155 | if (newVal !== this._selectedLayerID) { | ||
156 | var selectIndex = this.getLayerIndexByID(newVal); | ||
157 | this._selectedLayerID = newVal; | ||
158 | this._captureSelection = true; | ||
159 | this.selectLayer(selectIndex, true); | ||
160 | } | ||
161 | } | ||
162 | }, | 123 | }, |
163 | 124 | ||
164 | millisecondsOffset:{ | 125 | millisecondsOffset:{ |
165 | value:1000 | 126 | get:function () { |
127 | return this._millisecondsOffset; | ||
128 | }, | ||
129 | set:function (newVal) { | ||
130 | if (newVal !== this._millisecondsOffset) { | ||
131 | this._millisecondsOffset= newVal; | ||
132 | this.drawTimeMarkers(); | ||
133 | NJevent('tlZoomSlider',this); | ||
134 | } | ||
135 | } | ||
166 | }, | 136 | }, |
167 | 137 | ||
168 | _masterDuration:{ | 138 | _masterDuration:{ |
169 | serializable: true, | 139 | serializable:true, |
170 | value:0 | 140 | value:0 |
171 | }, |