@@ -80,10 +80,11 @@ App.directive("tlScrollableTracks", function () {
80
80
if ( is_scrolling ) {
81
81
// Calculate difference from last position
82
82
var difference = { x : starting_mouse_position . x - e . pageX , y : starting_mouse_position . y - e . pageY } ;
83
+ var newPos = { x : starting_scrollbar . x + difference . x , y : starting_scrollbar . y + difference . y } ;
83
84
84
85
// Scroll the tracks div
85
- element . scrollLeft ( starting_scrollbar . x + difference . x ) ;
86
- element . scrollTop ( starting_scrollbar . y + difference . y ) ;
86
+ element . scrollLeft ( newPos . x ) ;
87
+ element . scrollTop ( newPos . y ) ;
87
88
}
88
89
} ) ;
89
90
@@ -119,7 +120,7 @@ App.directive("tlBody", function () {
119
120
if ( e . which === 2 ) { // middle button
120
121
e . preventDefault ( ) ;
121
122
is_scrolling = true ;
122
- starting_scrollbar = { x : element . scrollLeft ( ) , y : element . scrollTop ( ) } ;
123
+ starting_scrollbar = { x : $ ( '#scrolling_tracks' ) . scrollLeft ( ) , y : $ ( '#scrolling_tracks' ) . scrollTop ( ) } ;
123
124
starting_mouse_position = { x : e . pageX , y : e . pageY } ;
124
125
element . addClass ( "drag_cursor" ) ;
125
126
}
@@ -198,24 +199,30 @@ App.directive("tlRuler", function ($timeout) {
198
199
199
200
startPos = scope . scrollLeft ;
200
201
endPos = scope . scrollLeft + $ ( "body" ) . width ( ) ;
201
-
202
+ fpt = framesPerTick ( scope . pixelsPerSecond , scope . project . fps . num , scope . project . fps . den ) ;
202
203
fps = scope . project . fps . num / scope . project . fps . den ;
203
204
time = [ startPos / scope . pixelsPerSecond , endPos / scope . pixelsPerSecond ] ;
204
- time [ 0 ] -= time [ 0 ] % 2 ;
205
+
206
+ if ( fpt > fps ) {
207
+ // Make sure seconds don't change when scrolling right and left
208
+ time [ 0 ] -= time [ 0 ] % ( fpt / Math . round ( fps ) ) ;
209
+ }
210
+ else {
211
+ time [ 0 ] -= time [ 0 ] % 2 ;
212
+ }
205
213
time [ 1 ] -= time [ 1 ] % 1 - 1 ;
206
214
207
215
startFrame = time [ 0 ] * Math . round ( fps ) ;
208
216
endFrame = time [ 1 ] * Math . round ( fps ) ;
209
217
210
- fpt = framesPerTick ( scope . pixelsPerSecond , scope . project . fps . num , scope . project . fps . den ) ;
211
218
frame = startFrame ;
212
219
while ( frame <= endFrame ) {
213
220
t = frame / fps ;
214
221
pos = t * scope . pixelsPerSecond ;
215
222
tickSpan = $ ( '<span style="left:' + pos + 'px;"></span>' ) ;
216
223
tickSpan . addClass ( "tick_mark" ) ;
217
224
218
- if ( ( frame - startFrame ) % ( fpt * 2 ) == 0 ) {
225
+ if ( ( frame ) % ( fpt * 2 ) == 0 ) {
219
226
// Alternating long marks with times marked
220
227
timeSpan = $ ( '<span style="left:' + pos + 'px;"></span>' ) ;
221
228
timeSpan . addClass ( "ruler_time" ) ;
0 commit comments