File tree Expand file tree Collapse file tree 1 file changed +47
-1
lines changed Expand file tree Collapse file tree 1 file changed +47
-1
lines changed Original file line number Diff line number Diff line change 370
370
s . change ( s . _validate ( v ) ) ;
371
371
s . _draw ( ) ;
372
372
} ;
373
-
373
+
374
+ if ( ! s . bounds ( e ) )
375
+ {
376
+ s . _propagate ( e ) ;
377
+ return ;
378
+ }
374
379
// First click
375
380
mouseMove ( e ) ;
376
381
// scrubbing has started
476
481
var val = ( ~ ~ ( ( ( v < 0 ) ? - 0.5 : 0.5 ) + ( v / this . o . step ) ) ) * this . o . step ;
477
482
return Math . round ( val * 100 ) / 100 ;
478
483
} ;
484
+
485
+ // propagate event to element underneath
486
+ this . _propagate = function ( e )
487
+ {
488
+ s . $div . css ( "pointer-events" , "none" ) ;
489
+ var ne = jQuery . Event ( e . type , { which :1 , pageX : e . pageX , pageY : e . pageY } ) ;
490
+ var nt = document . elementFromPoint ( e . pageX , e . pageY ) ;
491
+ $ ( nt ) . trigger ( ne ) ;
492
+ s . $div . css ( "pointer-events" , "auto" ) ;
493
+ }
479
494
480
495
// Abstract methods
481
496
this . listen = function ( ) { } ; // on start, one time
815
830
c . stroke ( ) ;
816
831
} ;
817
832
833
+ this . bounds = function ( e )
834
+ {
835
+ if ( e . type == "mousedown" )
836
+ {
837
+ var x = e . pageX ;
838
+ var y = e . pageY ;
839
+ }
840
+ if ( e . type == "touchstart" )
841
+ {
842
+ var touch = e . originalEvent . touches [ 0 ] ;
843
+ var x = touch . pageX ;
844
+ var y = touch . pageY ;
845
+ }
846
+
847
+ /*
848
+ TODO: fix issues with this.xy and this.radius
849
+ seeming incorrect when emulating mobile devices
850
+ */
851
+ var ox = x - this . x - this . xy ;
852
+ var oy = y - this . y - this . xy ;
853
+
854
+ if ( Math . sqrt ( ( ox * ox ) + ( oy * oy ) ) < this . xy )
855
+ {
856
+ return true ;
857
+ }
858
+ else
859
+ {
860
+ return false ;
861
+ }
862
+ }
863
+
818
864
this . cancel = function ( ) {
819
865
this . val ( this . v ) ;
820
866
} ;
You can’t perform that action at this time.
0 commit comments