diff options
Diffstat (limited to 'js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js')
-rw-r--r-- | js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | 1590 |
1 files changed, 942 insertions, 648 deletions
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index 033d0f79..70e04b4c 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,109 @@ 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:{ | 89 | get:function () { |
106 | value:0 | 90 | return this._currentLayerSelected; |
107 | }, | 91 | }, |
92 | set:function (newVal) { | ||
93 | this._currentLayerSelected = newVal; | ||
94 | this.cacheTimeline(); | ||
95 | } | ||
96 | }, | ||
108 | 97 | ||
109 | hashKey:{ | 98 | _selectedLayerID:{ |
99 | value:false | ||
100 | }, | ||
101 | selectedLayerID:{ | ||
110 | get:function () { | 102 | get:function () { |
111 | return this._hashKey; | 103 | return this._selectedLayerID; |
112 | }, | 104 | }, |
113 | set:function (newVal) { | 105 | set:function (newVal) { |
114 | if (newVal !== this._hashKey) { | 106 | if (newVal === false) { |
115 | this._hashKey = newVal; | 107 | // We are clearing the timeline, so just set the value and return. |
116 | this._setHashKey(); | 108 | this._selectedLayerID = newVal; |
109 | return; | ||
110 | } | ||
111 | if (newVal !== this._selectedLayerID) { | ||
112 | var selectIndex = this.getLayerIndexByID(newVal); | ||
113 | this._selectedLayerID = newVal; | ||
114 | this._captureSelection = true; | ||
115 | if (this.currentLayerSelected !== false) { | ||
116 | this.selectLayer(selectIndex, true); | ||
117 | } | ||
118 | if (this.currentLayersSelected !== false) { | ||
119 | this.selectLayers(this.currentLayersSelected); | ||
120 | } | ||
121 | if ((this.currentLayersSelected === false) && (this.currentLayerSelected === false)) { | ||
122 | this.selectLayers([]); | ||
123 | } | ||
124 | |||
117 | } | 125 | } |
118 | } | 126 | } |
119 | }, | 127 | }, |
120 | 128 | ||
121 | _setHashKey:{ | 129 | _currentLayersSelected:{ |
122 | value:function(){ | 130 | value:[] |
123 | if (this._boolCacheArrays) { | 131 | }, |
124 | this.application.ninja.currentDocument.hashKey = this.hashKey; | 132 | currentLayersSelected:{ |
125 | } | 133 | get:function () { |
134 | return this._currentLayersSelected; | ||
135 | }, | ||
136 | set:function (newVal) { | ||
137 | this._currentLayersSelected = newVal; | ||
138 | this.cacheTimeline(); | ||
126 | } | 139 | } |
127 | }, | 140 | }, |
128 | 141 | ||
129 | _currentLayerSelected:{ | 142 | _currentSelectedContainer: { |
130 | value: null | 143 | value: null |
131 | }, | 144 | }, |
132 | currentLayerSelected : { | 145 | currentSelectedContainer: { |
133 | get: function() { | 146 | get: function() { |
134 | return this._currentLayerSelected; | 147 | return this._currentSelectedContainer; |
135 | }, | 148 | }, |
136 | set: function(newVal) { | 149 | set: function(newVal) { |
137 | this._currentLayerSelected = newVal; | 150 | this._currentSelectedContainer = newVal; |
138 | this.application.ninja.currentDocument.tlCurrentLayerSelected = newVal; | 151 | this.handleDocumentChange(); |
139 | } | 152 | } |
140 | }, | 153 | }, |
141 | 154 | ||
142 | _selectedLayerID:{ | 155 | _millisecondsOffset:{ |
143 | value: false | 156 | 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 = thi |