{"version":3,"sourceRoot":"/cv/scripts/DAC0/eng/include","sources":["imageMap.js"],"sourcesContent":["// All praise to http://stackoverflow.com/a/13322059 for inspiration\r\nvar ImageMap = function ($map, $img) {\r\n var n,\r\n $areas = $('area', $map),\r\n len = $areas.length,\r\n originalCoords = [],\r\n originalWidth = $img[0].naturalWidth,\r\n previousWidth = originalWidth;\r\n for (n = 0; n < len; n++) {\r\n originalCoords[n] = $areas[n].coords.split(',');\r\n }\r\n this.resize = function () {\r\n var newWidth = $img.width();\r\n // do recalculation only if window resize actually causes an image resize (because with bootstrap CSS, it usually doesn't)\r\n if (newWidth != previousWidth) {\r\n var newCoords = [];\r\n var n, m, clen;\r\n var x = newWidth / originalWidth;\r\n for (n = 0; n < len; n++) {\r\n clen = originalCoords[n].length;\r\n newCoords[n] = [];\r\n for (m = 0; m < clen; m++) {\r\n newCoords[n][m] = originalCoords[n][m] * x;\r\n }\r\n $areas[n].coords = newCoords[n].join(',');\r\n }\r\n previousWidth = newWidth;\r\n }\r\n return true;\r\n };\r\n $(window).on('resize', this.resize);\r\n };"],"names":["ImageMap","$map","$img","$areas","$","len","length","originalCoords","originalWidth","naturalWidth","previousWidth","n","coords","split","this","resize","newWidth","width","m","clen","newCoords","x","join","window","on"],"mappings":"AACA,IAAIA,SAAW,SAAUC,EAAMC,GAOnB,IANA,IACIC,EAASC,EAAE,OAAQH,CAAI,EACvBI,EAAMF,EAAOG,OACbC,EAAiB,GACjBC,EAAgBN,EAAK,GAAGO,aACxBC,EAAgBF,EACfG,EAAI,EAAGA,EAAIN,EAAKM,CAAC,GAClBJ,EAAeI,GAAKR,EAAOQ,GAAGC,OAAOC,MAAM,GAAG,EAElDC,KAAKC,OAAS,WACV,IAAIC,EAAWd,EAAKe,MAAM,EAE1B,GAAID,GAAYN,EAAe,CAI3B,IAHA,IACOQ,EAAGC,EADNC,EAAY,GAEZC,EAAIL,EAAWR,EACdG,EAAI,EAAGA,EAAIN,EAAKM,CAAC,GAAI,CAGtB,IAFAQ,EAAOZ,EAAeI,GAAGL,OACzBc,EAAUT,GAAK,GACVO,EAAI,EAAGA,EAAIC,EAAMD,CAAC,GACnBE,EAAUT,GAAGO,GAAKX,EAAeI,GAAGO,GAAKG,EAE7ClB,EAAOQ,GAAGC,OAASQ,EAAUT,GAAGW,KAAK,GAAG,CAC5C,CACAZ,EAAgBM,CACpB,CACA,MAAO,CAAA,CACX,EACAZ,EAAEmB,MAAM,EAAEC,GAAG,SAAUV,KAAKC,MAAM,CACtC"}