aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--js/panels/Timeline/TimelinePanel.reel/TimelinePanel.html19
-rw-r--r--js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js30
-rw-r--r--js/panels/Timeline/TimelinePanel.reel/css/TimelinePanel.css6
-rw-r--r--js/panels/Timeline/Tween.reel/Tween.js75
4 files changed, 129 insertions, 1 deletions
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.html b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.html
index 2e0bf7dd..42921a2d 100644
--- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.html
+++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.html
@@ -119,6 +119,24 @@
119 119
120 } 120 }
121 }, 121 },
122
123 "timelineZoomSlider":{
124 "module":"js/components/slider.reel",
125 "name":"Slider",
126 "properties":{
127 "element":{"#":"tl_slider"},
128 "maxValue" : 10000,
129 "minValue" : 1000
130 },
131 "bindings": {
132 "value": {
133 "boundObject": {"@": "owner"},
134 "boundObjectPropertyPath": "millisecondsOffset",
135 "oneway": false
136 }
137 }
138 },
139
122 "endHottext" : { 140 "endHottext" : {
123 "module": "js/components/hottextunit.reel", 141 "module": "js/components/hottextunit.reel",
124 "name": "HotTextUnit", 142 "name": "HotTextUnit",
@@ -168,6 +186,7 @@
168 </div> 186 </div>
169 187
170 <div id="timeline_gutter" class="timelinegutter"> 188 <div id="timeline_gutter" class="timelinegutter">
189 <div id="tl_slider" class="tl_slider"></div>
171 <input id="end_hottext" class="endhottext"> 190 <input id="end_hottext" class="endhottext">
172 </div> 191 </div>
173 </div> 192 </div>
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
index bc474a46..1d22c109 100644
--- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
+++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
@@ -137,10 +137,33 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
137 } 137 }
138 }, 138 },
139 139
140 millisecondsOffset:{ 140 _millisecondsOffset:{
141 value:1000 141 value:1000
142 }, 142 },
143 143
144 millisecondsOffset:{
145 get:function () {
146 return this._millisecondsOffset;
147 },
148 set:function (newVal) {
149 if (newVal !== this._millisecondsOffset) {
150 this._millisecondsOffset= newVal;
151 this.drawTimeMarkers();
152 NJevent('tlZoomSlider',this);
153 }
154 }
155 },
156
157 tweenarray:{
158 value:[],
159 writable:true
160 },
161
162 tempArray:{
163 value:[],
164 writable:true
165 },
166
144 _masterDuration:{ 167 _masterDuration:{
145 serializable:true, 168 serializable:true,
146 value:0 169 value:0
@@ -686,6 +709,11 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
686 drawTimeMarkers:{ 709 drawTimeMarkers:{
687 value:function () { 710 value:function () {
688 this.timeMarkerHolder = document.createElement("div"); 711 this.timeMarkerHolder = document.createElement("div");
712
713 if(this.time_markers.children[0]){
714 this.time_markers.removeChild(this.time_markers.children[0]);
715 }
716
689 this.time_markers.appendChild(this.timeMarkerHolder); 717 this.time_markers.appendChild(this.timeMarkerHolder);
690 var i; 718 var i;
691 var totalMarkers = Math.floor(this.time_markers.offsetWidth / 80); 719 var totalMarkers = Math.floor(this.time_markers.offsetWidth / 80);
diff --git a/js/panels/Timeline/TimelinePanel.reel/css/TimelinePanel.css b/js/panels/Timeline/TimelinePanel.reel/css/TimelinePanel.css
index 129b9771..21a7535c 100644
--- a/js/panels/Timeline/TimelinePanel.reel/css/TimelinePanel.css
+++ b/js/panels/Timeline/TimelinePanel.reel/css/TimelinePanel.css
@@ -284,3 +284,9 @@
284 display: none; 284 display: none;
285 box-shadow: rgb(17, 17, 17) 0px 0px 14px inset; 285 box-shadow: rgb(17, 17, 17) 0px 0px 14px inset;
286} 286}
287.tl_slider{
288 width: 65px;
289 height: 5px;
290 background: none;
291 margin-left: 25%;
292}
diff --git a/js/panels/Timeline/Tween.reel/Tween.js b/js/panels/Timeline/Tween.reel/Tween.js
index 2b308d9a..e8c7e187 100644
--- a/js/panels/Timeline/Tween.reel/Tween.js
+++ b/js/panels/Timeline/Tween.reel/Tween.js
@@ -44,6 +44,7 @@ var Tween = exports.Tween = Montage.create(Component, {
44 }, 44 },
45 set: function(value){ 45 set: function(value){
46 this._spanWidth = value; 46 this._spanWidth = value;
47 this.needsDraw=true;
47 } 48 }
48 }, 49 },
49 50
@@ -58,6 +59,7 @@ var Tween = exports.Tween = Montage.create(Component, {
58 }, 59 },
59 set:function (value) { 60 set:function (value) {
60 this._spanPosition = value; 61 this._spanPosition = value;
62 this.needsDraw=true;
61 } 63 }
62 }, 64 },
63 65
@@ -72,6 +74,7 @@ var Tween = exports.Tween = Montage.create(Component, {
72 }, 74 },
73 set:function (value) { 75 set:function (value) {
74 this._keyFramePosition = value; 76 this._keyFramePosition = value;
77 this.needsDraw=true;
75 } 78 }
76 }, 79 },
77 80
@@ -133,6 +136,12 @@ var Tween = exports.Tween = Montage.create(Component, {
133 } 136 }
134 }, 137 },
135 138
139 prepareForDraw:{
140 value:function(){
141 this.eventManager.addEventListener("tlZoomSlider", this, false);
142 }
143 },
144
136 draw:{ 145 draw:{
137 value:function () { 146 value:function () {
138 this.element.style.left = this.spanPosition + "px"; 147 this.element.style.left = this.spanPosition + "px";
@@ -217,5 +226,71 @@ var Tween = exports.Tween = Montage.create(Component, {
217 // deselect the keyframe for this tween 226 // deselect the keyframe for this tween
218 this.keyframe.deselectKeyframe(); 227 this.keyframe.deselectKeyframe();
219 } 228 }
229 },
230
231 handleTlZoomSlider:{
232 value:function(event){
233 var currentMilliSecPerPixel , currentMilliSec , clickPos,i=0;
234
235 length = this.application.ninja.timeline.tempArray.length;
236 if(length > 0 && this.application.ninja.timeline.tempArray[length-1]!== this.parentComponent.parentComponent.trackID){
237 this.application.ninja.timeline.tempArray.push(this.parentComponent.parentComponent.trackID);
238 var i = this.application.ninja.timeline.tweenarray.length-1;
239 for(;this.currentTween = this.application.ninja.timeline.tweenarray[i];i--){
240 if(this.application.ninja.timeline.tweenarray[i].tweenID===0){
241 this.currentTween.spanWidth=0;
242 this.currentTween.spanPosition=0;
243 this.currentTween.keyFramePosition=0;
244 this.currentTween.keyFrameMillisec=0;
245 this.needsDraw=true;
246 }else{
247 currentMilliSecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80);
248 currentMilliSec = this.currentTween.keyFrameMillisec;
249 clickPos = currentMilliSec / currentMilliSecPerPixel;
250 this.currentTween.spanWidth = clickPos-this.application.ninja.timeline.tweenarray[i+1].keyFramePosition;
251 this.currentTween.keyFramePosition = clickPos;
252 this.currentTween.spanPosition=clickPos-this.currentTween.spanWidth;
253 this.needsDraw=true;
254 }
255
256 }
257 this.application.ninja.timeline.tweenarray.length=0;
258 this.application.ninja.timeline.tweenarray.push(this);
259 }else if(length===0){
260 this.application.ninja.timeline.tempArray.push(this.parentComponent.parentComponent.trackID);
261 this.application.ninja.timeline.tweenarray.push(this);
262 }else{
263 this.application.ninja.timeline.tweenarray.push(this);
264 }
265
266 var levelNumber = this.application.ninja.timeline.getLayerIndexByID(this.parentComponent.parentComponent.trackID);
267 var k = this.application.ninja.timeline.tweenarray.length-1;
268 if(this.parentComponent.parentComponent.tweens.length === this.application.ninja.timeline.tweenarray.length && levelNumber===0){
269 for(;this.currentTween = this.application.ninja.timeline.tweenarray[k];k--){
270 if(this.application.ninja.timeline.tweenarray[k].tweenID===0){
271 this.currentTween.spanWidth=0;
272 this.currentTween.spanPosition=0;
273 this.currentTween.keyFramePosition=0;
274 this.currentTween.keyFrameMillisec=0;
275 this.needsDraw=true;
276 }else{
277 currentMilliSecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80);
278 currentMilliSec = this.currentTween.keyFrameMillisec;
279 clickPos = currentMilliSec / currentMilliSecPerPixel;
280 this.currentTween.spanWidth = clickPos-this.application.ninja.timeline.tweenarray[k+1].keyFramePosition;
281 this.currentTween.keyFramePosition = clickPos;
282 this.currentTween.spanPosition=clickPos-this.currentTween.spanWidth;
283 this.needsDraw=true;
284 }