@@ -416,6 +416,7 @@ var cxtmenu = function cxtmenu(params) {
416
416
var panEnabled = void 0 ;
417
417
var boxEnabled = void 0 ;
418
418
var gestureStartEvent = void 0 ;
419
+ var hoverOn = void 0 ;
419
420
420
421
var restoreZoom = function restoreZoom ( ) {
421
422
if ( zoomEnabled ) {
@@ -626,7 +627,17 @@ var cxtmenu = function cxtmenu(params) {
626
627
theta2 += dtheta ;
627
628
}
628
629
queueDrawCommands ( rx , ry , r , theta , rs ) ;
629
- } ) . on ( 'tapdrag' , dragHandler ) . on ( 'cxttapend tapend' , function ( ) {
630
+ } ) . on ( 'tapdrag' , dragHandler ) . on ( 'mousemove' , function ( ) {
631
+ if ( activeCommandI !== undefined ) {
632
+ var hovered = commands [ activeCommandI ] . hover ;
633
+ if ( hovered ) {
634
+ if ( hoverOn !== activeCommandI ) {
635
+ hovered . apply ( target , [ target , gestureStartEvent ] ) ;
636
+ }
637
+ hoverOn = activeCommandI ;
638
+ }
639
+ }
640
+ } ) . on ( 'cxttapend tapend' , function ( ) {
630
641
parent . style . display = 'none' ;
631
642
if ( activeCommandI !== undefined ) {
632
643
var select = commands [ activeCommandI ] . select ;
@@ -637,6 +648,8 @@ var cxtmenu = function cxtmenu(params) {
637
648
}
638
649
}
639
650
651
+ hoverOn = undefined ;
652
+
640
653
inGesture = false ;
641
654
642
655
restoreGestures ( ) ;
@@ -721,6 +734,9 @@ var defaults = {
721
734
fillColor: 'rgba(200, 200, 200, 0.75)', // optional: custom background color for item
722
735
content: 'a command name' // html/text content to be displayed in the menu
723
736
contentStyle: {}, // css key:value pairs to set the command's css in js if you want
737
+ hover: function(ele){ // a function to execute when the command is hovered
738
+ console.log( ele.id() ) // `ele` holds the reference to the active element
739
+ },
724
740
select: function(ele){ // a function to execute when the command is selected
725
741
console.log( ele.id() ) // `ele` holds the reference to the active element
726
742
},
0 commit comments