diff --git a/CHANGELOG.md b/CHANGELOG.md index e518e70..bfa30d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,12 @@ - Make callback data structures consistent - Improve docs +## Version 1.7.1 - 2024.04.29 + +- [Issue 420](https://github.com/jamietre/ImageMapster/issues/420) 🐞 Forgotten console.log in v1.7.0 +- [Issue 421](https://github.com/jamietre/ImageMapster/issues/421) 🐞 resizing map when map not visible causes `Failed to execute 'drawImage' on 'CanvasRenderingContext2D'` exception +- [Issue 422](https://github.com/jamietre/ImageMapster/issues/422) 🐞 exception `TypeError: Cannot read properties of null (reading '5')` encountered after unbind + ## Version 1.7.0 - 2024.04.29 - [Issue 138](https://github.com/jamietre/ImageMapster/issues/138) 📘 Docs incorrectly state that highlighting will be disabled when staticState option is specified diff --git a/bower.json b/bower.json index 8d4347c..e80f107 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "ImageMapster", - "version": "1.7.0", + "version": "1.8.0", "homepage": "https://jamietre.github.io/ImageMapster", "description": "jQuery plugin that activates areas in HTML image maps with support for highlighting, selecting, tooltips, resizing and more", "main": "dist/jquery.imagemapster.min.js", diff --git a/dist/jquery.imagemapster.js b/dist/jquery.imagemapster.js index ebe02b4..3567def 100644 --- a/dist/jquery.imagemapster.js +++ b/dist/jquery.imagemapster.js @@ -1,5 +1,5 @@ /*! -* imagemapster - v1.7.0 - 2024-04-29 +* imagemapster - v1.8.0 - 2024-05-01 * https://jamietre.github.io/ImageMapster * Copyright (c) 2011 - 2024 James Treworgy * License: MIT @@ -98,6 +98,122 @@ } })(jQuery); +/* + When autoresize is enabled, we obtain the width of the wrapper element and resize to that, however when we're hidden because of + one of our ancenstors, jQuery width function returns 0. Ideally, we could use ResizeObserver/MutationObserver to detect + when we hide/show and resize on that event instead of resizing while we are not visible but until official support of older + browsers is dropped, we need to go this route. The plugin below will provide the actual width even when we're not visible. + + Source: https://raw.githubusercontent.com/dreamerslab/jquery.actual/master/jquery.actual.js +*/ +/*! Copyright 2012, Ben Lin (http://dreamerslab.com/) + * Licensed under the MIT License (LICENSE.txt). + * + * Version: 1.0.19 + * + * Requires: jQuery >= 1.2.3 + */ +/* eslint-disable one-var */ +(function ($) { + 'use strict'; + + $.fn.addBack = $.fn.addBack || $.fn.andSelf; + + $.fn.extend({ + actual: function (method, options) { + // check if the jQuery method exist + if (!this[method]) { + throw ( + '$.actual => The jQuery method "' + + method + + '" you called does not exist' + ); + } + + var defaults = { + absolute: false, + clone: false, + includeMargin: false, + display: 'block' + }; + + var configs = $.extend(defaults, options); + + var $target = this.eq(0); + var fix, restore; + + if (configs.clone === true) { + fix = function () { + var style = 'position: absolute !important; top: -1000 !important; '; + + // this is useful with css3pie + $target = $target.clone().attr('style', style).appendTo('body'); + }; + + restore = function () { + // remove DOM element after getting the width + $target.remove(); + }; + } else { + var tmp = []; + var style = ''; + var $hidden; + + fix = function () { + // get all hidden parents + $hidden = $target.parents().addBack().filter(':hidden'); + style += + 'visibility: hidden !important; display: ' + + configs.display + + ' !important; '; + + if (configs.absolute === true) + style += 'position: absolute !important; '; + + // save the origin style props + // set the hidden el css to be got the actual value later + $hidden.each(function () { + // Save original style. If no style was set, attr() returns undefined + var $this = $(this); + var thisStyle = $this.attr('style'); + + tmp.push(thisStyle); + // Retain as much of the original style as possible, if there is one + $this.attr('style', thisStyle ? thisStyle + ';' + style : style); + }); + }; + + restore = function () { + // restore origin style values + $hidden.each(function (i) { + var $this = $(this); + var _tmp = tmp[i]; + + if (_tmp === undefined) { + $this.removeAttr('style'); + } else { + $this.attr('style', _tmp); + } + }); + }; + } + + fix(); + // get the actual value with user specific methed + // it can be 'width', 'height', 'outerWidth', 'innerWidth'... etc + // configs.includeMargin only works for 'outerWidth' and 'outerHeight' + var actual = /(outer)/.test(method) + ? $target[method](configs.includeMargin) + : $target[method](); + + restore(); + // IMPORTANT, this plugin only return the value of the first element + return actual; + } + }); +})(jQuery); +/* eslint-enable one-var */ + /* core.js ImageMapster core @@ -106,7 +222,7 @@ (function ($) { 'use strict'; - var mapster_version = '1.7.0'; + var mapster_version = '1.8.0'; // all public functions in $.mapster.impl are methods $.fn.mapster = function (method) { @@ -1206,7 +1322,6 @@ }; return me; })(); - console.log('foo3456'); $.mapster.impl.init(); })(jQuery); @@ -3088,6 +3203,7 @@ }, clearMapData: function (preserveState) { var me = this; + me.ensureNoHighlight(); this._clearCanvases(preserveState); // release refs to DOM elements @@ -3879,7 +3995,19 @@ m.MapData.prototype.autoResize = function (duration, callback) { var me = this; - me.resize($(me.wrapper).width(), null, duration, callback); + + /* + When autoresize is enabled, we obtain the width of the wrapper element and resize to that, however when we're hidden because of + one of our ancenstors, jQuery width function returns 0. Ideally, we could use ResizeObserver/MutationObserver to detect + when we hide/show and resize on that event instead of resizing while we are not visible but until official support of older + browsers is dropped, we need to go this route. + */ + me.resize( + $(me.wrapper).width() || $(me.wrapper).actual('width'), + null, + duration, + callback + ); }; m.MapData.prototype.configureAutoResize = function () { @@ -4352,7 +4480,9 @@ options.fadeDuration = options.fadeDuration || (md.options.toolTipFade - ? u.isNumeric(areaOpts.fadeDuration) ? areaOpts.fadeDuration : md.options.fadeDuration + ? u.isNumeric(areaOpts.fadeDuration) + ? areaOpts.fadeDuration + : md.options.fadeDuration : 0); target = ad.area diff --git a/dist/jquery.imagemapster.min.js b/dist/jquery.imagemapster.min.js index c57c05f..8b59b1f 100644 --- a/dist/jquery.imagemapster.min.js +++ b/dist/jquery.imagemapster.min.js @@ -1,8 +1,8 @@ /*! -* imagemapster - v1.7.0 - 2024-04-29 +* imagemapster - v1.8.0 - 2024-05-01 * https://jamietre.github.io/ImageMapster * Copyright (c) 2011 - 2024 James Treworgy * License: MIT */ -!function(i){"function"==typeof define&&define.amd?define(["jquery"],i):"object"==typeof module&&module.exports?module.exports=function(e,t){return void 0===t&&(t="undefined"!=typeof window?require("jquery"):require("jquery")(e)),i(t),t}:i(jQuery)}(function(jQuery){!function(e){"use strict";if(e.event&&e.event.special){var a,t=!1;try{var i=Object.defineProperty({},"passive",{get:function(){return t=!0}});window.addEventListener("testPassive.mapster",function(){},i),window.removeEventListener("testPassive.mapster",function(){},i)}catch(e){}t&&(a=function(e,t,i){if(!e.includes("mapster")||!e.includes("noPreventDefault"))return!1;this.addEventListener(t,i,{passive:!0})},e.event.special.touchstart={setup:function(e,t,i){return a.call(this,t,"touchstart",i)}},e.event.special.touchend={setup:function(e,t,i){return a.call(this,t,"touchend",i)}})}}(jQuery),!function($){"use strict";var mapster_version="1.7.0",m=($.fn.mapster=function(e){var t=$.mapster.impl;return $.mapster.utils.isFunction(t[e])?t[e].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof e&&e?void $.error("Method "+e+" does not exist on jQuery.mapster"):t.bind.apply(this,arguments)},$.mapster={version:mapster_version,render_defaults:{isSelectable:!0,isDeselectable:!0,fade:!1,fadeDuration:150,fill:!0,fillColor:"000000",fillColorMask:"FFFFFF",fillOpacity:.7,highlight:!0,stroke:!1,strokeColor:"ff0000",strokeOpacity:1,strokeWidth:1,includeKeys:"",altImage:null,altImageId:null,altImages:{},altImageOpacity:null},defaults:{clickNavigate:!1,navigateMode:"location",wrapClass:null,wrapCss:null,onGetList:null,sortList:!1,mapKey:"",mapValue:"",singleSelect:!1,listKey:"value",listSelectedAttribute:"selected",listSelectedClass:null,onClick:null,onMouseover:null,onMouseout:null,mouseoutDelay:0,onStateChange:null,boundList:null,onConfigured:null,configTimeout:3e4,noHrefIsMask:!0,scaleMap:!0,enableAutoResizeSupport:!1,autoResize:!1,autoResizeDelay:0,autoResizeDuration:0,onAutoResize:null,areas:[]},shared_defaults:{render_highlight:{fade:!0},render_select:{fade:!1},staticState:null,selected:null},area_defaults:{includeKeys:"",isMask:!1},canvas_style:{position:"absolute",left:0,top:0,padding:0,border:0},hasCanvas:null,map_cache:[],hooks:{},addHook:function(e,t){this.hooks[e]=(this.hooks[e]||[]).push(t)},callHooks:function(e,i){$.each(this.hooks[e]||[],function(e,t){t.apply(i)})},utils:{when:{all:function(e){return Promise.all(e)},defer:function(){return new function(){this.promise=new Promise(function(e,t){this.resolve=e,this.reject=t}.bind(this)),this.then=this.promise.then.bind(this.promise),this.catch=this.promise.catch.bind(this.promise)}}},defer:function(){return this.when.defer()},subclass:function(i,a){function e(){var e=this,t=Array.prototype.slice.call(arguments,0);e.base=i.prototype,e.base.init=function(){i.prototype.constructor.apply(e,t)},a.apply(e,t)}return(e.prototype=new i).constructor=e},asArray:function(e){return e.constructor===Array?e:this.split(e)},split:function(e,t){for(var i,a=e.split(","),n=0;n=e.index;t--)m.map_cache[t].index--};function hasVml(){var e=$("
").appendTo("body"),t=(e.html(''),e[0].firstChild),t=(t.style.behavior="url(#default#VML)",!t||"object"==typeof t.adj);return e.remove(),t}function namespaces(){return"object"==typeof document.namespaces?document.namespaces:null}function hasCanvas(){var e=namespaces();return!(e&&e.g_vml_||!$("")[0].getContext)}function merge_areas(i,e){var a,n=i.options.areas;e&&$.each(e,function(e,t){t&&t.key&&(0<=(a=u.indexOfProp(n,"key",t.key))?$.extend(n[a],t):n.push(t),a=i.getDataForKey(t.key))&&$.extend(a.options,t)})}function merge_options(e,t){var i=u.updateProps({},t);delete i.areas,u.updateProps(e.options,i),merge_areas(e,t.areas),u.updateProps(e.area_options,e.options)}return me.get=function(e){var t=m.getMapData(this);if(t&&t.complete)return new m.Method(this,function(){return this.getSelected()},function(){return this.isSelected()},{name:"get",args:arguments,key:e,first:!0,allowAsync:!0,defaultReturn:""}).go();throw"Can't access data until binding complete."},me.data=function(e){return new m.Method(this,null,function(){return this},{name:"data",args:arguments,key:e}).go()},me.highlight=function(t){return new m.Method(this,function(){var e;if(!1!==t)return 0<=(e=this.highlightId)?this.data[e].key:null;this.ensureNoHighlight()},function(){this.highlight()},{name:"highlight",args:arguments,key:t,first:!0}).go()},me.keys=function(e,a){var n=[],i=m.getMapData(this);if(i&&i.complete)return i&&i.complete?("string"==typeof e?a?o(i.getDataForKey(e)):n=[i.getKeysForGroup(e)]:(a=e,this.each(function(e,t){"AREA"===t.nodeName&&o(i.getDataForArea(t))})),n.join(",")):"";throw"Can't access data until binding complete.";function o(e){var t,i=[];a?(t=e.areas(),$.each(t,function(e,t){i=i.concat(t.keys)})):i.push(e.key),$.each(i,function(e,t){$.inArray(t,n)<0&&n.push(t)})}},me.select=function(){me.set.call(this,!0)},me.deselect=function(){me.set.call(this,!1)},me.set=function(a,n,e){var o,s,r,c,l=e;function h(e){e&&$.inArray(e,c)<0&&(c.push(e),r+=(""===r?"":",")+e.key)}function p(e){$.each(c,function(e,t){var i=t;if(i)switch(a){case!0:i.select(l);break;case!1:i.deselect(!0);break;default:i.toggle(l)}}),a||e.removeSelectionFinish()}return this.filter("img,area").each(function(e,t){var i;(s=m.getMapData(t))!==o&&(o&&p(o),c=[],r=""),s&&(i="","IMG"===t.nodeName.toUpperCase()?m.queueCommand(s,$(t),"set",[a,n,l])||(n instanceof Array?n.length&&(i=n.join(",")):i=n,i&&$.each(u.split(i),function(e,t){h(s.getDataForKey(t.toString())),o=s})):(l=n,m.queueCommand(s,$(t),"set",[a,l])||(h(s.getDataForArea(t)),o=s)))}),s&&p(s),this},me.unbind=function(e){return new m.Method(this,function(){this.clearEvents(),this.clearMapData(e),removeMap(this)},null,{name:"unbind",args:arguments}).go()},me.rebind=function(t){return new m.Method(this,function(){var e=this;e.complete=!1,e.configureOptions(t),e.bindImages().then(function(){e.buildDataset(!0),e.complete=!0,e.onConfigured()})},null,{name:"rebind",args:arguments}).go()},me.get_options=function(e,t){var i=u.isBool(e)?e:t;return new m.Method(this,function(){var e=$.extend({},this.options);return i&&(e.render_select=u.updateProps({},m.render_defaults,e,e.render_select),e.render_highlight=u.updateProps({},m.render_defaults,e,e.render_highlight)),e},function(){return i?this.effectiveOptions():this.options},{name:"get_options",args:arguments,first:!0,allowAsync:!0,key:e}).go()},me.set_options=function(e){return new m.Method(this,function(){merge_options(this,e)},null,{name:"set_options",args:arguments}).go()},me.unload=function(){for(var e=m.map_cache.length-1;0<=e;e--)m.map_cache[e]&&me.unbind.call($(m.map_cache[e].image));me.graphics=null},me.snapshot=function(){return new m.Method(this,function(){$.each(this.data,function(e,t){t.selected=!1}),this.base_canvas=this.graphics.createVisibleCanvas(this),$(this.image).before(this.base_canvas)},null,{name:"snapshot"}).go()},me.state=function(){var i,a=null;return $(this).each(function(e,t){if("IMG"===t.nodeName)return(i=m.getMapData(t))&&(a=i.state()),!1}),a},me.bind=function(o){return this.each(function(e,t){var i,a=$(t),n=m.getMapData(t);if(n){if(me.unbind.apply(a),!n.complete)return!0;n=null}if(i=(t=this.getAttribute("usemap"))&&$('map[name="'+t.substr(1)+'"]'),!(a.is("img")&&t&&0')[0]},clearHighlight:function(){var e=this.map_data.overlay_canvas;e.getContext("2d").clearRect(0,0,e.width,e.height)},refreshSelections:function(){var e=this.map_data,t=e.base_canvas;e.base_canvas=this.createVisibleCanvas(e),h(e.base_canvas).hide(),h(t).before(e.base_canvas),e.redrawSelections(),h(e.base_canvas).show(),h(t).remove()}},o={renderShape:function(e,t,i){var a,n=this,o=e.coords(),s=n.elementName?'name="'+n.elementName+'" ':"",r=i?'class="'+i+'" ':"",c='',l=t.stroke?" strokeweight="+t.strokeWidth+' stroked="t" strokecolor="#'+t.strokeColor+'"':' stroked="f"',u=t.fill?' filled="t"':' filled="f"';switch(e.shape){case"rect":case"rectangle":a="'+c+"";break;case"poly":case"polygon":a="'+c+"";break;case"circ":case"circle":a="'+c+""}return i=h(a),h(n.canvas).append(i),i},render:function(){var i,a=this;return h.each(this.shapes,function(e,t){a.renderShape(t.mapArea,t.options)}),this.masks.length&&h.each(this.masks,function(e,t){i=c.updateProps({},t.options,{fillOpacity:1,fillColor:t.options.fillColorMask}),a.renderShape(t.mapArea,i,"mapster_mask")}),this.active=!1,this.canvas},createCanvasFor:function(e){var t=e.scaleInfo.width,e=e.scaleInfo.height;return h('')[0]},clearHighlight:function(){h(this.map_data.overlay_canvas).children().remove()},removeSelections:function(e){(0<=e?h(this.map_data.base_canvas).find('[name="static_'+e.toString()+'"]'):h(this.map_data.base_canvas).children()).remove()}},h.each(["renderShape","addAltImage","render","createCanvasFor","clearHighlight","removeSelections","refreshSelections"],function(e,t){var i;a[t]=(i=t,function(){return a[i]=(r.hasCanvas()?n:o)[i]||s,a[i].apply(this,arguments)})})}(jQuery),!function(o){"use strict";var e=o.mapster,n=e.utils,t=[];e.MapImages=function(e){this.owner=e,this.clear()},e.MapImages.prototype={constructor:e.MapImages,slice:function(){return t.slice.apply(this,arguments)},splice:function(){return t.slice.apply(this.status,arguments),t.slice.apply(this,arguments)},complete:function(){return o.inArray(!1,this.status)<0},_add:function(e){e=t.push.call(this,e)-1;return this.status[e]=!1,e},indexOf:function(e){return n.indexOf(this,e)},clear:function(){var i=this;i.ids&&0").addClass("mapster_el").hide(),i=n._add(e[0]),e.on("load.mapster",function(e){n.imageLoaded.call(n,e)}).on("error.mapster",function(e){n.imageLoadError.call(n,e)}),e.attr("src",a)}else i=n._add(o(e)[0]);if(t){if(this[t])throw t+" is already used or is not available as an altImage alias.";n.ids.push(t),n[t]=n[i]}return i}},bind:function(){var t=this,i=t.owner.options.configTimeout/50,a=function(){for(var e=t.length;0
'),l.wrapClass&&(!0===l.wrapClass?i.addClass(s[0].className):i.addClass(l.wrapClass))),c.wrapper=i,c.scaleInfo=r=d.scaleMap(c.images[0],c.images[1],l.scaleMap),c.base_canvas=e=c.graphics.createVisibleCanvas(c),c.overlay_canvas=t=c.graphics.createVisibleCanvas(c),a=y(c.images[1]).addClass("mapster_el "+c.images[0].className).attr({id:null,usemap:null}),(o=d.size(c.images[0])).complete&&a.css({width:o.width,height:o.height}),c.buildDataset(),a=y.extend({display:"block",position:"relative",padding:0},!0===l.enableAutoResizeSupport?{}:{width:r.width,height:r.height}),l.wrapCss&&y.extend(a,l.wrapCss),s.parent()[0]!==c.wrapper[0]&&s.before(c.wrapper),i.css(a),y(c.images.slice(2)).hide(),n=1;nw&&t[1]>b)return v=t,!(s=!0)}),s||(v=[l,u])),v}}(jQuery),!function(d){"use strict";var f=d.mapster,m=f.utils,e=f.MapArea.prototype;f.utils.getScaleInfo=function(e,t){var i;return t?.98<(i=e.width/t.width||e.height/t.height)&&i<1.02&&(i=1):(i=1,t=e),{scale:1!==i,scalePct:i,realWidth:t.width,realHeight:t.height,width:e.width,height:e.height,ratio:e.width/e.height}},f.utils.scaleMap=function(e,t,i){e=m.size(e),t=m.size(t,!0);if(t.complete())return e.complete()||(e=t),this.getScaleInfo(e,i?t:null);throw"Another script, such as an extension, appears to be interfering with image loading. Please let us know about this."},f.MapData.prototype.resize=function(t,i,a,n){var o,s,r,c,e,l=this;function u(e,t,i){f.hasCanvas()?(e.width=t,e.height=i):(d(e).width(t),d(e).height(i))}function h(){var e;u(l.overlay_canvas,t,i),0<=c&&((e=l.data[c]).tempOptions={fade:!1},l.getDataForKey(e.key).highlight(),e.tempOptions=null),u(l.base_canvas,t,i),l.redrawSelections(),l.currentAction="",m.isFunction(n)&&n(),l.processCommandQueue()}function p(){d(l.image).css(r),l.scaleInfo=m.getScaleInfo({width:t,height:i},{width:l.scaleInfo.realWidth,height:l.scaleInfo.realHeight}),d.each(l.data,function(e,t){d.each(t.areas(),function(e,t){t.resize()})})}n=n||a,l.scaleInfo.width===t&&l.scaleInfo.height===i||(c=l.highlightId,t||(e=i/l.scaleInfo.realHeight,t=Math.round(l.scaleInfo.realWidth*e)),i||(e=t/l.scaleInfo.realWidth,i=Math.round(l.scaleInfo.realHeight*e)),r={width:String(t)+"px",height:String(i)+"px"},f.hasCanvas()||d(l.base_canvas).children().remove(),e=d(l.wrapper).find(".mapster_el"),!0!==l.options.enableAutoResizeSupport&&(e=e.add(l.wrapper)),a?(s=[],l.currentAction="resizing",e.filter(":visible").each(function(e,t){o=m.defer(),s.push(o),d(t).animate(r,{duration:a,complete:o.resolve,easing:"linear"})}),e.filter(":hidden").css(r),o=m.defer(),s.push(o),m.when.all(s).then(h),p(),o.resolve()):(e.css(r),p(),h()))},f.MapData.prototype.autoResize=function(e,t){this.resize(d(this.wrapper).width(),null,e,t)},f.MapData.prototype.configureAutoResize=function(){var e=this,t=e.instanceEventNamespace();function i(){!0===e.options.autoResize&&e.autoResize(e.options.autoResizeDuration,e.options.onAutoResize)}d(e.image).on("load"+t,i),d(window).on("focus"+t,i),d(window).on("resize"+t,function(){e.autoResizeTimer&&clearTimeout(e.autoResizeTimer),e.autoResizeTimer=setTimeout(i,e.options.autoResizeDelay)}),d(window).on("readystatechange"+t,i),d(window.document).on("fullscreenchange"+t,i),i()},f.MapArea=m.subclass(f.MapArea,function(){this.base.init(),this.owner.scaleInfo.scale&&this.resize()}),e.coords=function(e,t){var i,a=[],n=e||this.owner.scaleInfo.scalePct,o=t||0;if(1===n&&0===t)return this.originalCoords;for(i=0;i',showToolTip:!1,toolTip:null,toolTipFade:!0,toolTipClose:["area-mouseout","image-mouseout","generic-mouseout"],onShowToolTip:null,onHideToolTip:null}),c.extend(e.area_defaults,{toolTip:null,toolTipClose:null}),e.MapData.prototype.clearToolTip=function(){this.activeToolTip&&(this.activeToolTip.stop().remove(),this.activeToolTip=null,this.activeToolTipID=null,l.ifFunction(this.options.onHideToolTip,this))},e.AreaData.prototype.showToolTip=function(e,t){var i,a,n,o=this,s=o.owner,r=o.effectiveOptions();if(t=t?c.extend({},t):{},e=e||r.toolTip,i=t.closeEvents||r.toolTipClose||s.options.toolTipClose||"tooltip-click",n=void 0!==t.template?t.template:s.options.toolTipContainer,t.closeEvents="string"==typeof i?i=l.split(i):i,t.fadeDuration=t.fadeDuration||(s.options.toolTipFade?(l.isNumeric(r.fadeDuration)?r:s.options).fadeDuration:0),a=o.area||c.map(o.areas(),function(e){return e.area}),s.activeToolTipID!==o.areaId){s.clearToolTip();var e=l.isFunction(e)?e({key:this.key,target:a}):e;if(e)return s.activeToolTip=e=u(e,n,t.css),s.activeToolTipID=o.areaId,n=function(){s.clearToolTip()},h(i,"area-click","click",c(s.map),null,n),h(i,"tooltip-click","click",e,null,n),h(i,"image-mouseout","mouseout",c(s.image),function(e){return e.relatedTarget&&"AREA"!==e.relatedTarget.nodeName&&e.relatedTarget!==o.area},n),h(i,"image-click","click",c(s.image),null,n),p(e,a,s.image,t.container,t),l.ifFunction(s.options.onShowToolTip,o.area,{toolTip:e,options:{},areaOptions:r,key:o.key,selected:o.isSelected()}),e}},e.impl.tooltip=function(s,r){return new e.Method(this,function(){var e,t,i,a,n,o=this;s?(n=(e=c(s))&&0