@@ -123,6 +123,7 @@ export default class Timeline extends React.Component {
123
123
this . updateDimensions = this . updateDimensions . bind ( this ) ;
124
124
this . grid_ref_callback = this . grid_ref_callback . bind ( this ) ;
125
125
this . select_ref_callback = this . select_ref_callback . bind ( this ) ;
126
+ this . throttledMouseMoveFunc = _ . throttle ( this . throttledMouseMoveFunc . bind ( this ) , 20 ) ;
126
127
this . mouseMoveFunc = this . mouseMoveFunc . bind ( this ) ;
127
128
this . getCursor = this . getCursor . bind ( this ) ;
128
129
@@ -135,6 +136,7 @@ export default class Timeline extends React.Component {
135
136
componentDidMount ( ) {
136
137
window . addEventListener ( 'resize' , this . updateDimensions ) ;
137
138
}
139
+
138
140
componentWillReceiveProps ( nextProps ) {
139
141
this . setTimeMap ( nextProps . items , nextProps . startDate , nextProps . endDate ) ;
140
142
// @TODO
@@ -290,7 +292,11 @@ export default class Timeline extends React.Component {
290
292
if ( canDrag ) {
291
293
this . _itemInteractable
292
294
. draggable ( {
293
- enabled : true
295
+ enabled : true ,
296
+ restrict : {
297
+ restriction : `.${ topDivClassId } ` ,
298
+ elementRect : { left : 0 , right : 1 , top : 0 , bottom : 1 }
299
+ }
294
300
} )
295
301
. on ( 'dragstart' , e => {
296
302
let selections = [ ] ;
@@ -729,7 +735,7 @@ export default class Timeline extends React.Component {
729
735
* Event handler for onMouseMove.
730
736
* Only calls back if a new snap time is reached
731
737
*/
732
- mouseMoveFunc ( e ) {
738
+ throttledMouseMoveFunc ( e ) {
733
739
const { componentId} = this . props ;
734
740
const leftOffset = document . querySelector ( `.rct9k-id-${ componentId } .parent-div` ) . getBoundingClientRect ( ) . left ;
735
741
const cursorSnappedTime = getTimeAtPixel (
@@ -753,6 +759,11 @@ export default class Timeline extends React.Component {
753
759
}
754
760
}
755
761
762
+ mouseMoveFunc ( e ) {
763
+ e . persist ( ) ;
764
+ this . throttledMouseMoveFunc ( e ) ;
765
+ }
766
+
756
767
render ( ) {
757
768
const { onInteraction, groupOffset, timebarFormat, componentId, groupTitleRenderer} = this . props ;
758
769
0 commit comments