diff options
Diffstat (limited to 'js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js')
-rw-r--r-- | js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | 1576 |
1 files changed, 930 insertions, 646 deletions
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index 033d0f79..ef85e067 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,19 @@ 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) { |
32 | this._arrLayers = newVal; | 29 | this._arrLayers = newVal; |
33 | this.needsDraw = true; | 30 | this.needsDraw = true; |
34 | this._cacheArrays(); | 31 | this.cacheTimeline(); |
35 | } | 32 | } |
36 | }, | 33 | }, |
37 | 34 | ||
@@ -50,12 +47,12 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
50 | 47 | ||
51 | 48 | ||
52 | _layerRepetition:{ | 49 | _layerRepetition:{ |
53 | serializable: true, | 50 | serializable:true, |
54 | value:null | 51 | value:null |
55 | }, | 52 | }, |
56 | 53 | ||
57 | layerRepetition:{ | 54 | layerRepetition:{ |
58 | serializable: true, | 55 | serializable:true, |
59 | get:function () { | 56 | get:function () { |
60 | return this._layerRepetition; | 57 | return this._layerRepetition; |
61 | }, | 58 | }, |
@@ -64,18 +61,9 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
64 | } | 61 | } |
65 | }, | 62 | }, |
66 | 63 | ||
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 | 64 | // Set to false to skip array caching array sets in current document |
77 | _boolCacheArrays : { | 65 | _boolCacheArrays:{ |
78 | value: true | 66 | value:true |
79 | }, | 67 | }, |
80 | 68 | ||
81 | _currentLayerNumber:{ | 69 | _currentLayerNumber:{ |
@@ -89,93 +77,98 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { | |||
89 | set:function (newVal) { | 77 | set:function (newVal) { |
90 | if (newVal !== this._currentLayerNumber) { | 78 | if (newVal !== this._currentLayerNumber) { |
91 | this._currentLayerNumber = newVal; | 79 | this._currentLayerNumber = newVal; |
92 | this._setCurrentLayerNumber(); | 80 | this.cacheTimeline(); |
93 | } | 81 | } |
94 | } | 82 | } |
95 | }, | 83 | }, |
96 | 84 | ||
97 | _setCurrentLayerNumber:{ | 85 | _currentLayerSelected:{ |
98 | value:function(){ | 86 | value: false |
99 | if (this._boolCacheArrays) { | ||
100 | this.application.ninja.currentDocument.tllayerNumber = this.currentLayerNumber; | ||
101 | } | ||
102 | } | ||
103 | }, | 87 | }, |
104 | 88 | currentLayerSelected:{ | |
105 | _hashKey:{ | ||
106 | value:0 | ||
107 | }, | ||
108 | |||
109 | hashKey:{ | ||
110 | get:function () { | 89 | get:function () { |
111 | return this._hashKey; | 90 | return this._currentLayerSelected; |
112 | }, | 91 | }, |
113 | set:function (newVal) { | 92 | set:function (newVal) { |
114 | if (newVal !== this._hashKey) { | 93 | this._currentLayerSelected = newVal; |
115 | this._hashKey = newVal; | 94 | this.cacheTimeline(); |
116 | this._setHashKey(); | ||
117 | } | ||
118 | } | 95 | } |
119 | }, | 96 | }, |
120 | 97 | ||
121 | _setHashKey:{ | 98 | _selectedLayerID:{ |
122 | value:function(){ | 99 | value:false |
123 | if (this._boolCacheArrays) { | 100 | }, |
124 | this.application.ninja.currentDocument.hashKey = this.hashKey; | 101 | selectedLayerID:{ |
102 | get:function () { | ||
103 | return this._selectedLayerID; | ||
104 | }, | ||
105 | set:function (newVal) { | ||
106 | if (newVal === false) { | ||
107 | // We are clearing the timeline, so just set the value and return. | ||
108 | this._selectedLayerID = newVal; | ||
109 | return; | ||
110 | } | ||
111 | if (newVal !== this._selectedLayerID) { | ||
112 | //console.log('TimelinePanel.selectLayerID.set') | ||
113 | var selectIndex = this.getLayerIndexByID(newVal); | ||
114 | this._selectedLayerID = newVal; | ||
115 | this._captureSelection = true; | ||
116 | if (this.currentLayerSelected !== false) { | ||
117 | this.selectLayer(selectIndex, true); | ||
118 | } | ||
119 | if (this.currentLayersSelected !== false) { | ||
120 | this.selectLayers(this.currentLayersSelected); | ||
121 | } | ||
122 | if ((this.currentLayersSelected === false) && (this.currentLayerSelected === false)) { | ||
123 | this.selectLayers([]); | ||
124 | } | ||
125 | |||
125 | } | 126 | } |
126 | } | 127 | } |
127 | }, | 128 | }, |
128 | 129 | ||
129 | _currentLayerSelected:{ | 130 | _currentLayersSelected:{ |
130 | value: null | 131 | value:[] |
131 | }, | 132 | }, |
132 | currentLayerSelected : { | 133 | currentLayersSelected:{ |
133 | get: function() { | 134 | get:function () { |
134 | return this._currentLayerSelected; | 135 | return this._currentLayersSelected; |
135 | }, | 136 | }, |
136 | set: function(newVal) { | 137 | set:function (newVal) { |
137 | this._currentLayerSelected = newVal; | 138 | //console.log("TimelinePanel.currentLayersSelected.set, ", newVal); |
138 | this.application.ninja.currentDocument.tlCurrentLayerSelected = newVal; | 139 | this._currentLayersSelected = newVal; |
139 | } | 140 | this.cacheTimeline(); |
141 | } | ||
140 | }, | 142 | }, |
141 | 143 | ||
142 | _selectedLayerID:{ | 144 | _millisecondsOffset:{ |
143 | value: false | 145 | value:1000 |
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 | }, | 146 | }, |
163 | 147 | ||
164 | millisecondsOffset:{ | 148 | millisecondsOffset:{ |