@@ -264,44 +264,55 @@ class TimelineRulerAndSelection extends React.PureComponent<Props> {
264264 this . props . changeMouseTimePosition ( null ) ;
265265 } ;
266266
267- _makeOnMove =
268- ( fun : ( dx : number ) => { startDelta : number ; endDelta : number } ) =>
269- (
270- originalSelection : {
271- readonly selectionStart : number ;
272- readonly selectionEnd : number ;
273- } ,
267+ _makeOnMove = (
268+ fun : ( dx : number ) => { startDelta : number ; endDelta : number }
269+ ) => {
270+ return (
271+ originalSelection : PreviewSelection ,
274272 dx : number ,
275- dy : number ,
273+ _dy : number ,
276274 isModifying : boolean
277275 ) => {
278- const { committedRange, width, updatePreviewSelection } = this . props ;
279- const delta = ( dx / width ) * ( committedRange . end - committedRange . start ) ;
280- const selectionDeltas = fun ( delta ) ;
281- let selectionStart = clamp (
282- originalSelection . selectionStart + selectionDeltas . startDelta ,
283- committedRange . start ,
284- committedRange . end
285- ) ;
286- let selectionEnd = clamp (
287- originalSelection . selectionEnd + selectionDeltas . endDelta ,
288- committedRange . start ,
289- committedRange . end
290- ) ;
291- let draggingStart = isModifying && ! ! selectionDeltas . startDelta ;
292- let draggingEnd = isModifying && ! ! selectionDeltas . endDelta ;
293- if ( selectionStart > selectionEnd ) {
294- [ selectionStart , selectionEnd ] = [ selectionEnd , selectionStart ] ;
295- [ draggingStart , draggingEnd ] = [ draggingEnd , draggingStart ] ;
296- }
297- updatePreviewSelection ( {
298- isModifying,
299- selectionStart,
300- selectionEnd,
301- draggingStart,
302- draggingEnd,
303- } ) ;
276+ this . _onMove ( originalSelection , fun , dx , isModifying ) ;
304277 } ;
278+ } ;
279+
280+ _onMove (
281+ originalSelection : PreviewSelection ,
282+ selectionDeltasForDx : ( dx : number ) => {
283+ startDelta : number ;
284+ endDelta : number ;
285+ } ,
286+ dx : number ,
287+ isModifying : boolean
288+ ) {
289+ const { committedRange, width, updatePreviewSelection } = this . props ;
290+ const delta = ( dx / width ) * ( committedRange . end - committedRange . start ) ;
291+ const selectionDeltas = selectionDeltasForDx ( delta ) ;
292+ let selectionStart = clamp (
293+ originalSelection . selectionStart + selectionDeltas . startDelta ,
294+ committedRange . start ,
295+ committedRange . end
296+ ) ;
297+ let selectionEnd = clamp (
298+ originalSelection . selectionEnd + selectionDeltas . endDelta ,
299+ committedRange . start ,
300+ committedRange . end
301+ ) ;
302+ let draggingStart = isModifying && ! ! selectionDeltas . startDelta ;
303+ let draggingEnd = isModifying && ! ! selectionDeltas . endDelta ;
304+ if ( selectionStart > selectionEnd ) {
305+ [ selectionStart , selectionEnd ] = [ selectionEnd , selectionStart ] ;
306+ [ draggingStart , draggingEnd ] = [ draggingEnd , draggingStart ] ;
307+ }
308+ updatePreviewSelection ( {
309+ isModifying,
310+ selectionStart,
311+ selectionEnd,
312+ draggingStart,
313+ draggingEnd,
314+ } ) ;
315+ }
305316
306317 _rangeStartOnMove = this . _makeOnMove ( ( delta ) => ( {
307318 startDelta : delta ,
0 commit comments