@@ -163,7 +163,7 @@ App.directive("tlRuler", function ($timeout) {
163
163
/**
164
164
*
165
165
*/
166
- function drawTimesHighZoom ( ) {
166
+ function drawTimes ( ) {
167
167
// Delete old tick marks
168
168
ruler = $ ( '#ruler' ) ;
169
169
ruler . addClass ( 'no_bg' ) ;
@@ -178,27 +178,23 @@ App.directive("tlRuler", function ($timeout) {
178
178
time [ 0 ] -= time [ 0 ] % 1 ;
179
179
time [ 1 ] -= time [ 1 ] % 1 - 1 ;
180
180
181
+ startFrame = time [ 0 ] * Math . round ( fps ) ;
182
+ endFrame = time [ 1 ] * Math . round ( fps ) ;
183
+
181
184
t = time [ 0 ] ;
182
185
let tPrev ;
183
186
showTime = true ;
184
187
185
188
// timePerTick = framesPerTick(scope.pixelsPerSecond, scope.project.fps.num ,scope.project.fps.num) / fps;
186
189
// console.log('FPT: ' + framesPerTick(scope.pixelsPerSecond, scope.project.fps.num ,scope.project.fps.num));
187
- dF = 1 ;
188
- dT = ( ) => { return dF / fps } ;
189
- dP = ( ) => { return dT ( ) * scope . pixelsPerSecond } ;
190
- while ( dP ( ) < 50 ) {
191
- dF *= 2 ;
192
- }
193
- timePerTick = dT ( ) ;
194
190
fpt = framesPerTick ( scope . pixelsPerSecond , scope . project . fps . num , scope . project . fps . den )
195
- timePerTick = fpt / fps ;
196
- while ( t <= time [ 1 ] ) {
197
- if ( Math . floor ( t ) != Math . floor ( tPrev ) ) {
198
- // In the case that FPS is not a whole number.
199
- // Every new second, make sure we start ON the second.
200
- t = Math . floor ( t ) ;
201
- }
191
+ frame = startFrame
192
+ console . log ( "Start: " + startFrame )
193
+ console . log ( "End : " + endFrame )
194
+ console . log ( "FPT : " + fpt )
195
+ console . log ( " start Time : " + time [ 0 ] )
196
+ while ( frame <= endFrame ) {
197
+ t = frame / fps ;
202
198
pos = t * scope . pixelsPerSecond ;
203
199
tickSpan = $ ( '<span style="left:' + pos + 'px;"></span>' ) ;
204
200
tickSpan . addClass ( "tick_mark" ) ;
@@ -209,8 +205,11 @@ App.directive("tlRuler", function ($timeout) {
209
205
timeText = secondsToTime ( t , scope . project . fps . num , scope . project . fps . den ) ;
210
206
timeSpan [ 0 ] . innerText = timeText [ 'hour' ] + ':' +
211
207
timeText [ 'min' ] + ':' +
212
- timeText [ 'sec' ] + ',' +
213
- timeText [ 'frame' ] ;
208
+ timeText [ 'sec' ] ;
209
+ if ( fpt < Math . round ( fps ) ) {
210
+ timeSpan [ 0 ] . innerText += ',' + timeText [ 'frame' ] ;
211
+ }
212
+ // timeText['frame'];
214
213
tickSpan [ 0 ] . style [ 'height' ] = '20px' ;
215
214
showTime = false ;
216
215
} else {
@@ -219,44 +218,11 @@ App.directive("tlRuler", function ($timeout) {
219
218
ruler . append ( timeSpan ) ;
220
219
ruler . append ( tickSpan ) ;
221
220
222
- tPrev = t ;
223
- t += timePerTick ;
221
+ frame += fpt ;
224
222
}
225
223
return ;
226
224
}
227
225
228
- drawTimes = ( ) => {
229
- /*scope.project.scale < 0.340522133938706*/
230
- if ( scope . project . scale < 1 ) {
231
- drawTimesHighZoom ( ) ;
232
- return ;
233
- }
234
- ruler = $ ( "#ruler" ) ;
235
- if ( ruler [ 0 ] . className . includes ( 'no_bg' ) ) { ruler . removeClass ( 'no_bg' ) }
236
- width = $ ( "body" ) . width ( ) ;
237
- $ ( "#ruler span" ) . remove ( ) ;
238
- start = Math . max ( scope . scrollLeft - width , 100 ) ;
239
- end = Math . min ( scope . scrollLeft + ( 2 * width ) , $ ( '#ruler' ) . width ( ) ) ;
240
-
241
- scale = scope . project . scale ;
242
-
243
- for ( var i = start - ( start % 100 ) ; i < end ; i += 100 ) {
244
- /* create and format span */
245
- s = $ ( '<span style="left: ' + i + 'px;">' ) ;
246
- s . addClass ( "ruler_time" ) ;
247
-
248
- /* Calculate Time */
249
- var time = i / scope . pixelsPerSecond ;
250
- var text_time = secondsToTime ( time , scope . project . fps . num , scope . project . fps . den ) ;
251
- s [ 0 ] . innerText = text_time [ "hour" ] + ":" + text_time [ "min" ] + ":" + text_time [ "sec" ] ;
252
- if ( scope . project . scale < 1 ) {
253
- s [ 0 ] . innerText += ',' + text_time [ 'frame' ] ;
254
- }
255
-
256
- ruler . append ( s ) ;
257
- }
258
- }
259
-
260
226
scope . $watch ( "project.scale + project.duration + scrollLeft" , function ( val ) {
261
227
if ( val ) {
262
228
$timeout ( function ( ) {
0 commit comments