Remove passive event listener check

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
This commit is contained in:
Maurício Meneghini Fauth 2022-03-20 20:06:50 -03:00
parent fe03632dce
commit fd1839246b
2 changed files with 3 additions and 33 deletions

View File

@ -2,8 +2,6 @@
* Functions used in configuration forms and on user preferences pages
*/
/* exported PASSIVE_EVENT_LISTENERS */
var configInlineParams;
var configScriptLoaded;
@ -841,23 +839,3 @@ function offerPrefsAutoimport () {
});
$cnt.show();
}
/**
* @type {boolean} Support for passive event listener option
*/
var PASSIVE_EVENT_LISTENERS = (function () {
var passive = false;
try {
var options = Object.defineProperty({}, 'passive', {
get: function () {
return (passive = true);
},
});
window.addEventListener('_', null, options);
window.removeEventListener('_', null, options);
} catch (error) {
// passive not supported
}
return passive;
}());

View File

@ -6,7 +6,7 @@
* @requires vendor/jquery/jquery.mousewheel.js
*/
/* global drawOpenLayers PASSIVE_EVENT_LISTENERS */ // templates/table/gis_visualization/gis_visualization.twig
/* global drawOpenLayers */ // templates/table/gis_visualization/gis_visualization.twig
// Constants
var zoomFactor = 1.5;
@ -195,11 +195,7 @@ AJAX.registerTeardown('table/gis_visualization.js', function () {
$(document).off('click', '#up_arrow');
$(document).off('click', '#down_arrow');
$('.vector').off('mousemove').off('mouseout');
$('#placeholder').get(0).removeEventListener(
'wheel',
onGisMouseWheel,
PASSIVE_EVENT_LISTENERS ? { passive: false } : undefined
);
$('#placeholder').get(0).removeEventListener('wheel', onGisMouseWheel, { passive: false });
if (map) {
// Removes ol.Map's resize listener from window
map.setTarget(null);
@ -230,11 +226,7 @@ AJAX.registerOnload('table/gis_visualization.js', function () {
}
});
$('#placeholder').get(0).addEventListener(
'wheel',
onGisMouseWheel,
PASSIVE_EVENT_LISTENERS ? { passive: false } : undefined
);
$('#placeholder').get(0).addEventListener('wheel', onGisMouseWheel, { passive: false });
var dragX = 0;
var dragY = 0;