From cf5df6d1fbcbb016ab4292667d5aa57c5e239149 Mon Sep 17 00:00:00 2001 From: techfg Date: Sun, 14 Feb 2021 17:47:49 -0800 Subject: [PATCH] Resolves #374 - fix includeKeys max call stack exception --- examples/includekeys.html | 768 ++++++++++++++++++++++++++++++++++++++ examples/index.html | 1 + src/mapdata.js | 28 +- 3 files changed, 783 insertions(+), 14 deletions(-) create mode 100644 examples/includekeys.html diff --git a/examples/includekeys.html b/examples/includekeys.html new file mode 100644 index 0000000..1f723dc --- /dev/null +++ b/examples/includekeys.html @@ -0,0 +1,768 @@ + + + + + IncludeKeys Test + + + + + + + + + + + + + + + + + +

IncludeKeys Test

+

+ Test 'includeKeys' option using various combinations of values. This + should be converted to a unit test once the testing framework is updated. +

+

The behavior should be:

+ +

Selected Keys:

+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/index.html b/examples/index.html index 43a29af..38206cf 100644 --- a/examples/index.html +++ b/examples/index.html @@ -24,6 +24,7 @@

ImageMapster Examples

  • Shape Attribute Values
  • Nohref & Href Attribute Values
  • StaticState Values
  • +
  • IncludeKeys Values
  • diff --git a/src/mapdata.js b/src/mapdata.js index c4cde57..8446af0 100644 --- a/src/mapdata.js +++ b/src/mapdata.js @@ -1,4 +1,4 @@ -/* +/* mapdata.js The MapData object, repesents an instance of a single bound imagemap */ @@ -272,7 +272,8 @@ that = this, ar = me.getDataForArea(this), opts = me.options, - navDetails; + navDetails, + areaOpts; function navigateTo(mode, href, target) { switch (mode) { @@ -306,7 +307,7 @@ } function clickArea(ar) { - var areaOpts, target; + var target; canChangeState = ar.isSelectable() && (ar.isDeselectable() || !ar.isSelected()); @@ -349,17 +350,6 @@ if (opts.boundList && opts.boundList.length > 0) { m.setBoundListProperties(opts, list_target, ar.isSelected()); } - - areaOpts = ar.effectiveOptions(); - if (areaOpts.includeKeys) { - list = u.split(areaOpts.includeKeys); - $.each(list, function (_, e) { - var ar = me.getDataForKey(e.toString()); - if (!ar.options.isMask) { - clickArea(ar); - } - }); - } } mousedown.call(this, e); @@ -373,6 +363,16 @@ if (ar && !ar.owner.currentAction) { opts = me.options; clickArea(ar); + areaOpts = ar.effectiveOptions(); + if (areaOpts.includeKeys) { + list = u.split(areaOpts.includeKeys); + $.each(list, function (_, e) { + var ar = me.getDataForKey(e.toString()); + if (!ar.options.isMask) { + clickArea(ar); + } + }); + } } }