Skip to content
Browse files

Finish merging tooltip branch

  • Loading branch information...
1 parent 4d4068e commit dc348de41d846a8727dd523b09cecbe88e1ad6d6 jamietre committed Sep 21, 2012
Showing with 102 additions and 93 deletions.
  1. +5 −0 CHANGES.md
  2. +12 −7 src/areadata.js
  3. +0 −3 src/core.js
  4. +73 −77 src/core.min.js
  5. +9 −4 src/mapdata.js
  6. +3 −2 src/mapdata.min.js
View
5 CHANGES.md
@@ -7,6 +7,11 @@ Features:
####version 1.2.7 (in development)
+* [Issue xx] Mouseover events not completely suppressed on mobile
+* selectOnMousedown feature ?
+* Tooltip enhancements
+* AltImage enhancements
+
*tooltip-enhancements branch*
* [Issue 72](https://github.com/jamietre/ImageMapster/issues/72): `scaleMap` not working propery when using bootstrap (css on `body` causing incorrect evaluation of native image size)
View
19 src/areadata.js
@@ -135,7 +135,8 @@
key: this.key,
state: state_type,
selected: state
- });
+ }
+ );
}
};
@@ -169,15 +170,19 @@
// don't check if it's already selected
if (!this.isSelected()) {
if (options) {
- this.optsCache = $.extend(this.effectiveRenderOptions('select'),options);
+
+ // cache the current options, and map the altImageId if an altimage
+ // was passed
+
+ this.optsCache = $.extend(this.effectiveRenderOptions('select'),
+ options,
+ {
+ altImageId: o.images.add(options.altImage)
+ });
}
+
this.drawSelection();
- // this was in ToolTip enhancement branch but not master... hmm.
-
- //if (options) {
- // this.optsCache=null;
- //}
this.selected = true;
this.changeState('select', true);
}
View
3 src/core.js
@@ -894,9 +894,6 @@
};
return;
}
- if (!u.isBool($.mapster.defaults.highlight)) {
- m.render_defaults.highlight = !m.isTouch;
- }
$.extend(m.defaults, m.render_defaults,m.shared_defaults);
$.extend(m.area_defaults, m.render_defaults,m.shared_defaults);
View
150 src/core.min.js
@@ -1,92 +1,88 @@
/* ImageMapster core */
-(function(a){a.fn.mapster=function(d){var c=a.mapster.impl;if(a.isFunction(c[d])){return c[d].apply(this,Array.prototype.slice.call(arguments,1));
-}else{if(typeof d==="object"||!d){return c.bind.apply(this,arguments);}else{a.error("Method "+d+" does not exist on jQuery.mapster");
-}}};a.mapster={version:"1.2.5",render_defaults:{isSelectable:true,isDeselectable:true,fade:false,fadeDuration:150,altImage:null,fill:true,fillColor:"000000",fillColorMask:"FFFFFF",fillOpacity:0.7,highlight:null,stroke:false,strokeColor:"ff0000",strokeOpacity:1,strokeWidth:1,includeKeys:"",alt_image:null},defaults:{clickNavigate:false,wrapClass:null,wrapCss:null,onGetList:null,sortList:false,listenToList:false,mapKey:"",mapValue:"",singleSelect:false,listKey:"value",listSelectedAttribute:"selected",listSelectedClass:null,onClick:null,onMouseover:null,onMouseout:null,mouseoutDelay:0,onStateChange:null,boundList:null,onConfigured:null,configTimeout:30000,noHrefIsMask:true,scaleMap:true,safeLoad:false,areas:[]},shared_defaults:{render_highlight:{fade:true},render_select:{fade:false},staticState:null,selected:null},area_defaults:{includeKeys:"",isMask:false},canvas_style:{position:"absolute",left:0,top:0,padding:0,border:0},hasCanvas:null,isTouch:null,windowLoaded:false,map_cache:[],hooks:{},addHook:function(d,c){this.hooks[d]=(this.hooks[d]||[]).push(c);
-},callHooks:function(d,c){a.each(this.hooks[d]||[],function(g,f){f.apply(c);});},utils:{subclass:function(c,d){var e=function(){var g=this,f=Array.prototype.slice.call(arguments,0);
-g.base=c.prototype;g.base.init=function(){c.prototype.constructor.apply(g,f);};d.apply(g,f);
-};e.prototype=new c();e.prototype.constructor=e;return e;},asArray:function(c){return c.constructor===Array?c:this.split(c);
-},split:function(g,d){var f,e,c=g.split(",");for(f=0;f<c.length;f++){e=a.trim(c[f]);
-if(e===""){c.splice(f,1);}else{c[f]=d?d(e):e;}}return c;},updateProps:function(c,d){var e,f=c||{},g=a.isEmptyObject(f)?d:c;
-e=[];a.each(g,function(h){e.push(h);});a.each(Array.prototype.slice.call(arguments,1),function(h,j){a.each(j||{},function(k){if(!e||a.inArray(k,e)>=0){var i=j[k];
-if(a.isPlainObject(i)){f[k]=a.extend(f[k]||{},i);}else{if(i&&i.constructor===Array){f[k]=i.slice(0);
-}else{if(typeof i!=="undefined"){f[k]=j[k];}}}}});});return f;},isElement:function(c){return(typeof HTMLElement==="object"?c instanceof HTMLElement:c&&typeof c==="object"&&c.nodeType===1&&typeof c.nodeName==="string");
-},indexOfProp:function(c,d,f){var e=c.constructor===Array?-1:null;a.each(c,function(h,g){if(g&&(d?g[d]:g)===f){e=h;
-return false;}});return e;},boolOrDefault:function(d,c){return this.isBool(d)?d:c||false;
-},isBool:function(c){return typeof c==="boolean";},isUndef:function(c){return typeof c==="undefined";
-},ifFunction:function(d,e,c){if(a.isFunction(d)){d.call(e,c);}},size:function(c){var d=a.mapster.utils;
-return{width:d.imgWidth(c,true),height:d.imgHeight(c,true),complete:function(){return !!this.height&&!!this.width;
-}};},setOpacity:function(c,d){c.style.opacity=d;},fader:(function(){var c={},e=0,d=function(h,l,i,g){var j,f=g/15,k,m=a.mapster.utils;
-if(typeof h==="number"){k=c[h];if(!k){return;}}else{j=m.indexOfProp(c,null,h);if(j){delete c[j];
-}c[++e]=k=h;h=e;}i=i||1;l=(l+(i/f)>i-0.01)?i:l+(i/f);m.setOpacity(k,l);if(l<i){setTimeout(function(){d(h,l,i,g);
-},15);}};return d;}())},getBoundList:function(g,e){if(!g.boundList){return null;}var c,d,h=a(),f=a.mapster.utils.split(e);
-g.boundList.each(function(k,j){for(c=0;c<f.length;c++){d=f[c];if(a(j).is("["+g.listKey+'="'+d+'"]')){h=h.add(j);
-}}});return h;},setBoundListProperties:function(c,e,d){e.each(function(g,f){if(c.listSelectedClass){if(d){a(f).addClass(c.listSelectedClass);
-}else{a(f).removeClass(c.listSelectedClass);}}if(c.listSelectedAttribute){a(f).attr(c.listSelectedAttribute,d);
-}});},getMapDataIndex:function(e){var d,c;switch(e.tagName&&e.tagName.toLowerCase()){case"area":c=a(e).parent().attr("name");
-d=a("img[usemap='#"+c+"']")[0];break;case"img":d=e;break;}return d?this.utils.indexOfProp(this.map_cache,"image",d):-1;
-},getMapData:function(d){var c=this.getMapDataIndex(d.length?d[0]:d);if(c>=0){return c>=0?this.map_cache[c]:null;
-}},queueCommand:function(e,f,d,c){if(!e){return false;}if(!e.complete||e.currentAction){e.commands.push({that:f,command:d,args:c});
+(function(a){a.fn.mapster=function(f){var e=a.mapster.impl;if(a.isFunction(e[f])){return e[f].apply(this,Array.prototype.slice.call(arguments,1));
+}else{if(typeof f==="object"||!f){return e.bind.apply(this,arguments);}else{a.error("Method "+f+" does not exist on jQuery.mapster");
+}}};a.mapster={version:"1.2.6.007",render_defaults:{isSelectable:true,isDeselectable:true,fade:false,fadeDuration:150,fill:true,fillColor:"000000",fillColorMask:"FFFFFF",fillOpacity:0.7,highlight:null,stroke:false,strokeColor:"ff0000",strokeOpacity:1,strokeWidth:1,includeKeys:"",altImage:null,altImageId:null,altImages:{}},defaults:{clickNavigate:false,wrapClass:null,wrapCss:null,onGetList:null,sortList:false,listenToList:false,mapKey:"",mapValue:"",singleSelect:false,listKey:"value",listSelectedAttribute:"selected",listSelectedClass:null,onClick:null,onMouseover:null,onMouseout:null,mouseoutDelay:0,onStateChange:null,boundList:null,onConfigured:null,configTimeout:30000,noHrefIsMask:true,scaleMap:true,safeLoad:false,areas:[]},shared_defaults:{render_highlight:{fade:true},render_select:{fade:false},staticState:null,selected:null},area_defaults:{includeKeys:"",isMask:false},canvas_style:{position:"absolute",left:0,top:0,padding:0,border:0},hasCanvas:null,isTouch:null,windowLoaded:false,map_cache:[],hooks:{},addHook:function(f,e){this.hooks[f]=(this.hooks[f]||[]).push(e);
+},callHooks:function(f,e){a.each(this.hooks[f]||[],function(h,g){g.apply(e);});},utils:{when:a.mapster_when,defer:a.mapster_when.defer,subclass:function(e,f){var g=function(){var i=this,h=Array.prototype.slice.call(arguments,0);
+i.base=e.prototype;i.base.init=function(){e.prototype.constructor.apply(i,h);};f.apply(i,h);
+};g.prototype=new e();g.prototype.constructor=g;return g;},asArray:function(e){return e.constructor===Array?e:this.split(e);
+},split:function(j,f){var h,g,e=j.split(",");for(h=0;h<e.length;h++){g=a.trim(e[h]);
+if(g===""){e.splice(h,1);}else{e[h]=f?f(g):g;}}return e;},updateProps:function(e,f){var g,h=e||{},i=a.isEmptyObject(h)?f:e;
+g=[];a.each(i,function(j){g.push(j);});a.each(Array.prototype.slice.call(arguments,1),function(j,k){a.each(k||{},function(m){if(!g||a.inArray(m,g)>=0){var l=k[m];
+if(a.isPlainObject(l)){h[m]=a.extend(h[m]||{},l);}else{if(l&&l.constructor===Array){h[m]=l.slice(0);
+}else{if(typeof l!=="undefined"){h[m]=k[m];}}}}});});return h;},isElement:function(e){return(typeof HTMLElement==="object"?e instanceof HTMLElement:e&&typeof e==="object"&&e.nodeType===1&&typeof e.nodeName==="string");
+},indexOfProp:function(e,f,h){var g=e.constructor===Array?-1:null;a.each(e,function(k,j){if(j&&(f?j[f]:j)===h){g=k;
+return false;}});return g;},boolOrDefault:function(f,e){return this.isBool(f)?f:e||false;
+},isBool:function(e){return typeof e==="boolean";},isUndef:function(e){return typeof e==="undefined";
+},ifFunction:function(f,g,e){if(a.isFunction(f)){f.call(g,e);}},size:function(e,f){var g=a.mapster.utils;
+return{width:f?(e.width||e.naturalWidth):g.imgWidth(e,true),height:f?(e.height||e.naturalHeight):g.imgHeight(e,true),complete:function(){return !!this.height&&!!this.width;
+}};},setOpacity:function(e,f){e.style.opacity=f;},fader:(function(){var e={},g=0,f=function(j,n,k,i){var l,h=i/15,m,o=a.mapster.utils;
+if(typeof j==="number"){m=e[j];if(!m){return;}}else{l=o.indexOfProp(e,null,j);if(l){delete e[l];
+}e[++g]=m=j;j=g;}k=k||1;n=(n+(k/h)>k-0.01)?k:n+(k/h);o.setOpacity(m,n);if(n<k){setTimeout(function(){f(j,n,k,i);
+},15);}};return f;}())},getBoundList:function(i,g){if(!i.boundList){return null;}var e,f,j=a(),h=a.mapster.utils.split(g);
+i.boundList.each(function(l,k){for(e=0;e<h.length;e++){f=h[e];if(a(k).is("["+i.listKey+'="'+f+'"]')){j=j.add(k);
+}}});return j;},setBoundListProperties:function(e,g,f){g.each(function(j,h){if(e.listSelectedClass){if(f){a(h).addClass(e.listSelectedClass);
+}else{a(h).removeClass(e.listSelectedClass);}}if(e.listSelectedAttribute){a(h).attr(e.listSelectedAttribute,f);
+}});},getMapDataIndex:function(g){var f,e;switch(g.tagName&&g.tagName.toLowerCase()){case"area":e=a(g).parent().attr("name");
+f=a("img[usemap='#"+e+"']")[0];break;case"img":f=g;break;}return f?this.utils.indexOfProp(this.map_cache,"image",f):-1;
+},getMapData:function(f){var e=this.getMapDataIndex(f.length?f[0]:f);if(e>=0){return e>=0?this.map_cache[e]:null;
+}},queueCommand:function(g,h,f,e){if(!g){return false;}if(!g.complete||g.currentAction){g.commands.push({that:h,command:f,args:e});
return true;}return false;},unload:function(){this.impl.unload();this.utils=null;
-this.impl=null;a.fn.mapster=null;a.mapster=null;a("*").unbind();}};var b=a.mapster;
-a.each(["width","height"],function(f,d){var c=d.substr(0,1).toUpperCase()+d.substr(1);
-b.utils["img"+c]=function(e,g){return(g?a(e)[d]():0)||e[d]||e["natural"+c]||e["client"+c]||e["offset"+c];
-};});b.Method=function(g,d,c,f){var e=this;e.name=f.name;e.output=g;e.input=g;e.first=f.first||false;
-e.args=f.args?Array.prototype.slice.call(f.args,0):[];e.key=f.key;e.func_map=d;e.func_area=c;
-e.name=f.name;e.allowAsync=f.allowAsync||false;};b.Method.prototype.go=function(){var f,e,c,g,j,k=this.input,d=[],h=this;
-g=k.length;for(f=0;f<g;f++){e=a.mapster.getMapData(k[f]);if(e){if(!h.allowAsync&&b.queueCommand(e,h.input,h.name,h.args)){if(this.first){j="";
-}continue;}c=e.getData(k[f].nodeName==="AREA"?k[f]:this.key);if(c){if(a.inArray(c,d)<0){d.push(c);
-}}else{j=this.func_map.apply(e,h.args);}if(this.first||typeof j!=="undefined"){break;
-}}}a(d).each(function(m,l){j=h.func_area.apply(l,h.args);});if(typeof j!=="undefined"){return j;
-}else{return this.output;}};a.mapster.impl=(function(){var e={},d=a.mapster,i=a.mapster.utils,h,c;
-c=function(j){return d.map_cache.push(j)-1;};h=function(k){d.map_cache.splice(k.index,1);
-for(var j=d.map_cache.length-1;j>=this.index;j--){d.map_cache[j].index--;}};function f(n,k){var j,l,m=n.options.areas;
-if(k){a.each(k,function(p,o){if(!o||!o.key){return;}l=i.indexOfProp(m,"key",o.key);
-if(l>=0){a.extend(m[l],o);}else{m.push(o);}j=n.getDataForKey(o.key);if(j){a.extend(j.options,o);
-}});}}function g(j,k){var l=i.updateProps({},k);delete l.areas;i.updateProps(j.options,l);
-f(j,k.areas);i.updateProps(j.area_options,j.options);}e.get=function(j){var k=d.getMapData(this);
-if(!(k&&k.complete)){throw ("Can't access data until binding complete.");}return(new d.Method(this,function(){return this.getSelected();
+this.impl=null;a.fn.mapster=null;a.mapster=null;a("*").unbind();}};var c=a.mapster,d=c.utils,b=Array.prototype;
+a.each(["width","height"],function(h,g){var f=g.substr(0,1).toUpperCase()+g.substr(1);
+d["img"+f]=function(e,i){return(i?a(e)[g]():0)||e[g]||e["natural"+f]||e["client"+f]||e["offset"+f];
+};});c.Method=function(i,f,e,h){var g=this;g.name=h.name;g.output=i;g.input=i;g.first=h.first||false;
+g.args=h.args?b.slice.call(h.args,0):[];g.key=h.key;g.func_map=f;g.func_area=e;g.name=h.name;
+g.allowAsync=h.allowAsync||false;};c.Method.prototype.go=function(){var h,g,e,j,l,m=this.input,f=[],k=this;
+j=m.length;for(h=0;h<j;h++){g=a.mapster.getMapData(m[h]);if(g){if(!k.allowAsync&&c.queueCommand(g,k.input,k.name,k.args)){if(this.first){l="";
+}continue;}e=g.getData(m[h].nodeName==="AREA"?m[h]:this.key);if(e){if(a.inArray(e,f)<0){f.push(e);
+}}else{l=this.func_map.apply(g,k.args);}if(this.first||typeof l!=="undefined"){break;
+}}}a(f).each(function(o,n){l=k.func_area.apply(n,k.args);});if(typeof l!=="undefined"){return l;
+}else{return this.output;}};a.mapster.impl=(function(){var f={},i,e;e=function(j){return c.map_cache.push(j)-1;
+};i=function(k){c.map_cache.splice(k.index,1);for(var j=c.map_cache.length-1;j>=this.index;
+j--){c.map_cache[j].index--;}};function g(n,k){var j,l,m=n.options.areas;if(k){a.each(k,function(p,o){if(!o||!o.key){return;
+}l=d.indexOfProp(m,"key",o.key);if(l>=0){a.extend(m[l],o);}else{m.push(o);}j=n.getDataForKey(o.key);
+if(j){a.extend(j.options,o);}});}}function h(j,k){var l=d.updateProps({},k);delete l.areas;
+d.updateProps(j.options,l);g(j,k.areas);d.updateProps(j.area_options,j.options);}f.get=function(j){var k=c.getMapData(this);
+if(!(k&&k.complete)){throw ("Can't access data until binding complete.");}return(new c.Method(this,function(){return this.getSelected();
},function(){return this.isSelected();},{name:"get",args:arguments,key:j,first:true,allowAsync:true,defaultReturn:""})).go();
-};e.data=function(j){return(new d.Method(this,null,function(){return this;},{name:"data",args:arguments,key:j})).go();
-};e.highlight=function(j){return(new d.Method(this,function(){if(j===false){this.ensureNoHighlight();
+};f.data=function(j){return(new c.Method(this,null,function(){return this;},{name:"data",args:arguments,key:j})).go();
+};f.highlight=function(j){return(new c.Method(this,function(){if(j===false){this.ensureNoHighlight();
}else{var k=this.highlightId;return k>=0?this.data[k].key:null;}},function(){this.highlight();
-},{name:"highlight",args:arguments,key:j,first:true})).go();};e.keys=function(l,k){var m=[],n=d.getMapData(this);
+},{name:"highlight",args:arguments,key:j,first:true})).go();};f.keys=function(l,k){var m=[],n=c.getMapData(this);
if(!(n&&n.complete)){throw ("Can't access data until binding complete.");}function j(o){var p,q=[];
if(!k){q.push(o.key);}else{p=o.areas();a.each(p,function(s,r){q=q.concat(r.keys);
});}a.each(q,function(s,r){if(a.inArray(r,m)<0){m.push(r);}});}if(!(n&&n.complete)){return"";
}if(typeof l==="string"){if(k){j(n.getDataForKey(l));}else{m=[n.getKeysForGroup(l)];
}}else{k=l;this.each(function(p,o){if(o.nodeName==="AREA"){j(n.getDataForArea(o));
-}});}return m.join(",");};e.select=function(){e.set.call(this,true);};e.deselect=function(){e.set.call(this,false);
-};e.set=function(s,m,q){var o,p,r=q,n,k;function t(u){if(u){switch(s){case true:u.addSelection(r);
+}});}return m.join(",");};f.select=function(){f.set.call(this,true);};f.deselect=function(){f.set.call(this,false);
+};f.set=function(s,m,q){var o,p,r=q,n,k;function t(u){if(u){switch(s){case true:u.addSelection(r);
break;case false:u.removeSelection(true);break;default:u.toggleSelection(r);break;
}}}function j(u){if(u&&a.inArray(u,k)<0){k.push(u);n+=(n===""?"":",")+u.key;}}function l(u){a.each(k,function(w,v){t(v);
-});if(!s){u.removeSelectionFinish();}if(u.options.boundList){d.setBoundListProperties(u.options,d.getBoundList(u.options,n),s);
-}}this.filter("img,area").each(function(v,u){var w;p=d.getMapData(u);if(p!==o){if(o){l(o);
-}k=[];n="";}if(p){w="";if(u.nodeName.toUpperCase()==="IMG"){if(!d.queueCommand(p,a(u),"set",[s,m,r])){if(m instanceof Array){if(m.length){w=m.join(",");
-}}else{w=m;}if(w){a.each(i.split(w),function(x,y){j(p.getDataForKey(y.toString()));
-o=p;});}}}else{r=m;if(!d.queueCommand(p,a(u),"set",[s,r])){j(p.getDataForArea(u));
-o=p;}}}});if(p){l(p);}return this;};e.unbind=function(j){return(new d.Method(this,function(){this.clearEvents();
-this.clearMapData(j);h(this);},null,{name:"unbind",args:arguments})).go();};e.rebind=function(j){return(new d.Method(this,function(){var k=this;
-k.complete=false;k.configureOptions(j);k.bindImages(true,function(){k.buildDataset(true);
-k.complete=true;});},null,{name:"rebind",args:arguments})).go();};e.get_options=function(l,k){var j=i.isBool(l)?l:k;
-return(new d.Method(this,function(){var m=a.extend({},this.options);if(j){m.render_select=i.updateProps({},d.render_defaults,m,m.render_select);
-m.render_highlight=i.updateProps({},d.render_defaults,m,m.render_highlight);}return m;
+});if(!s){u.removeSelectionFinish();}if(u.options.boundList){c.setBoundListProperties(u.options,c.getBoundList(u.options,n),s);
+}}this.filter("img,area").each(function(v,u){var w;p=c.getMapData(u);if(p!==o){if(o){l(o);
+}k=[];n="";}if(p){w="";if(u.nodeName.toUpperCase()==="IMG"){if(!c.queueCommand(p,a(u),"set",[s,m,r])){if(m instanceof Array){if(m.length){w=m.join(",");
+}}else{w=m;}if(w){a.each(d.split(w),function(x,y){j(p.getDataForKey(y.toString()));
+o=p;});}}}else{r=m;if(!c.queueCommand(p,a(u),"set",[s,r])){j(p.getDataForArea(u));
+o=p;}}}});if(p){l(p);}return this;};f.unbind=function(j){return(new c.Method(this,function(){this.clearEvents();
+this.clearMapData(j);i(this);},null,{name:"unbind",args:arguments})).go();};f.rebind=function(j){return(new c.Method(this,function(){var k=this;
+k.complete=false;k.configureOptions(j);k.bindImages().then(function(){k.buildDataset(true);
+k.complete=true;});},null,{name:"rebind",args:arguments})).go();};f.get_options=function(l,k){var j=d.isBool(l)?l:k;
+return(new c.Method(this,function(){var m=a.extend({},this.options);if(j){m.render_select=d.updateProps({},c.render_defaults,m,m.render_select);
+m.render_highlight=d.updateProps({},c.render_defaults,m,m.render_highlight);}return m;
},function(){return j?this.effectiveOptions():this.options;},{name:"get_options",args:arguments,first:true,allowAsync:true,key:l})).go();
-};e.set_options=function(j){return(new d.Method(this,function(){g(this,j);},null,{name:"set_options",args:arguments})).go();
-};e.unload=function(){var j;for(j=d.map_cache.length-1;j>=0;j--){if(d.map_cache[j]){e.unbind.call(a(d.map_cache[j].image));
-}}e.graphics=null;};e.snapshot=function(){return(new d.Method(this,function(){a.each(this.data,function(k,j){j.selected=false;
+};f.set_options=function(j){return(new c.Method(this,function(){h(this,j);},null,{name:"set_options",args:arguments})).go();
+};f.unload=function(){var j;for(j=c.map_cache.length-1;j>=0;j--){if(c.map_cache[j]){f.unbind.call(a(c.map_cache[j].image));
+}}f.graphics=null;};f.snapshot=function(){return(new c.Method(this,function(){a.each(this.data,function(k,j){j.selected=false;
});this.base_canvas=this.graphics.createVisibleCanvas(this);a(this.image).before(this.base_canvas);
-},null,{name:"snapshot"})).go();};e.state=function(){var j,k=null;a(this).each(function(m,l){if(l.nodeName==="IMG"){j=d.getMapData(l);
-if(j){k=j.state();}return false;}});return k;};e.bind=function(j){return this.each(function(l,k){var m,n,p,o;
-m=a(k);m.css("border",0);o=d.getMapData(k);if(o){e.unbind.apply(m);if(!o.complete){m.bind();
-return true;}o=null;}p=this.getAttribute("usemap");n=p&&a('map[name="'+p.substr(1)+'"]');
-if(!(m.is("img")&&p&&n.size()>0)){return true;}if(!o){o=new d.MapData(this,j);o.index=c(o);
-o.map=n;o.bindImages(true);}});};e.init=function(l){var k,j;d.hasCanvas=(document.namespaces&&document.namespaces.g_vml_)?false:a("<canvas></canvas>")[0].getContext?true:false;
-d.isTouch="ontouchstart" in document.documentElement;if(!(d.hasCanvas||document.namespaces)){a.fn.mapster=function(){return this;
-};return;}if(!i.isBool(a.mapster.defaults.highlight)){d.render_defaults.highlight=!d.isTouch;
-}a.extend(d.defaults,d.render_defaults,d.shared_defaults);a.extend(d.area_defaults,d.render_defaults,d.shared_defaults);
-if(i.isBool(l)){d.hasCanvas=l;}if(a.browser.msie&&!d.hasCanvas&&!document.namespaces.v){document.namespaces.add("v","urn:schemas-microsoft-com:vml");
+},null,{name:"snapshot"})).go();};f.state=function(){var j,k=null;a(this).each(function(m,l){if(l.nodeName==="IMG"){j=c.getMapData(l);
+if(j){k=j.state();}return false;}});return k;};f.bind=function(j){return this.each(function(l,k){var m,n,p,o;
+m=a(k);o=c.getMapData(k);if(o){f.unbind.apply(m);if(!o.complete){m.bind();return true;
+}o=null;}p=this.getAttribute("usemap");n=p&&a('map[name="'+p.substr(1)+'"]');if(!(m.is("img")&&p&&n.size()>0)){return true;
+}m.css("border",0);if(!o){o=new c.MapData(this,j);o.index=e(o);o.map=n;o.bindImages().then(function(){o.initialize();
+});}});};f.init=function(l){var k,j;c.hasCanvas=(document.namespaces&&document.namespaces.g_vml_)?false:a("<canvas></canvas>")[0].getContext?true:false;
+c.isTouch="ontouchstart" in document.documentElement;if(!(c.hasCanvas||document.namespaces)){a.fn.mapster=function(){return this;
+};return;}a.extend(c.defaults,c.render_defaults,c.shared_defaults);a.extend(c.area_defaults,c.render_defaults,c.shared_defaults);
+if(d.isBool(l)){c.hasCanvas=l;}if(a.browser.msie&&!c.hasCanvas&&!document.namespaces.v){document.namespaces.add("v","urn:schemas-microsoft-com:vml");
k=document.createStyleSheet();j=["shape","rect","oval","circ","fill","stroke","imagedata","group","textbox"];
a.each(j,function(n,m){k.addRule("v\\:"+m,"behavior: url(#default#VML); antialias:true");
-});}a(window).bind("load",function(){d.windowLoaded=true;a(d.map_cache).each(function(n,m){if(!m.complete&&m.isReadyToBind()){m.initialize();
-}});});};e.test=function(j){return eval(j);};return e;}());a.mapster.impl.init();
-}(jQuery));
+});}};f.test=function(j){return eval(j);};return f;}());a.mapster.impl.init();}(jQuery));
View
13 src/mapdata.js
@@ -831,10 +831,15 @@
}
if (!mapArea.nohref) {
- $area.bind('mouseover.mapster', me.mouseover)
- .bind('mouseout.mapster', me.mouseout)
- .bind('click.mapster', me.click)
- .bind('mousedown.mapster', me.mousedown);
+ $area.bind('click.mapster', me.click);
+
+ if (!m.isTouch) {
+ $area.bind('mouseover.mapster', me.mouseover)
+ .bind('mouseout.mapster', me.mouseout)
+ .bind('mousedown.mapster', me.mousedown);
+
+ }
+
}
// store an ID with each area.
View
5 src/mapdata.min.js
@@ -73,8 +73,9 @@ q=a(B.map).find(E).unbind(".mapster");for(A=0;A<q.length;A++){p=0;o=q[A];m=a(o);
B.mapAreas.push(z);}y=z.keys;for(w=y.length-1;w>=0;w--){x=y[w];if(C.mapValue){u=m.attr(C.mapValue);
}if(t){p=n(B.data.length,u);s=B.data[p];s.key=x=p.toString();}else{p=B._xref[x];if(p>=0){s=B.data[p];
if(u&&!B.data[p].value){s.value=u;}}else{p=n(x,u);s=B.data[p];s.isPrimary=w===0;}}z.areaDataXref.push(p);
-s.areasXref.push(A);}v=m.attr("href");if(v&&v!=="#"&&!s.href){s.href=v;}if(!z.nohref){m.bind("mouseover.mapster",B.mouseover).bind("mouseout.mapster",B.mouseout).bind("click.mapster",B.click).bind("mousedown.mapster",B.mousedown);
-}m.data("mapster",A+1);}B.setAreaOptions(C.areas);B.redrawSelections();},processCommandQueue:function(){var m,n=this;
+s.areasXref.push(A);}v=m.attr("href");if(v&&v!=="#"&&!s.href){s.href=v;}if(!z.nohref){m.bind("click.mapster",B.click);
+if(!g.isTouch){m.bind("mouseover.mapster",B.mouseover).bind("mouseout.mapster",B.mouseout).bind("mousedown.mapster",B.mousedown);
+}}m.data("mapster",A+1);}B.setAreaOptions(C.areas);B.redrawSelections();},processCommandQueue:function(){var m,n=this;
while(!n.currentAction&&n.commands.length){m=n.commands[0];n.commands.splice(0,1);
g.impl[m.command].apply(m.that,m.args);}},clearEvents:function(){a(this.map).find("area").unbind(".mapster");
a(this.images).unbind(".mapster");},_clearCanvases:function(m){if(!m){a(this.base_canvas).remove();

0 comments on commit dc348de

Please sign in to comment.
Something went wrong with that request. Please try again.