Skip to content

Commit

Permalink
Fixed possible issue with newest release of Chrome (removeEventListener)
Browse files Browse the repository at this point in the history
  • Loading branch information
paopre committed Nov 18, 2021
1 parent a6d2f01 commit 941f70c
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions lib/webgui/js/svg-functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -2886,8 +2886,12 @@ function initPanZoom(active) {
function activatePanZoom() {
if (panzoomInstance != null) {
var svg = document.querySelector("svg")
svg.addEventListener('wheel', zoomWithWheel)
svg.addEventListener('dblclick', zoomWithDblClick)
if (svg.getAttribute("zoomeventlistener") == null)
{
svg.setAttribute("zoomeventlistener", "true")
svg.addEventListener('wheel', zoomWithWheel)
svg.addEventListener('dblclick', zoomWithDblClick)
}
panzoomInstance.bind()
var svgcontainer = document.getElementById("svgcontainer")
svgcontainer.style.cursor = "move"
Expand All @@ -2896,10 +2900,11 @@ function activatePanZoom() {

function deactivatePanZoom() {
if (panzoomInstance != null) {

var svg = document.querySelector("svg")
svg.removeEventListener('wheel', zoomWithWheel)
svg.removeEventListener('dblclick', zoomWithDblClick)
//var svg = document.querySelector("svg")
//{
// svg.removeEventListener('wheel', zoomWithWheel)
// svg.removeEventListener('dblclick', zoomWithDblClick)
//}
panzoomInstance.destroy()
var svgcontainer = document.getElementById("svgcontainer")
svgcontainer.style.cursor = "auto"
Expand Down

0 comments on commit 941f70c

Please sign in to comment.