@@ -290,9 +290,8 @@ define(function (require, exports, module) {
290
290
* @param {Event } e Mouse move event
291
291
* @param {number } x New horizontal position
292
292
* @param {number } y New vertical position
293
- * @param {left: number, top: number, width: number, height: number } curveBoundingBox
294
293
*/
295
- function handlePointMove ( e , x , y , curveBoundingBox ) {
294
+ function handlePointMove ( e , x , y ) {
296
295
var self = e . target ,
297
296
bezierEditor = self . bezierEditor ;
298
297
@@ -323,7 +322,7 @@ define(function (require, exports, module) {
323
322
// Constrain time (x-axis) to 0 to 1 range. Progression (y-axis) is
324
323
// theoretically not constrained, although canvas to drawing curve is
325
324
// arbitrarily constrained to -0.5 to 1.5 range.
326
- x = Math . min ( Math . max ( 0 , x ) , curveBoundingBox . width ) ;
325
+ x = Math . min ( Math . max ( 0 , x ) , WIDTH_MAIN ) ;
327
326
328
327
if ( bezierEditor . dragElement ) {
329
328
$ ( bezierEditor . dragElement ) . css ( {
@@ -348,13 +347,10 @@ define(function (require, exports, module) {
348
347
* @param {Element } canvas <canvas> element
349
348
* @param {number } x Horizontal position
350
349
* @param {number } y Vertical position
351
- * @param {left: number, top: number, width: number, height: number } curveBoundingBox
352
350
*/
353
- function updateTimeProgression ( curve , x , y , curveBoundingBox ) {
354
- var height = curveBoundingBox . height ;
355
-
356
- curve . parentNode . setAttribute ( "data-time" , Math . round ( 100 * x / curveBoundingBox . width ) ) ;
357
- curve . parentNode . setAttribute ( "data-progression" , Math . round ( 100 * ( 3 * height / 4 - y ) / ( height * 0.5 ) - 50 ) ) ;
351
+ function updateTimeProgression ( curve , x , y ) {
352
+ curve . parentNode . setAttribute ( "data-time" , Math . round ( 100 * x / WIDTH_MAIN ) ) ;
353
+ curve . parentNode . setAttribute ( "data-progression" , Math . round ( 100 * ( ( HEIGHT_MAIN - y ) / HEIGHT_MAIN ) ) ) ;
358
354
}
359
355
360
356
/**
@@ -371,14 +367,14 @@ define(function (require, exports, module) {
371
367
x = e . pageX - left ,
372
368
y = e . pageY - top - HEIGHT_ABOVE ;
373
369
374
- updateTimeProgression ( self , x , y , curveBoundingBox ) ;
370
+ updateTimeProgression ( self , x , y ) ;
375
371
376
372
if ( bezierEditor . dragElement ) {
377
373
if ( e . pageX === 0 && e . pageY === 0 ) {
378
374
return ;
379
375
}
380
376
381
- handlePointMove ( e , x , y , curveBoundingBox ) ;
377
+ handlePointMove ( e , x , y ) ;
382
378
}
383
379
}
384
380
@@ -396,13 +392,13 @@ define(function (require, exports, module) {
396
392
x = e . pageX - left ,
397
393
y = e . pageY - top - HEIGHT_ABOVE ;
398
394
399
- updateTimeProgression ( bezierEditor . curve , x , y , curveBoundingBox ) ;
395
+ updateTimeProgression ( bezierEditor . curve , x , y ) ;
400
396
401
397
if ( e . pageX === 0 && e . pageY === 0 ) {
402
398
return ;
403
399
}
404
400
405
- handlePointMove ( e , x , y , curveBoundingBox ) ;
401
+ handlePointMove ( e , x , y ) ;
406
402
}
407
403
408
404
/**
@@ -450,7 +446,7 @@ define(function (require, exports, module) {
450
446
var $this = $ ( e . target ) ,
451
447
left = parseInt ( $this . css ( "left" ) , 10 ) ,
452
448
top = parseInt ( $this . css ( "top" ) , 10 ) ,
453
- offset = ( e . shiftKey ? 20 : 2 ) ,
449
+ offset = ( e . shiftKey ? 15 : 3 ) ,
454
450
newVal ;
455
451
456
452
switch ( code ) {
@@ -527,16 +523,16 @@ define(function (require, exports, module) {
527
523
// redraw canvas
528
524
this . _updateCanvas ( ) ;
529
525
530
- this . curve . addEventListener ( "click" , _curveClick , false ) ;
531
- this . curve . addEventListener ( "mousemove" , _curveMouseMove , false ) ;
532
- this . P1 . addEventListener ( "mousemove" , _pointMouseMove , false ) ;
533
- this . P2 . addEventListener ( "mousemove" , _pointMouseMove , false ) ;
534
- this . P1 . addEventListener ( "mousedown" , _pointMouseDown , false ) ;
535
- this . P2 . addEventListener ( "mousedown" , _pointMouseDown , false ) ;
536
- this . P1 . addEventListener ( "mouseup" , _pointMouseUp , false ) ;
537
- this . P2 . addEventListener ( "mouseup" , _pointMouseUp , false ) ;
538
- this . P1 . addEventListener ( "keydown" , _pointKeyDown , false ) ;
539
- this . P2 . addEventListener ( "keydown" , _pointKeyDown , false ) ;
526
+ $ ( this . curve ) . on ( "click" , _curveClick ) ;
527
+ $ ( this . curve ) . on ( "mousemove" , _curveMouseMove ) ;
528
+ $ ( this . P1 ) . on ( "mousemove" , _pointMouseMove ) ;
529
+ $ ( this . P2 ) . on ( "mousemove" , _pointMouseMove ) ;
530
+ $ ( this . P1 ) . on ( "mousedown" , _pointMouseDown ) ;
531
+ $ ( this . P2 ) . on ( "mousedown" , _pointMouseDown ) ;
532
+ $ ( this . P1 ) . on ( "mouseup" , _pointMouseUp ) ;
533
+ $ ( this . P2 ) . on ( "mouseup" , _pointMouseUp ) ;
534
+ $ ( this . P1 ) . on ( "keydown" , _pointKeyDown ) ;
535
+ $ ( this . P2 ) . on ( "keydown" , _pointKeyDown ) ;
540
536
}
541
537
542
538
/**
@@ -546,16 +542,16 @@ define(function (require, exports, module) {
546
542
547
543
this . P1 . bezierEditor = this . P2 . bezierEditor = this . curve . bezierEditor = null ;
548
544
549
- this . curve . removeEventListener ( "click" , _curveClick , false ) ;
550
- this . curve . removeEventListener ( "mousemove" , _curveMouseMove , false ) ;
551
- this . P1 . removeEventListener ( "mousemove" , _pointMouseMove , false ) ;
552
- this . P2 . removeEventListener ( "mousemove" , _pointMouseMove , false ) ;
553
- this . P1 . removeEventListener ( "mousedown" , _pointMouseDown , false ) ;
554
- this . P2 . removeEventListener ( "mousedown" , _pointMouseDown , false ) ;
555
- this . P1 . removeEventListener ( "mouseup" , _pointMouseUp , false ) ;
556
- this . P2 . removeEventListener ( "mouseup" , _pointMouseUp , false ) ;
557
- this . P1 . removeEventListener ( "keydown" , _pointKeyDown , false ) ;
558
- this . P2 . removeEventListener ( "keydown" , _pointKeyDown , false ) ;
545
+ $ ( this . curve ) . off ( "click" , _curveClick ) ;
546
+ $ ( this . curve ) . off ( "mousemove" , _curveMouseMove ) ;
547
+ $ ( this . P1 ) . off ( "mousemove" , _pointMouseMove ) ;
548
+ $ ( this . P2 ) . off ( "mousemove" , _pointMouseMove ) ;
549
+ $ ( this . P1 ) . off ( "mousedown" , _pointMouseDown ) ;
550
+ $ ( this . P2 ) . off ( "mousedown" , _pointMouseDown ) ;
551
+ $ ( this . P1 ) . off ( "mouseup" , _pointMouseUp ) ;
552
+ $ ( this . P2 ) . off ( "mouseup" , _pointMouseUp ) ;
553
+ $ ( this . P1 ) . off ( "keydown" , _pointKeyDown ) ;
554
+ $ ( this . P2 ) . off ( "keydown" , _pointKeyDown ) ;
559
555
} ;
560
556
561
557
@@ -611,20 +607,20 @@ define(function (require, exports, module) {
611
607
// handle special cases of cubic-bezier calls
612
608
switch ( match [ 0 ] ) {
613
609
case "linear" :
614
- return [ 0 , 0 , 1 , 1 ] ;
610
+ return [ "0" , "0" , "1" , "1" ] ;
615
611
case "ease" :
616
- return [ 0 .25, 0.1 , 0 .25, 1 ] ;
612
+ return [ " .25" , ".1" , " .25" , "1" ] ;
617
613
case "ease-in" :
618
- return [ 0 .42, 0 , 1 , 1 ] ;
614
+ return [ " .42" , "0" , "1" , "1" ] ;
619
615
case "ease-out" :
620
- return [ 0 , 0 , 0 .58, 1 ] ;
616
+ return [ "0" , "0" , " .58" , "1" ] ;
621
617
case "ease-in-out" :
622
- return [ 0 .42, 0 , 0 .58, 1 ] ;
618
+ return [ " .42" , "0" , " .58" , "1" ] ;
623
619
}
624
620
}
625
621
626
622
window . console . log ( "brackets-cubic-bezier: getCubicBezierCoords() passed invalid RegExp match array" ) ;
627
- return [ 0 , 0 , 0 , 0 ] ;
623
+ return [ "0" , "0" , "0" , "0" ] ;
628
624
} ;
629
625
630
626
/**
0 commit comments