From 84861c1d36262612b52a040e88a355ab17e4c4d7 Mon Sep 17 00:00:00 2001 From: denshade Date: Fri, 22 Mar 2019 15:40:09 +0100 Subject: [PATCH] Avoid BR elements when detecting click selection. --- config.json | 2 +- imagemap.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config.json b/config.json index fe93823..29b9422 100644 --- a/config.json +++ b/config.json @@ -1,7 +1,7 @@ { "name": "Custom Imagemap", "namespace": "uzgent\\ImageMapClass", - "description": "This is an imagemap implementation that allows users to define their own images and corresponding imagemaps and checkboxes.", + "description": "This is an imagemap implementation that allows users to define their own images and corresponding imagemaps linked with checkboxes.", "authors": [ { "name": "Lieven Vaneeckhaute", diff --git a/imagemap.js b/imagemap.js index 0b920fe..e1101f6 100644 --- a/imagemap.js +++ b/imagemap.js @@ -199,7 +199,7 @@ function ImageMapAug(imageIdL, mapIdL, updateFunctionL, fillColor) { var ctx = tempcanvas.getContext("2d"); childNodes.forEach(function (child) { - if (child.nodeType !== Node.TEXT_NODE && child.nodeType !== Node.COMMENT_NODE ) { + if (child.nodeType !== Node.TEXT_NODE && child.nodeType !== Node.COMMENT_NODE && child.getAttribute("coords") != null) { ctx.clearRect(0, 0, tempcanvas.width, tempcanvas.height); draw(ctx, child.getAttribute("coords").split(","), "rgb(255,212,0)"); var p = ctx.getImageData(x, y, 1, 1).data;