@domoinc/multiline-chart
Version:
MultiLineChart - Domo Widget
27 lines (26 loc) • 657 B
JavaScript
/**
* This will return the appropriate event for the device type.
* @param {string} eventType The event you want for desktop.
* @return {string} The event tranlated for your device.
*/
d3.hover = function (eventType) {
if ( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
d3.select('html').style({
'-webkit-touch-callout': 'none',
'-webkit-user-select': 'none'
});
switch (eventType) {
case 'mouseover':
return 'touchstart';
break;
case 'mouseout':
return 'touchend';
break;
default:
return eventType;
break;
}
} else {
return eventType;
}
};