MCPcopy
hub / github.com/tdewolff/minify / normalizeEvent

Function normalizeEvent

_benchmarks/sample_echarts.js:1255–1278  ·  view source on GitHub ↗
(el, e, calculate)

Source from the content-addressed store, hash-verified

1253 || window.event;
1254 }
1255 function normalizeEvent(el, e, calculate) {
1256 e = getNativeEvent(e);
1257 if (e.zrX != null) {
1258 return e;
1259 }
1260 var eventType = e.type;
1261 var isTouch = eventType && eventType.indexOf('touch') >= 0;
1262 if (!isTouch) {
1263 clientToLocal(el, e, e, calculate);
1264 var wheelDelta = getWheelDeltaMayPolyfill(e);
1265 e.zrDelta = wheelDelta ? wheelDelta / 120 : -(e.detail || 0) / 3;
1266 }
1267 else {
1268 var touch = eventType !== 'touchend'
1269 ? e.targetTouches[0]
1270 : e.changedTouches[0];
1271 touch && clientToLocal(el, touch, e, calculate);
1272 }
1273 var button = e.button;
1274 if (e.which == null && button !== undefined && MOUSE_EVENT_REG.test(e.type)) {
1275 e.which = (button & 1 ? 1 : (button & 2 ? 3 : (button & 4 ? 2 : 0)));
1276 }
1277 return e;
1278 }
1279 function getWheelDeltaMayPolyfill(e) {
1280 var rawWheelDelta = e.wheelDelta;
1281 if (rawWheelDelta) {

Callers 3

normalizeGlobalEventFunction · 0.85
sample_echarts.jsFile · 0.85
TooltipHTMLContentFunction · 0.85

Calls 3

getNativeEventFunction · 0.85
clientToLocalFunction · 0.85
getWheelDeltaMayPolyfillFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…