@@ -160,16 +160,119 @@ App.directive("tlRuler", function ($timeout) {
160
160
}
161
161
} ) ;
162
162
163
+ /*function drawTimesSeconds() {
164
+ ruler = $("#ruler");
165
+ ruler.addClass('no_bg')
166
+ width = $("body").width();
167
+ // Clear all current tick marks
168
+ $("#ruler span").remove();
169
+ start = Math.max(0, ruler.left - width);
170
+ end = ruler.left + (2 * width);
171
+
172
+ // time = Math.floor(start);
173
+ time = Math.floor(start / (scope.project.fps.num / scope.project.fps.den));
174
+ while (time <= end) {
175
+ console.log("TIME: " + time);
176
+ console.log("start: " + start);
177
+ console.log("end: " + end);
178
+ pos = time * scope.project.pixelsPerSecond;
179
+
180
+ ruler_mark = $('<span style="left: ' + pos + 'px;">');
181
+ ruler_mark.addClass("tick_mark");
182
+ time_display = $('<span style="left: ' + pos + 'px;">');
183
+ time_display.addClass("ruler_time");
184
+
185
+ var text_time = secondsToTime(time, scope.project.fps.num, scope.project.fps.den);
186
+ time_display[0].innerText = text_time["hour"] + ":" + text_time["min"] + ":" + text_time["sec"];
187
+ if (scope.project.scale < 1) {
188
+ time_display[0].innerText += ',' + text_time['frame'];
189
+ }
190
+
191
+ ruler.append(ruler_mark);
192
+ ruler.append(time_display);
193
+ time += 1;
194
+ }
195
+
196
+ }*/
197
+
198
+ function drawTimesHighZoom ( ) {
199
+ zoomLevels = [
200
+ {
201
+ // Mark every 10 frames
202
+ 'zoom' : 0.2724177071509648 ,
203
+ 'mark_every' : 10
204
+ } ,
205
+ {
206
+ // Mark every 10 frames
207
+ 'zoom' : 0.1743473325766175 ,
208
+ 'mark_every' : 5
209
+ } ,
210
+ ] ;
211
+
212
+ ruler = $ ( "#ruler" ) ;
213
+ ruler . addClass ( 'no_bg' )
214
+ width = $ ( "body" ) . width ( ) ;
215
+ // Clear all current tick marks
216
+ $ ( "#ruler span" ) . remove ( ) ;
217
+
218
+ start = Math . max ( 0 , scope . scrollLeft - width ) ;
219
+ end = scope . scrollLeft + ( 2 * width ) ;
220
+
221
+ console . log ( "SCALE: " + scope . project . scale ) ;
222
+ console . log ( "start: " + start ) ;
223
+ console . log ( "end: " + end ) ;
224
+
225
+
226
+ let tall = false ;
227
+ // frame = start;
228
+ time = start / ( scope . project . fps . num / scope . project . fps . den ) ;
229
+ pos = Math . floor ( time * scope . pixelsPerSecond ) ;
230
+ while ( pos < end ) {
231
+ // for (var i = 1; i < 100; i++) {
232
+ ruler_mark = $ ( '<span style="left: ' + pos + 'px;">' ) ;
233
+ ruler_mark . addClass ( "tick_mark" ) ;
234
+ time_display = $ ( '<span style="left: ' + pos + 'px;">' ) ;
235
+ time_display . addClass ( "ruler_time" ) ;
236
+
237
+ if ( tall ) {
238
+ ruler_mark . css ( "height" , 14 ) ;
239
+ tall = false
240
+ } else {
241
+ tall = true ;
242
+ }
243
+
244
+ /* Calculate Time */
245
+ var text_time = secondsToTime ( time , scope . project . fps . num , scope . project . fps . den ) ;
246
+ time_display [ 0 ] . innerText = text_time [ "hour" ] + ":" + text_time [ "min" ] + ":" + text_time [ "sec" ] ;
247
+ if ( scope . project . scale < 1 ) {
248
+ time_display [ 0 ] . innerText += ',' + text_time [ 'frame' ] ;
249
+ }
250
+
251
+ ruler . append ( ruler_mark ) ;
252
+ ruler . append ( time_display ) ;
253
+
254
+ frame += ( scope . project . fps . num / scope . project . fps . den )
255
+ time = start / ( scope . project . fps . num / scope . project . fps . den ) ;
256
+ pos = Math . floor ( time * scope . pixelsPerSecond ) ;
257
+ }
258
+ return ;
259
+ }
260
+
163
261
drawTimes = ( ) => {
262
+ // if (scope.project.scale < 0.340522133938706) {
263
+ if ( true ) {
264
+ drawTimesHighZoom ( ) ;
265
+ return ;
266
+ }
164
267
ruler = $ ( "#ruler" ) ;
268
+ if ( ruler [ 0 ] . className . includes ( 'no_bg' ) ) { ruler . removeClass ( 'no_bg' ) }
165
269
width = $ ( "body" ) . width ( ) ;
166
270
$ ( "#ruler span" ) . remove ( ) ;
167
271
start = Math . max ( scope . scrollLeft - width , 100 ) ;
168
272
end = Math . min ( scope . scrollLeft + ( 2 * width ) , $ ( '#ruler' ) . width ( ) ) ;
169
273
170
274
scale = scope . project . scale ;
171
275
172
-
173
276
for ( var i = start - ( start % 100 ) ; i < end ; i += 100 ) {
174
277
/* create and format span */
175
278
s = $ ( '<span style="left: ' + i + 'px;">' ) ;
0 commit comments