@@ -71,17 +71,6 @@ App.directive("tlScrollableTracks", function () {
71
71
72
72
} ) ;
73
73
74
- // Initialize panning when middle mouse is clicked
75
- element . on ( "mousedown" , function ( e ) {
76
- if ( e . which === 2 ) { // middle button
77
- e . preventDefault ( ) ;
78
- is_scrolling = true ;
79
- starting_scrollbar = { x : element . scrollLeft ( ) , y : element . scrollTop ( ) } ;
80
- starting_mouse_position = { x : e . pageX , y : e . pageY } ;
81
- element . addClass ( "drag_cursor" ) ;
82
- }
83
- } ) ;
84
-
85
74
// Pans the timeline (on middle mouse clip and drag)
86
75
element . on ( "mousemove" , function ( e ) {
87
76
if ( is_scrolling ) {
@@ -112,6 +101,24 @@ App.directive("tlBody", function () {
112
101
element . on ( "mouseup" , function ( e ) {
113
102
if ( e . which === 2 ) { // middle button
114
103
is_scrolling = false ;
104
+ element . removeClass ( "drag_cursor" ) ;
105
+ }
106
+ } ) ;
107
+
108
+ // Stop scrolling if mouse leaves timeline
109
+ element . on ( "mouseleave" , function ( e ) {
110
+ is_scrolling = false ;
111
+ element . removeClass ( "drag_cursor" ) ;
112
+ } )
113
+
114
+ // Initialize panning when middle mouse is clicked
115
+ element . on ( "mousedown" , function ( e ) {
116
+ if ( e . which === 2 ) { // middle button
117
+ e . preventDefault ( ) ;
118
+ is_scrolling = true ;
119
+ starting_scrollbar = { x : element . scrollLeft ( ) , y : element . scrollTop ( ) } ;
120
+ starting_mouse_position = { x : e . pageX , y : e . pageY } ;
121
+ element . addClass ( "drag_cursor" ) ;
115
122
}
116
123
} ) ;
117
124
0 commit comments