'
}
}
o += "", t.shapeContainer.html(s + o)
},
addTooltips: function() {
var t = this;
if ("always" == t.settings.tooltips.fullscreen_tooltips || "mobile-only" == t.settings.tooltips.fullscreen_tooltips && isMobile()) {
t.fullscreenTooltipsContainer || ($('.imp-fullscreen-tooltips-container[data-image-map-id="' + t.settings.id + '"]').remove(), $("body").prepend('
'), t.fullscreenTooltipsContainer = $('.imp-fullscreen-tooltips-container[data-image-map-id="' + t.settings.id + '"]'));
for (var i = "", e = 0; e < t.settings.spots.length; e++) {
var s = "",
a = hexToRgb((n = t.settings.spots[e]).tooltip_style.background_color) || {
r: 0,
b: 0,
g: 0
};
if (s += "padding: " + n.tooltip_style.padding + "px;", s += "background: rgba(" + a.r + ", " + a.g + ", " + a.b + ", " + n.tooltip_style.background_opacity + ");", "none" == t.settings.tooltips.tooltip_animation && (s += "opacity: 0;"), "fade" == t.settings.tooltips.tooltip_animation && (s += "opacity: 0;", s += "transition-property: opacity;-moz-transition-property: opacity;-webkit-transition-property: opacity;"), "grow" == t.settings.tooltips.tooltip_animation && (s += "transform: scale(0, 0);-moz-transform: scale(0, 0);-webkit-transform: scale(0, 0);", s += "transition-property: transform;-moz-transition-property: -moz-transform;-webkit-transition-property: -webkit-transform;", s += "transform-origin: 50% 50%;-moz-transform-origin: 50% 50%;-webkit-transform-origin: 50% 50%;"), i += '
"
}
t.fullscreenTooltipsContainer.html(i)
} else {
for (i = "", e = 0; e < t.settings.spots.length; e++) {
var n;
s = "", a = hexToRgb((n = t.settings.spots[e]).tooltip_style.background_color) || {
r: 0,
b: 0,
g: 0
};
if (s += "border-radius: " + n.tooltip_style.border_radius + "px;", s += "padding: " + n.tooltip_style.padding + "px;", s += "background: rgba(" + a.r + ", " + a.g + ", " + a.b + ", " + n.tooltip_style.background_opacity + ");", "none" == t.settings.tooltips.tooltip_animation && (s += "opacity: 0;"), "fade" == t.settings.tooltips.tooltip_animation && (s += "opacity: 0;", s += "transition-property: opacity;-moz-transition-property: opacity;-webkit-transition-property: opacity;"), "grow" == t.settings.tooltips.tooltip_animation && (s += "transform: scale(0, 0);-moz-transform: scale(0, 0);-webkit-transform: scale(0, 0);", s += "transition-property: transform;-moz-transition-property: -moz-transform;-webkit-transition-property: -webkit-transform;", "top" == n.tooltip_style.position && (s += "transform-origin: 50% 100%;-moz-transform-origin: 50% 100%;-webkit-transform-origin: 50% 100%;"), "bottom" == n.tooltip_style.position && (s += "transform-origin: 50% 0%;-moz-transform-origin: 50% 0%;-webkit-transform-origin: 50% 0%;"), "left" == n.tooltip_style.position && (s += "transform-origin: 100% 50%;-moz-transform-origin: 100% 50%;-webkit-transform-origin: 100% 50%;"), "right" == n.tooltip_style.position && (s += "transform-origin: 0% 50%;-moz-transform-origin: 0% 50%;-webkit-transform-origin: 0% 50%;")), i += '
"
}
t.wrap.prepend(i)
}
},
initFullscreen: function() {
if (1 == parseInt(this.settings.fullscreen.enable_fullscreen_mode, 10)) {
var t = "";
t += "background: " + this.settings.fullscreen.fullscreen_button_color + "; ", t += "color: " + this.settings.fullscreen.fullscreen_button_text_color + "; ";
var i = '
';
1 == parseInt(this.settings.runtime.is_fullscreen, 10) && (i = '
');
var e = "Go Fullscreen";
1 == parseInt(this.settings.runtime.is_fullscreen, 10) && (e = "Close Fullscreen");
var s = "";
"icon" == this.settings.fullscreen.fullscreen_button_type && (s += i), "text" == this.settings.fullscreen.fullscreen_button_type && (s += e), "icon_and_text" == this.settings.fullscreen.fullscreen_button_type && (s += i + " " + e);
var a = "";
"icon" == this.settings.fullscreen.fullscreen_button_type && (a += "imp-fullscreen-button-icon-only");
var n = "";
n += '
', n += s, n += "
", this.ui.append(n), 1 == parseInt(this.settings.runtime.is_fullscreen, 10) && ($(window).scrollTop(0), fullscreenMap = this);
var o = this.ui.find(".imp-fullscreen-button");
1 != parseInt(this.settings.fullscreen.fullscreen_button_position, 10) && 4 != parseInt(this.settings.fullscreen.fullscreen_button_position, 10) || o.css({
"margin-left": -o.outerWidth() / 2
}), 1 == parseInt(this.settings.fullscreen.start_in_fullscreen_mode, 10) && 0 == this.settings.runtime.is_fullscreen && this.toggleFullscreen()
}
},
initNavigator: function() {
1 == parseInt(this.settings.zooming.enable_zooming, 10) && 1 == parseInt(this.settings.zooming.enable_navigator, 10) && (this.uiNavigatorRoot = this.ui.find(".imp-ui-navigator-root"), this.uiNavigatorImage = this.ui.find(".imp-ui-navigator-window-image"), this.adjustNavigatorSize())
},
initLayers: function() {
if (0 != parseInt(this.settings.layers.enable_layers, 10)) {
for (var t = !1, i = 0; i < this.settings.layers.layers_list.length; i++) parseInt(this.settings.layers.layers_list[i].id, 10) == parseInt(this.settings.runtime.layerID, 10) && (t = !0);
t || (this.settings.runtime.layerID = this.settings.layers.layers_list[0].id), this.wrap.find(".imp-ui-layers-select").val(this.settings.runtime.layerID)
}
},
initZoom: function() {
1 == parseInt(this.settings.zooming.enable_zooming, 10) && (this.zoom = 1, this.targetZoom = 1, this.targetPanX = 0, this.actualPanX = 0, this.targetPanY = 0, this.actualPanY = 0, this.initialPanX = 0, this.initialPanY = 0, this.panDeltaY = 0, 1 == parseInt(this.settings.zooming.limit_max_zoom_to_image_size, 10) ? this.maxZoomLevel = this.settings.general.naturalWidth / this.wrap.width() : this.maxZoomLevel = this.settings.zooming.max_zoom)
},
adjustNavigatorSize: function() {
if (0 != parseInt(this.settings.zooming.enable_zooming, 10) && 0 != parseInt(this.settings.zooming.enable_navigator, 10))
if (1 == parseInt(this.settings.runtime.is_fullscreen, 10)) {
this.navigatorRatio = this.uiNavigatorRoot.width() / this.settings.general.width;
var t = this.settings.general.naturalWidth / this.settings.general.naturalHeight,
i = window.innerWidth / window.innerHeight,
e = 0,
s = 0;
t < i ? t < 1 ? (e = 150 * t, s = 150, this.uiNavigatorWindowWidth = s * i, this.uiNavigatorWindowHeight = s, this.navigatorMarginX = e / 2 - this.uiNavigatorWindowWidth / 2, this.navigatorMarginY = 0) : (e = 150, s = 150 / t, this.uiNavigatorWindowWidth = s * i, this.uiNavigatorWindowHeight = s, this.navigatorMarginX = e / 2 - this.uiNavigatorWindowWidth / 2, this.navigatorMarginY = 0) : t < 1 ? (e = 150 * t, s = 150, this.uiNavigatorWindowWidth = e, this.uiNavigatorWindowHeight = e / i, this.navigatorMarginX = 0, this.navigatorMarginY = s / 2 - this.uiNavigatorWindowHeight / 2) : (e = 150, s = 150 / t, this.uiNavigatorWindowWidth = e, this.uiNavigatorWindowHeight = e / i, this.navigatorMarginX = 0, this.navigatorMarginY = s / 2 - this.uiNavigatorWindowHeight / 2)
} else this.navigatorRatio = this.uiNavigatorRoot.width() / this.wrap.width(), this.uiNavigatorWindowWidth = this.uiNavigatorRoot.width(), this.uiNavigatorWindowHeight = this.uiNavigatorRoot.height()
},
measureTooltipSize: function(t) {
if (!("always" == this.settings.tooltips.fullscreen_tooltips || "mobile-only" == this.settings.tooltips.fullscreen_tooltips && isMobile())) {
var i = this.settings.spots[t],
e = this.wrap.find('.imp-tooltip[data-index="' + t + '"]');
0 == parseInt(i.tooltip_style.auto_width, 10) && e.css({
width: i.tooltip_style.width
}), e.data("imp-measured-width", e.outerWidth()), e.data("imp-measured-height", e.outerHeight())
}
},
animateShapesLoop: function() {
if ("none" != this.settings.general.pageload_animation)
for (var t = 750 / this.settings.spots.length, i = shuffle(this.settings.spots.slice()), e = 0; e < i.length; e++) this.animateShape(i[e], t * e)
},
animateShape: function(t, i) {
var e = this,
s = $("#" + t.id);
setTimeout(function() {
"fade" == e.settings.general.pageload_animation && s.css({
opacity: t.default_style.opacity
}), "grow" == e.settings.general.pageload_animation && s.css({
transform: "scale(1, 1)",
"-moz-transform": "scale(1, 1)",
"-webkit-transform": "scale(1, 1)"
})
}, i)
},
events: function() {
var t = this;
this.wrap.off("mousedown"), this.wrap.on("mousedown", function(i) {
touch || t.handleEventStart(i)
}), this.wrap.off("mousemove"), this.wrap.on("mousemove", function(i) {
touch || t.handleEventMove(i)
}), this.wrap.off("mouseup"), this.wrap.on("mouseup", function(i) {
touch || t.handleEventEnd(i)
}), this.wrap.off("mousewheel"), this.wrap.on("mousewheel", function(i) {
if (!touch) return t.handleEventEnd(i), (1 != parseInt(t.settings.zooming.enable_zooming, 10) || !(i.deltaY < 0 && t.targetZoom > 1 || i.deltaY > 0 && t.targetZoom < t.maxZoomLevel)) && void 0
}), this.wrap.off("touchstart"), this.wrap.on("touchstart", function(i) {
if (touch = !0, t.handleEventStart(i), t.pinching) return !1
}), this.wrap.off("touchmove"), this.wrap.on("touchmove", function(i) {
return t.handleEventMove(i), (!t.panning || 0 == t.panDeltaY) && (!t.pinching && void 0)
}), this.wrap.off("touchend"), this.wrap.on("touchend", function(i) {
t.handleEventEnd(i)
}), $(document).off("mousemove." + this.settings.id), $(document).on("mousemove." + this.settings.id, function(i) {
if (!t.touch && (0 != $(i.target).closest(".imp-wrap").length && 0 != $(i.target).closest('[data-image-map-pro-id="' + t.settings.id + '"]').length || 0 != $(i.target).closest(".imp-fullscreen-tooltips-container").length || ("mouseover" == t.settings.tooltips.show_tooltips && 0 == $(i.target).closest("[data-imp-open-tooltip-on-mouseover]").length && 0 == $(i.target).closest("[data-imp-trigger-shape-on-mouseover]").length && t.hideAllTooltips(), 0 == $(i.target).closest("[data-imp-highlight-shape-on-mouseover]").length && 0 == $(i.target).closest("[data-imp-trigger-shape-on-mouseover]").length && t.unhighlightAllShapes()), t.panning)) {
var e = t.getEventCoordinates(i);
t.pan(e.x, e.y)
}
}), $(document).off("touchstart." + this.settings.id), $(document).on("touchstart." + this.settings.id, function(i) {
0 != $(i.target).closest(".imp-wrap").length && 0 != $(i.target).closest('[data-image-map-pro-id="' + t.settings.id + '"]').length || 0 != $(i.target).closest(".imp-fullscreen-tooltips-container").length || ("mouseover" == t.settings.tooltips.show_tooltips && 0 == $(i.target).closest("[data-imp-open-tooltip-on-mouseover]").length && 0 == $(i.target).closest("[data-imp-trigger-shape-on-mouseover]").length && t.hideAllTooltips(), 0 == $(i.target).closest("[data-imp-highlight-shape-on-mouseover]").length && 0 == $(i.target).closest("[data-imp-trigger-shape-on-mouseover]").length && t.unhighlightAllShapes())
}), $(document).off("mouseup." + this.settings.id), $(document).on("mouseup." + this.settings.id, function(i) {
t.touch || (0 != $(i.target).closest(".imp-wrap").length && 0 != $(i.target).closest('[data-image-map-pro-id="' + t.settings.id + '"]').length || 0 != $(i.target).closest(".imp-fullscreen-tooltips-container").length || ("click" == t.settings.tooltips.show_tooltips && t.hideAllTooltips(), t.unhighlightAllShapes()), t.panning && (t.panning = !1))
}), $(document).off("touchend." + this.settings.id), $(document).on("touchend." + this.settings.id, function(i) {
0 != $(i.target).closest(".imp-wrap").length && 0 != $(i.target).closest('[data-image-map-pro-id="' + t.settings.id + '"]').length || 0 != $(i.target).closest(".imp-fullscreen-tooltips-container").length || ("click" == t.settings.tooltips.show_tooltips && t.hideAllTooltips(), t.unhighlightAllShapes())
}), $(document).off("click." + this.settings.id, ".imp-tooltip-close-button"), $(document).on("click." + this.settings.id, ".imp-tooltip-close-button", function() {
t.hideAllTooltips()
}), $(document).off("change." + this.settings.id, ".imp-ui-layers-select"), $(document).on("change." + this.settings.id, ".imp-ui-layers-select", function() {
var i = t.wrap.find(".imp-ui-layers-select").val();
t.switchLayer(i)
})
},
APIEvents: function() {
var t = this;
$(document).on("mouseover", "[data-imp-highlight-shape-on-mouseover]", function() {
var i = $(this).data("imp-highlight-shape-on-mouseover"),
e = $(this).data("imp-image-map-name");
if (e || (e = t.settings.general.name), e == t.settings.general.name) {
var s = $('[data-shape-title="' + i + '"]').data("index");
t.highlightShape(s, !0)
}
}), $(document).on("mouseout", "[data-imp-highlight-shape-on-mouseover]", function() {
$(this).data("imp-highlight-shape-on-mouseover");
var i = $(this).data("imp-image-map-name");
i || (i = t.settings.general.name), i == t.settings.general.name && t.unhighlightAllShapes()
}), $(document).on("click", "[data-imp-highlight-shape-on-click]", function() {
var i = $(this).data("imp-highlight-shape-on-click"),
e = $(this).data("imp-image-map-name");
if (e || (e = t.settings.general.name), e == t.settings.general.name) {
var s = $('[data-shape-title="' + i + '"]').data("index"),
a = t.settings.spots[s];
if (t.highlightShape(s, !0), -1 == instances[e].apiHighlightedShapes.indexOf(s) && instances[e].apiHighlightedShapes.push(s), instances[e].connectedShapes[a.id])
for (var n = 0; n < instances[e].connectedShapes[a.id].length; n++) {
var o = instances[e].connectedShapes[a.id][n].index; - 1 == instances[e].apiHighlightedShapes.indexOf(o) && instances[e].apiHighlightedShapes.push(o)
}
}
}), $(document).on("mouseover", "[data-imp-unhighlight-shape-on-mouseover]", function() {
var i = $(this).data("imp-unhighlight-shape-on-mouseover"),
e = $(this).data("imp-image-map-name");
if (e || (e = t.settings.general.name), e == t.settings.general.name) {
var s = $('[data-shape-title="' + i + '"]').data("index"),
a = t.settings.spots[s];
if (-1 != instances[e].apiHighlightedShapes.indexOf(s)) {
var n = instances[e].apiHighlightedShapes.indexOf(s);
instances[e].apiHighlightedShapes.splice(n, 1)
}
if (instances[e].connectedShapes[a.id])
for (var o = 0; o < instances[e].connectedShapes[a.id].length; o++) {
var h = instances[e].connectedShapes[a.id][o].index,
l = instances[e].apiHighlightedShapes.indexOf(h);
instances[e].apiHighlightedShapes.splice(l, 1), instances[e].unhighlightShape(h)
}
t.unhighlightShape(s)
}
}), $(document).on("click", "[data-imp-unhighlight-shape-on-click]", function() {
var i = $(this).data("imp-unhighlight-shape-on-click"),
e = $(this).data("imp-image-map-name");
if (e || (e = t.settings.general.name), e == t.settings.general.name) {
var s = $('[data-shape-title="' + i + '"]').data("index"),
a = t.settings.spots[s];
if (-1 != instances[e].apiHighlightedShapes.indexOf(s)) {
var n = instances[e].apiHighlightedShapes.indexOf(s);
instances[e].apiHighlightedShapes.splice(n, 1)
}
if (instances[e].connectedShapes[a.id])
for (var o = 0; o < instances[e].connectedShapes[a.id].length; o++) {
var h = instances[e].connectedShapes[a.id][o].index,
l = instances[e].apiHighlightedShapes.indexOf(h);
instances[e].apiHighlightedShapes.splice(l, 1), instances[e].unhighlightShape(h)
}
t.unhighlightShape(s)
}
}), $(document).on("mouseover", "[data-imp-open-tooltip-on-mouseover]", function() {
var i = $(this).data("imp-open-tooltip-on-mouseover"),
e = $(this).data("imp-image-map-name");
if (e || (e = t.settings.general.name), e == t.settings.general.name) {
var s = $('[data-shape-title="' + i + '"]').data("index");
t.showTooltip(s), t.updateTooltipPosition(s)
}
}), $(document).on("mouseout", "[data-imp-open-tooltip-on-mouseover]", function() {
$(this).data("imp-open-tooltip-on-mouseover");
var i = $(this).data("imp-image-map-name");
i || (i = t.settings.general.name), i == t.settings.general.name && t.hideAllTooltips()
}), $(document).on("click", "[data-imp-open-tooltip-on-click]", function() {
var i = $(this).data("imp-open-tooltip-on-click"),
e = $(this).data("imp-image-map-name");
if (e || (e = t.settings.general.name), e == t.settings.general.name) {
var s = $('[data-shape-title="' + i + '"]').data("index");
t.showTooltip(s), t.updateTooltipPosition(s), -1 == instances[e].apiOpenedTooltips.indexOf(s) && instances[e].apiOpenedTooltips.push(s)
}
}), $(document).on("mouseover", "[data-imp-close-tooltip-on-mouseover]", function() {
var i = $(this).data("imp-close-tooltip-on-mouseover"),
e = $(this).data("imp-image-map-name");
if (e || (e = t.settings.general.name), e == t.settings.general.name) {
var s = $('[data-shape-title="' + i + '"]').data("index");
if (-1 != instances[e].apiOpenedTooltips.indexOf(s)) {
var a = instances[e].apiOpenedTooltips.indexOf(s);
instances[e].apiOpenedTooltips.splice(a, 1)
}
t.hideTooltip(s)
}
}), $(document).on("click", "[data-imp-close-tooltip-on-click]", function() {
var i = $(this).data("imp-close-tooltip-on-click"),
e = $(this).data("imp-image-map-name");
if (e || (e = t.settings.general.name), e == t.settings.general.name) {
var s = $('[data-shape-title="' + i + '"]').data("index");
if (-1 != instances[e].apiOpenedTooltips.indexOf(s)) {
var a = instances[e].apiOpenedTooltips.indexOf(s);
instances[e].apiOpenedTooltips.splice(a, 1)
}
t.hideTooltip(s)
}
}), $(document).on("mouseover", "[data-imp-trigger-shape-on-mouseover]", function() {
var i = $(this).data("imp-trigger-shape-on-mouseover"),
e = $(this).data("imp-image-map-name");
if (e || (e = t.settings.general.name), e == t.settings.general.name) {
var s = $('[data-shape-title="' + i + '"]').data("index");
t.highlightShape(s, !0), t.showTooltip(s), t.updateTooltipPosition(s)
}
}), $(document).on("mouseout", "[data-imp-trigger-shape-on-mouseover]", function() {
$(this).data("imp-trigger-shape-on-mouseover");
var i = $(this).data("imp-image-map-name");
i || (i = t.settings.general.name), i == t.settings.general.name && (t.unhighlightAllShapes(), t.hideAllTooltips())
}), $(document).on("click", "[data-imp-trigger-shape-on-click]", function() {
var i = $(this).data("imp-trigger-shape-on-click"),
e = $(this).data("imp-image-map-name");
if (e || (e = t.settings.general.name), e == t.settings.general.name) {
var s = $('[data-shape-title="' + i + '"]').data("index"),
a = t.settings.spots[s];
if (t.highlightShape(s, !0), t.showTooltip(s), t.updateTooltipPosition(s), -1 == instances[e].apiOpenedTooltips.indexOf(s) && instances[e].apiOpenedTooltips.push(s), -1 == instances[e].apiHighlightedShapes.indexOf(s) && instances[e].apiHighlightedShapes.push(s), instances[e].connectedShapes[a.id])
for (var n = 0; n < instances[e].connectedShapes[a.id].length; n++) {
var o = instances[e].connectedShapes[a.id][n].index; - 1 == instances[e].apiHighlightedShapes.indexOf(o) && instances[e].apiHighlightedShapes.push(o)
}
}
}), $(document).on("mouseover", "[data-imp-untrigger-shape-on-mouseover]", function() {
var i = $(this).data("imp-untrigger-shape-on-mouseover"),
e = $(this).data("imp-image-map-name");
if (e || (e = t.settings.general.name), e == t.settings.general.name) {
var s = $('[data-shape-title="' + i + '"]').data("index"),
a = t.settings.spots[s];
if (-1 != instances[e].apiHighlightedShapes.indexOf(s)) {
var n = instances[e].apiHighlightedShapes.indexOf(s);
instances[e].apiHighlightedShapes.splice(n, 1)
}
if (instances[e].connectedShapes[a.id])
for (var o = 0; o < instances[e].connectedShapes[a.id].length; o++) {
var h = instances[e].connectedShapes[a.id][o].index,
l = instances[e].apiHighlightedShapes.indexOf(h);
instances[e].apiHighlightedShapes.splice(l, 1), instances[e].unhighlightShape(h)
}
if (t.unhighlightShape(s), -1 != instances[e].apiOpenedTooltips.indexOf(s)) {
n = instances[e].apiOpenedTooltips.indexOf(s);
instances[e].apiOpenedTooltips.splice(n, 1)
}
t.hideTooltip(s)
}
}), $(document).on("click", "[data-imp-untrigger-shape-on-click]", function() {
var i = $(this).data("imp-untrigger-shape-on-click"),
e = $(this).data("imp-image-map-name");
if (e || (e = t.settings.general.name), e == t.settings.general.name) {
var s = $('[data-shape-title="' + i + '"]').data("index"),
a = t.settings.spots[s];
if (-1 != instances[e].apiHighlightedShapes.indexOf(s)) {
var n = instances[e].apiHighlightedShapes.indexOf(s);
instances[e].apiHighlightedShapes.splice(n, 1)
}
if (instances[e].connectedShapes[a.id])
for (var o = 0; o < instances[e].connectedShapes[a.id].length; o++) {
var h = instances[e].connectedShapes[a.id][o].index,
l = instances[e].apiHighlightedShapes.indexOf(h);
instances[e].apiHighlightedShapes.splice(l, 1), instances[e].unhighlightShape(h)
}
if (t.unhighlightShape(s), -1 != instances[e].apiOpenedTooltips.indexOf(s)) {
n = instances[e].apiOpenedTooltips.indexOf(s);
instances[e].apiOpenedTooltips.splice(n, 1)
}
t.hideTooltip(s)
}
})
},
disableEvents: function() {
this.wrap.off("mousemove"), this.wrap.off("mouseup"), this.wrap.off("touchstart"), this.wrap.off("touchmove"), this.wrap.off("touchend"), $(document).off("mousemove." + this.settings.id), $(document).off("touchstart." + this.settings.id), $(document).off("click." + this.settings.id, ".imp-tooltip-close-button"), $(document).off("click." + this.settings.id, ".imp-fullscreen-button")
},
handleEventStart: function(t) {
var i = this.getEventCoordinates(t);
if (1 == parseInt(this.settings.zooming.enable_zooming, 10)) {
if ($(t.target).closest(".imp-ui-navigator-root").length > 0) return this.ix = i.x, this.iy = i.y, void(this.panningOnNavigator = !0);
if (t.originalEvent.touches && t.originalEvent.touches.length > 1) return this.pinchInitial[0] = {
x: t.originalEvent.touches[0].pageX,
y: t.originalEvent.touches[0].pageY
}, this.pinchInitial[1] = {
x: t.originalEvent.touches[1].pageX,
y: t.originalEvent.touches[1].pageY
}, this.initialPanX = this.actualPanX, this.initialPanY = this.actualPanY, this.ix = (t.originalEvent.touches[0].pageX + t.originalEvent.touches[1].pageX) / 2, this.iy = (t.originalEvent.touches[0].pageY + t.originalEvent.touches[1].pageY) / 2, this.lastX = this.ix, this.lastY = this.iy, this.pinchInitialDistance = Math.sqrt(Math.pow(this.pinchInitial[1].x - this.pinchInitial[0].x, 2) + Math.pow(this.pinchInitial[1].y - this.pinchInitial[0].y, 2)), this.pinchInitialZoom = this.zoom, void(this.pinching = !0);
this.panning || 0 != $(t.target).closest(".imp-ui").length || (this.ix = i.x, this.iy = i.y, this.initialPanX = this.actualPanX, this.initialPanY = this.actualPanY, this.panning = !0)
}
},
handleEventMove: function(t) {
if (!this.fullscreenTooltipVisible) {
var i = this.getEventRelativeCoordinates(t),
e = this.matchShapeToCoords(i);
if (1 == parseInt(this.settings.zooming.enable_zooming, 10)) {
if (this.panningOnNavigator) {
var s = ((n = this.getEventCoordinates(t)).x - this.uiNavigatorRoot.offset().left) / this.navigatorRatio * this.targetZoom,
a = (n.y - this.uiNavigatorRoot.offset().top) / this.navigatorRatio * this.targetZoom;
return void this.panTo(s, a)
}
if (this.pinching) return this.pinch(t), void(this.didPan = !0);
if (this.panning) {
var n = this.getEventCoordinates(t);
return this.pan(n.x, n.y), void(this.didPan = !0)
}
}
if (!this.isPointInsideVisibleTooltip(t) || 0 != parseInt(this.settings.tooltips.sticky_tooltips, 10)) {
if (1 == $(t.target).closest(".imp-ui").length) return this.unhighlightAllShapes(), void("mouseover" == this.settings.tooltips.show_tooltips && this.hideAllTooltips()); - 1 != e && (this.didPan || (this.isShapeHighlighted(e) || (this.unhighlightAllShapes(), "mouseover" == this.settings.tooltips.show_tooltips && this.hideAllTooltips(), this.highlightShape(e, !0)), "mouseover" == this.settings.tooltips.show_tooltips && 1 == parseInt(this.settings.tooltips.enable_tooltips, 10) && 1 == parseInt(this.settings.spots[e].tooltip_style.enable_tooltip, 10) && this.showTooltip(e), this.openedTooltips.length > 0 && 1 == parseInt(this.settings.tooltips.sticky_tooltips, 10) && "mouseover" == this.settings.tooltips.show_tooltips && this.updateTooltipPosition(this.openedTooltips[this.openedTooltips.length - 1], t))), -1 == e && (this.unhighlightAllShapes(), "mouseover" == this.settings.tooltips.show_tooltips && this.hideAllTooltips())
}
}
},
handleEventEnd: function(t) {
if (1 == parseInt(this.settings.zooming.enable_zooming, 10)) {
if ("mousewheel" == t.type) return t.deltaY > 0 && this.zoomIn(t), void(t.deltaY < 0 && this.zoomOut(t));
if (this.panningOnNavigator && (this.panningOnNavigator = !1), $(t.target).closest(".imp-ui-navigator-root").length > 0) {
var i = this.getEventCoordinates(t),
e = (i.x - this.uiNavigatorRoot.offset().left) / this.navigatorRatio * this.targetZoom,
s = (i.y - this.uiNavigatorRoot.offset().top) / this.navigatorRatio * this.targetZoom;
return void this.panTo(e, s)
}
if ($(t.target).closest(".imp-ui-zoom-button").length > 0) return void($(t.target).closest(".imp-ui-zoom-button-zoom-in").length > 0 ? this.zoomIn() : this.zoomOut());
this.panning && (this.panning = !1), this.pinching && (this.pinching = !1)
}
if ($(t.target).closest(".imp-fullscreen-button").length > 0 && this.toggleFullscreen(), $(t.target).closest(".imp-ui-layer-switch-up").length > 0)
for (var a = 0; a < this.settings.layers.layers_list.length; a++)
if (this.settings.layers.layers_list[a].id == this.settings.runtime.layerID && a > 0) {
var n = this.settings.layers.layers_list[a - 1].id;
this.switchLayer(n);
break
}
if ($(t.target).closest(".imp-ui-layer-switch-down").length > 0)
for (a = 0; a < this.settings.layers.layers_list.length; a++)
if (this.settings.layers.layers_list[a].id == this.settings.runtime.layerID && a < this.settings.layers.layers_list.length - 1) {
n = this.settings.layers.layers_list[a + 1].id;
this.switchLayer(n);
break
}
if (0 == $(t.target).closest(".imp-tooltip").length && !this.fullscreenTooltipVisible) {
if (1 == $(t.target).closest(".imp-ui").length) return this.unhighlightAllShapes(), void("mouseover" == this.settings.tooltips.show_tooltips && this.hideAllTooltips());
var o = this.getEventRelativeCoordinates(t); - 1 != (a = this.matchShapeToCoords(o)) && (this.didPan || (this.isShapeHighlighted(a) || (this.unhighlightAllShapes(), "mouseover" == this.settings.tooltips.show_tooltips && this.hideAllTooltips(), this.highlightShape(a, !0)), 1 == parseInt(this.settings.tooltips.enable_tooltips, 10) && 1 == parseInt(this.settings.spots[a].tooltip_style.enable_tooltip, 10) && this.showTooltip(a), this.openedTooltips.length > 0 && 1 == parseInt(this.settings.tooltips.sticky_tooltips, 10) && "mouseover" == this.settings.tooltips.show_tooltips && this.updateTooltipPosition(this.openedTooltips[this.openedTooltips.length - 1], t)), this.performClickAction(a)), -1 == a && (this.hideAllTooltips(), this.didPan || this.unhighlightAllShapes()), t.originalEvent.touches && 0 == t.originalEvent.touches.length && (this.didPan = !1), t.originalEvent.touches || (this.didPan = !1)
}
},
getEventRelativeCoordinates: function(t) {
var i, e;
if ("touchstart" == t.type || "touchmove" == t.type || "touchend" == t.type || "touchcancel" == t.type) {
var s = t.originalEvent.touches[0] || t.originalEvent.changedTouches[0];
i = s.pageX, e = s.pageY
} else "mousedown" != t.type && "mouseup" != t.type && "mousemove" != t.type && "mouseover" != t.type && "mouseout" != t.type && "mouseenter" != t.type && "mouseleave" != t.type || (i = t.pageX, e = t.pageY);
return i -= this.zoomWrap.offset().left, e -= this.zoomWrap.offset().top, {
x: i = i / (this.wrap.width() * this.zoom) * 100,
y: e = e / (this.wrap.height() * this.zoom) * 100
}
},
getEventCoordinates: function(t) {
var i, e;
if ("touchstart" == t.type || "touchmove" == t.type || "touchend" == t.type || "touchcancel" == t.type) {
var s = t.originalEvent.touches[0] || t.originalEvent.changedTouches[0];
i = s.pageX, e = s.pageY
} else "mousedown" != t.type && "mouseup" != t.type && "mousemove" != t.type && "mouseover" != t.type && "mouseout" != t.type && "mouseenter" != t.type && "mouseleave" != t.type || (i = t.pageX, e = t.pageY);
return {
x: i,
y: e
}
},
matchShapeToCoords: function(t) {
for (var i = this.settings.spots.length - 1; i >= 0; i--)
if (1 != parseInt(this.settings.layers.enable_layers, 10) || parseInt(this.settings.spots[i].layerID, 10) == parseInt(this.settings.runtime.layerID)) {
var e = this.settings.spots[i];
if ("poly" == e.type) {
var s = t.x / 100 * this.zoomWrap.width(),
a = t.y / 100 * this.zoomWrap.height();
if (isPointInsidePolygon(s = s * this.settings.general.naturalWidth / this.zoomWrap.width(), a = a * this.settings.general.naturalHeight / this.zoomWrap.height(), e.vs)) return i
}
if ("spot" == e.type) {
var n = e.width < 44 ? 44 : e.width,
o = e.height < 44 ? 44 : e.height;
n /= this.zoom, o /= this.zoom;
var s = t.x / 100 * this.wrap.width(),
a = t.y / 100 * this.wrap.height(),
h = e.x / 100 * this.wrap.width() - n / 2,
l = e.y / 100 * this.wrap.height() - o / 2,
r = n,
p = o;
if (1 == parseInt(e.default_style.icon_is_pin, 10) && 1 == parseInt(e.default_style.use_icon, 10) && (l -= o / 2, e.height < 44 && (l += e.height / 2)), isPointInsideRect(s, a, h, l, r, p)) return i
}
if ("rect" == e.type && isPointInsideRect(t.x, t.y, e.x, e.y, e.width, e.height)) return i;
if ("oval" == e.type)
if (isPointInsideEllipse(s = t.x, a = t.y, e.x + e.width / 2, e.y + e.height / 2, h = e.width / 2, l = e.height / 2)) return i;
e.type
}
return -1
},
isPointInsideVisibleTooltip: function(t) {
for (var i = 0; i < this.openedTooltips.length; i++) {
var e = this.getEventCoordinates(t),
s = this.wrap.find('.imp-tooltip[data-index="' + this.openedTooltips[i] + '"]'),
a = this.openedTooltips[i];
e.x = (e.x - this.wrap.offset().left) / this.wrap.width() * 100, e.y = (e.y - this.wrap.offset().top) / this.wrap.height() * 100;
var n = 0;
n = "spot" == this.settings.spots[a].type ? this.settings.spots[a].tooltip_style.buffer : this.settings.spots[a].tooltip_style.buffer * this.zoom;
var o = s.outerWidth(),
h = s.outerHeight(),
l = s.offset().left - this.wrap.offset().left,
r = s.offset().top - this.wrap.offset().top;
l = l / this.wrap.width() * 100, r = r / this.wrap.height() * 100, o = o / this.wrap.width() * 100, h = h / this.wrap.height() * 100;
var p = [];
if ("left" == this.settings.spots[a].tooltip_style.position) p = [
[l, r],
[l + o, r],
[l + o + (n = n / this.wrap.width() * 100), r + h - h / 3 - h / 3],
[l + o + n, r + h - h / 3],
[l + o, r + h],
[l, r + h]
];
if ("right" == this.settings.spots[a].tooltip_style.position) p = [
[l, r],
[l + o, r],
[l + o, r + h],
[l, r + h],
[l - (n = n / this.wrap.width() * 100), r + h - h / 3],
[l - n, r + h - h / 3 - h / 3]
];
if ("top" == this.settings.spots[a].tooltip_style.position) p = [
[l, r],
[l + o, r],
[l + o, r + h],
[l + o - o / 3, r + h + (n = n / this.wrap.height() * 100)],
[l + o - o / 3 - o / 3, r + h + n],
[l, r + h]
];
if ("bottom" == this.settings.spots[a].tooltip_style.position) p = [
[l, r],
[l + o - o / 3 - o / 3, r - (n = n / this.wrap.height() * 100)],
[l + o - o / 3, r - n],
[l + o, r],
[l + o, r + h],
[l, r + h]
];
return !!isPointInsidePolygon(e.x, e.y, p)
}
},
getIndexOfShapeWithID: function(t) {
for (var i = 0; i < this.settings.spots.length; i++)
if (this.settings.spots[i].id == t) return i
},
calcStyles: function(t, i) {
var e = this.settings.spots[i],
s = "";
if ("spot" == e.type) {
s += "left: " + e.x + "%;", s += "top: " + e.y + "%;", s += "width: " + e.width + "px;", s += "height: " + e.height + "px;", s += "opacity: " + t.opacity + ";", s += "transform: scale(" + 1 / this.zoom + ");";
var a = -e.width / 2,
n = -e.height / 2;
if (0 == parseInt(e.default_style.use_icon, 10)) {
var o = hexToRgb(t.background_color) || {
r: 0,
b: 0,
g: 0
},
h = hexToRgb(t.border_color) || {
r: 0,
b: 0,
g: 0
};
s += "border-radius: " + t.border_radius + "px;", s += "background: rgba(" + o.r + ", " + o.g + ", " + o.b + ", " + t.background_opacity + ");", s += "border-width: " + t.border_width + "px;", s += "border-style: " + t.border_style + ";", s += "border-color: rgba(" + h.r + ", " + h.g + ", " + h.b + ", " + t.border_opacity + ");"
}
1 == parseInt(e.default_style.use_icon, 10) && 1 == parseInt(e.default_style.icon_is_pin, 10) && (a = -e.height), s += "margin-left: " + n + "px;", s += "margin-top: " + a + "px;"
}
if ("text" == e.type) {
var l = hexToRgb(e.text.text_color);
s += "left: " + e.x + "%;", s += "top: " + e.y + "%;", s += "font-family: " + e.text.font_family + ";", s += "font-size: " + e.text.font_size + "px;", s += "font-weight: " + e.text.font_weight + ";", s += "color: rgba(" + l.r + ", " + l.g + ", " + l.b + ", " + e.text.text_opacity + ");"
}
if ("rect" == e.type || "oval" == e.type) {
var r = t.border_radius + "px";
"oval" == e.type && (r = "50% 50%");
o = hexToRgb(t.background_color) || {
r: 0,
b: 0,
g: 0
}, h = hexToRgb(t.border_color) || {
r: 0,
b: 0,
g: 0
};
s += "left: " + e.x + "%;", s += "top: " + e.y + "%;", s += "width: " + e.width + "%;", s += "height: " + e.height + "%;", s += "opacity: " + t.opacity + ";", s += "background: rgba(" + o.r + ", " + o.g + ", " + o.b + ", " + t.background_opacity + ");", s += "border-width: " + t.border_width + "px;", s += "border-style: " + t.border_style + ";", s += "border-color: rgba(" + h.r + ", " + h.g + ", " + h.b + ", " + t.border_opacity + ");", s += "border-radius: " + r + ";"
}
if ("poly" == e.type) {
var p = hexToRgb(t.fill) || {
r: 0,
b: 0,
g: 0
},
g = hexToRgb(t.stroke_color) || {
r: 0,
b: 0,
g: 0
};
s += "opacity: " + t.opacity + ";", s += "fill: rgba(" + p.r + ", " + p.g + ", " + p.b + ", " + t.fill_opacity + ");", s += "stroke: rgba(" + g.r + ", " + g.g + ", " + g.b + ", " + t.stroke_opacity + ");", s += "stroke-width: " + t.stroke_width + "px;", s += "stroke-dasharray: " + t.stroke_dasharray + ";", s += "stroke-linecap: " + t.stroke_linecap + ";"
}
return s
},
applyStyles: function(t, i) {
var e = this.settings.spots[i],
s = this.wrap.find("#" + e.id),
a = this.calcStyles(t, i);
s.attr("style", a), "spot" == e.type && s.find("path").length > 0 && s.find("path").attr("style", "fill:" + t.icon_fill)
},
highlightShape: function(t, i) {
var e = this.settings.spots[t];
if (i && "" != e.connected_to) {
var s = this.getIndexOfShapeWithID(e.connected_to);
this.highlightShape(s, !0)
} else {
if (this.connectedShapes[e.id])
for (var a = 0; a < this.connectedShapes[e.id].length; a++) {
s = this.connectedShapes[e.id][a].index;
this.highlightShape(s, !1)
}
this.applyStyles(this.settings.spots[t].mouseover_style, t), $.imageMapProEventHighlightedShape(this.settings.general.name, e.title), -1 == this.highlightedShapes.indexOf(t) && this.highlightedShapes.push(t)
}
},
unhighlightShape: function(t) {
var i = this.settings.spots[t];
if (-1 == this.apiHighlightedShapes.indexOf(t)) {
this.applyStyles(i.default_style, t), $.imageMapProEventUnhighlightedShape(this.settings.general.name, i.title);
var e = this.highlightedShapes.indexOf(t);
this.highlightedShapes.splice(e, 1)
}
},
unhighlightAllShapes: function() {
for (var t = this.highlightedShapes.slice(0), i = 0; i < t.length; i++) this.unhighlightShape(t[i])
},
isShapeHighlighted: function(t) {
for (var i = 0; i < this.highlightedShapes.length; i++)
if (this.highlightedShapes[i] == t) return !0;
return !1
},
performClickAction: function(i) {
var s = this.settings.spots[i];
"follow-link" == s.actions.click && (0 == $("#imp-temp-link").length && $("body").append('
'), $("#imp-temp-link").attr("href", s.actions.link), 1 == parseInt(s.actions.open_link_in_new_window, 10) ? $("#imp-temp-link").attr("target", "_blank") : $("#imp-temp-link").removeAttr("target"), $("#imp-temp-link")[0].click()), "run-script" == s.actions.click && eval(s.actions.script.replace("
", "")), $.imageMapProEventClickedShape(this.settings.general.name, this.settings.spots[i].title)
},
showTooltip: function(t, i) {
var e = this.settings.spots[t];
if ("" == e.connected_to || 1 != parseInt(e.use_connected_shape_tooltip, 10)) {
if (-1 == this.openedTooltips.indexOf(t)) {
if (this.openedTooltips.length > 0 && this.hideAllTooltips(), -1 == this.openedTooltips.indexOf(t) && this.openedTooltips.push(t), "mobile-only" == this.settings.tooltips.fullscreen_tooltips && isMobile() || "always" == this.settings.tooltips.fullscreen_tooltips) {
this.visibleFullscreenTooltip = $('.imp-fullscreen-tooltip[data-index="' + t + '"]'), this.visibleFullscreenTooltipIndex = t, this.fullscreenTooltipsContainer.show(), this.visibleFullscreenTooltip.show();
var s = this;
setTimeout(function() {
s.visibleFullscreenTooltip.addClass("imp-tooltip-visible")
}, 20), this.fullscreenTooltipVisible = !0, this.bodyOverflow = $("body").css("overflow"), $("body").css({
overflow: "hidden"
})
} else {
var a = this.wrap.find('.imp-tooltip[data-index="' + t + '"]');
a.show(), setTimeout(function() {
a.addClass("imp-tooltip-visible")
}, 1), this.measureTooltipSize(t), this.updateTooltipPosition(t, i)
}
$.imageMapProEventOpenedTooltip(this.settings.general.name, this.settings.spots[t].title)
}
} else {
var n = this.getIndexOfShapeWithID(e.connected_to);
this.showTooltip(n)
}
},
hideTooltip: function(t) {
if (-1 == this.apiOpenedTooltips.indexOf(t)) {
var i = this.openedTooltips.indexOf(t);
if (this.openedTooltips.splice(i, 1), "mobile-only" == this.settings.tooltips.fullscreen_tooltips && isMobile() || "always" == this.settings.tooltips.fullscreen_tooltips) {
var e = this;
(s = this.fullscreenTooltipsContainer.find('.imp-fullscreen-tooltip[data-index="' + t + '"]')).removeClass("imp-tooltip-visible"), setTimeout(function() {
e.fullscreenTooltipsContainer.hide(), s.hide()
}, 200), this.fullscreenTooltipVisible = !1, $("body").css({
overflow: this.bodyOverflow
})
} else {
var s;
(s = this.wrap.find('.imp-tooltip[data-index="' + t + '"]')).removeClass("imp-tooltip-visible"), setTimeout(function() {
s.hide()
}, 200)
}
$.imageMapProEventClosedTooltip(this.settings.general.name, this.settings.spots[t].title)
}
},
hideAllTooltips: function() {
for (var t = this.openedTooltips.slice(0), i = 0; i < t.length; i++) this.hideTooltip(t[i])
},
updateTooltipPosition: function(t, i) {
if (!this.fullscreenTooltipVisible) {
var e, s, a, n, o, h, l, r;
s = (e = this.wrap.find('.imp-tooltip[data-index="' + t + '"]')).data("imp-measured-width"), a = e.data("imp-measured-height"), r = this.settings.spots[t];
var p, g, d = this.wrap.width(),
c = this.wrap.height(),
u = this.wrap.offset().left,
m = this.wrap.offset().top,
f = window.innerWidth,
v = window.innerHeight;
if (1 == parseInt(this.settings.tooltips.sticky_tooltips, 10) && i) {
var w = this.getEventCoordinates(i);
n = w.x - u, o = w.y - m, h = 0, l = 0
} else h = r.width / 100 * d, l = r.height / 100 * c, h *= this.zoom, l *= this.zoom, n = Math.round(10 * r.x) / 10 / 100 * d, o = Math.round(10 * r.y) / 10 / 100 * c, n = n * this.zoom + this.actualPanX, o = o * this.zoom + this.actualPanY;
"spot" == r.type && (n -= r.width / 2, o -= r.height / 2, h = r.width, l = r.height), "spot" == r.type && 1 == parseInt(r.default_style.icon_is_pin, 10) && "spot" == r.type && 1 == parseInt(r.default_style.use_icon, 10) && (o -= l / 2), 1 == parseInt(this.settings.runtime.is_fullscreen, 10) ? (n + u < 0 && (h = h + n + u, n = -u), n + u + h > f && (h += f - (n + u + h)), o + m < 0 && (l = l + o + m, o = -m), o + m + l > v && (l += v - (o + m + l))) : (n < 0 && (h += n, n = 0), n + h > d && (h = d - n), o < 0 && (l += o, o = 0), o + l > c && (l = c - o)), "left" == r.tooltip_style.position && (p = n - s - 20, g = o + l / 2 - a / 2), "right" == r.tooltip_style.position && (p = n + h + 20, g = o + l / 2 - a / 2), "top" == r.tooltip_style.position && (p = n + h / 2 - s / 2, g = o - a - 20), "bottom" == r.tooltip_style.position && (p = n + h / 2 - s / 2, g = o + l + 20);
var y = {
x: p,
y: g
};
1 == parseInt(this.settings.tooltips.constrain_tooltips, 10) && ((y = fitRectToScreen(p + u, g + m, s, a)).x -= u, y.y -= m), 1 == parseInt(this.settings.runtime.is_fullscreen, 10) && (y.x += u, y.y += m), e.css({
left: y.x,
top: y.y
})
}
},
toggleFullscreen: function() {
if (0 == parseInt(this.settings.runtime.is_fullscreen, 10)) {
$("body").addClass("imp-fullscreen-mode");
var t = $.extend(!0, {}, this.settings);
t.runtime.is_fullscreen = 1, t.id = "999999", t.general.responsive = 0;
var i = "";
i += "background: " + this.settings.fullscreen.fullscreen_background, $("body").append('
'), $("#image-map-pro-" + t.id).imageMapPro(t), this.disableEvents(), fullscreenMapParent = this
} else $("body").removeClass("imp-fullscreen-mode"), $("#imp-fullscreen-wrap").remove(), this.disableEvents(), fullscreenMapParent.events()
},
resetZoomAndPan: function() {
this.zoom = 1, this.targetZoom = 1, this.targetPanX = 0, this.targetPanY = 0, this.actualPanX = 0, this.actualPanY = 0, this.redraw()
},
zoomIn: function(t) {
if (this.targetZoom < this.maxZoomLevel) {
var i = this.zoom * this.zoomMultiplier,
e = 0,
s = 0,
a = this.wrap.width(),
n = this.wrap.height();
t ? (e = t.pageX, s = t.pageY) : (e = this.wrap.offset().left + a / 2, s = this.wrap.offset().top + n / 2), this.applyZoom(i, e, s)
}
},
zoomOut: function(t) {
if (this.targetZoom > 1) {
var i = this.zoom / this.zoomMultiplier,
e = 0,
s = 0,
a = this.wrap.width(),
n = this.wrap.height();
t ? (e = t.pageX, s = t.pageY) : (e = this.wrap.offset().left + a / 2, s = this.wrap.offset().top + n / 2), this.applyZoom(i, e, s)
}
},
applyZoom: function(t, i, e) {
this.targetZoom = this.zoom, this.targetPanX = this.actualPanX, this.targetPanY = this.actualPanY, this.redraw(), t > this.maxZoomLevel && (t = this.maxZoomLevel), t < 1 && (t = 1), this.targetZoom = t;
var s = this.wrap.width(),
a = this.wrap.height(),
n = i - this.zoomWrap.offset().left,
o = e - this.zoomWrap.offset().top,
h = (s * this.targetZoom - s * this.zoom) / 2,
l = (a * this.targetZoom - a * this.zoom) / 2,
r = h * ((s * this.zoom / 2 - n) / (s * this.zoom / 2)),
p = l * ((a * this.zoom / 2 - o) / (a * this.zoom / 2));
this.targetPanX -= h, this.targetPanY -= l, this.targetPanX += r, this.targetPanY += p;
for (var g = 0; g < this.settings.spots.length; g++) {
var d = this.settings.spots[g];
"spot" == d.type && this.wrap.find("#" + d.id).css({
transform: "scale(" + 1 / this.targetZoom + ")"
})
}
this.hideAllTooltips(), this.redraw()
},
pan: function(t, i) {
this.actualPanX = this.initialPanX - (this.ix - t), this.actualPanY = this.initialPanY - (this.iy - i);
var e = this.wrap.width(),
s = this.wrap.height(),
a = this.wrap.offset().left,
n = this.wrap.offset().top,
o = window.innerWidth,
h = window.innerHeight;
1 == parseInt(this.settings.runtime.is_fullscreen, 10) ? (e * this.zoom > o ? (this.actualPanX > -a && (this.actualPanX = -a), this.actualPanX < o - e * this.targetZoom - a && (this.actualPanX = o - e * this.targetZoom - a)) : this.actualPanX = (e - e * this.targetZoom) / 2, s * this.zoom > h ? (this.actualPanY > -n && (this.actualPanY = -n), this.actualPanY < h - s * this.targetZoom - n && (this.actualPanY = h - s * this.targetZoom - n)) : this.actualPanY = (s - s * this.targetZoom) / 2) : (this.actualPanX > 0 && (this.actualPanX = 0), this.actualPanY > 0 && (this.actualPanY = 0), this.actualPanX < e - e * this.targetZoom && (this.actualPanX = e - e * this.targetZoom), this.actualPanY < s - s * this.targetZoom && (this.actualPanY = s - s * this.targetZoom)), this.panDeltaY = Math.abs(this.actualPanY - this.targetPanY), this.targetPanX = this.actualPanX, this.targetPanY = this.actualPanY, this.hideAllTooltips(), this.redraw()
},
panTo: function(t, i) {
var e = -t + this.wrap.width() / 2,
s = -i + this.wrap.height() / 2;
this.panDeltaY = Math.abs(s - this.targetPanY), this.targetPanX = e, this.targetPanY = s, this.hideAllTooltips(), this.redraw()
},
pinch: function(t) {
var i = (t.originalEvent.touches[0].pageX + t.originalEvent.touches[1].pageX) / 2,
e = (t.originalEvent.touches[0].pageY + t.originalEvent.touches[1].pageY) / 2;
this.actualPanX += i - this.lastX, this.actualPanY += e - this.lastY;
var s = this.wrap.width(),
a = this.wrap.height(),
n = this.wrap.offset().left,
o = this.wrap.offset().top,
h = window.innerWidth,
l = window.innerHeight;
1 == parseInt(this.settings.runtime.is_fullscreen, 10) ? (s * this.zoom > h ? (this.actualPanX > -n && (this.actualPanX = -n), this.actualPanX < h - s * this.targetZoom - n && (this.actualPanX = h - s * this.targetZoom - n)) : this.actualPanX = (s - s * this.targetZoom) / 2, a * this.zoom > l ? (this.actualPanY > -o && (this.actualPanY = -o), this.actualPanY < l - a * this.targetZoom - o && (this.actualPanY = l - a * this.targetZoom - o)) : this.actualPanY = (a - a * this.targetZoom) / 2) : (this.actualPanX > 0 && (this.actualPanX = 0), this.actualPanY > 0 && (this.actualPanY = 0), this.actualPanX < s - s * this.targetZoom && (this.actualPanX = s - s * this.targetZoom), this.actualPanY < a - a * this.targetZoom && (this.actualPanY = a - a * this.targetZoom)), this.lastX = i, this.lastY = e;
var r = Math.sqrt(Math.pow(t.originalEvent.touches[1].pageX - t.originalEvent.touches[0].pageX, 2) + Math.pow(t.originalEvent.touches[1].pageY - t.originalEvent.touches[0].pageY, 2)) / this.pinchInitialDistance;
this.applyZoom(this.pinchInitialZoom * r, i, e)
},
redraw: function() {
var t = this.wrap.width(),
i = this.wrap.height();
if (1 == parseInt(this.settings.runtime.is_fullscreen, 10)) {
var e = this.wrap.offset().left,
s = this.wrap.offset().top,
a = $(window).width(),
n = $(window).height();
t * this.zoom > a ? (this.targetPanX > -e && (this.targetPanX = -e), this.targetPanX < a - t * this.targetZoom - e && (this.targetPanX = a - t * this.targetZoom - e)) : this.targetPanX = (t - t * this.targetZoom) / 2, i * this.zoom > n ? (this.targetPanY > -s && (this.targetPanY = -s), this.targetPanY < n - i * this.targetZoom - s && (this.targetPanY = n - i * this.targetZoom - s)) : this.targetPanY = (i - i * this.targetZoom) / 2
} else this.targetPanX > 0 && (this.targetPanX = 0), this.targetPanY > 0 && (this.targetPanY = 0), this.targetPanX < t - t * this.targetZoom && (this.targetPanX = t - t * this.targetZoom), this.targetPanY < i - i * this.targetZoom && (this.targetPanY = i - i * this.targetZoom);
if (this.zoom = lerp(this.zoom, this.targetZoom, .1), this.actualPanX = lerp(this.actualPanX, this.targetPanX, .1), this.actualPanY = lerp(this.actualPanY, this.targetPanY, .1), Math.abs(this.zoom - this.targetZoom) < .001 && (this.zoom = this.targetZoom), Math.abs(this.actualPanX - this.targetPanX) < 1 && (this.actualPanX = this.targetPanX), Math.abs(this.actualPanY - this.targetPanY) < 1 && (this.actualPanY = this.targetPanY), this.zoomWrap.css({
transform: "scale(" + this.zoom + ", " + this.zoom + ")"
}), this.translateWrap.css({
transform: "translate(" + this.actualPanX + "px, " + this.actualPanY + "px)"
}), 1 == parseInt(this.settings.zooming.enable_navigator, 10)) {
var o = -this.actualPanX * this.navigatorRatio / this.zoom + this.navigatorMarginX / this.zoom,
h = t * this.navigatorRatio - (o + 1 * this.uiNavigatorWindowWidth / this.zoom),
l = -this.actualPanY * this.navigatorRatio / this.zoom + this.navigatorMarginY / this.zoom,
r = i * this.navigatorRatio - (l + 1 * this.uiNavigatorWindowHeight / this.zoom);
this.uiNavigatorImage.css({
"clip-path": "inset(" + l + "px " + h + "px " + r + "px " + o + "px)",
"-webkit-clip-path": "inset(" + l + "px " + h + "px " + r + "px " + o + "px)",
"-moz-clip-path": "inset(" + l + "px " + h + "px " + r + "px " + o + "px)"
})
}
var p = this;
this.zoom == this.targetZoom && this.actualPanX == this.targetPanX && this.actualPanY == this.targetPanY || window.requestAnimationFrame(function() {
p.redraw()
})
},
switchLayer: function(t) {
this.settings.runtime.layerID = t;
for (var i = 0; i < this.settings.layers.layers_list.length; i++)
if (parseInt(this.settings.layers.layers_list[i].id, 10) == parseInt(this.settings.runtime.layerID, 10)) {
this.settings.image.url = this.settings.layers.layers_list[i].image_url, this.settings.general.width = this.settings.layers.layers_list[i].image_width, this.settings.general.naturalWidth = this.settings.layers.layers_list[i].image_width, this.settings.general.height = this.settings.layers.layers_list[i].image_height, this.settings.general.naturalHeight = this.settings.layers.layers_list[i].image_height;
break
}
this.init()
}
}), $.fn[pluginName] = function(t) {
return this.each(function() {
$.data(this, "plugin_" + pluginName, new Plugin(this, t))
})
}
}(jQuery, window, document),
function(t) {
"function" == typeof define && define.amd ? define(["jquery"], t) : "object" == typeof exports ? module.exports = t : t(jQuery)
}(function(t) {
function i(i) {
var o = i || window.event,
h = l.call(arguments, 1),
r = 0,
g = 0,
d = 0,
c = 0,
u = 0,
m = 0;
if ((i = t.event.fix(o)).type = "mousewheel", "detail" in o && (d = -1 * o.detail), "wheelDelta" in o && (d = o.wheelDelta), "wheelDeltaY" in o && (d = o.wheelDeltaY), "wheelDeltaX" in o && (g = -1 * o.wheelDeltaX), "axis" in o && o.axis === o.HORIZONTAL_AXIS && (g = -1 * d, d = 0), r = 0 === d ? g : d, "deltaY" in o && (r = d = -1 * o.deltaY), "deltaX" in o && (g = o.deltaX, 0 === d && (r = -1 * g)), 0 !== d || 0 !== g) {
if (1 === o.deltaMode) {
var f = t.data(this, "mousewheel-line-height");
r *= f, d *= f, g *= f
} else if (2 === o.deltaMode) {
var v = t.data(this, "mousewheel-page-height");
r *= v, d *= v, g *= v
}
if (c = Math.max(Math.abs(d), Math.abs(g)), (!n || n > c) && (n = c, s(o, c) && (n /= 40)), s(o, c) && (r /= 40, g /= 40, d /= 40), r = Math[r >= 1 ? "floor" : "ceil"](r / n), g = Math[g >= 1 ? "floor" : "ceil"](g / n), d = Math[d >= 1 ? "floor" : "ceil"](d / n), p.settings.normalizeOffset && this.getBoundingClientRect) {
var w = this.getBoundingClientRect();
u = i.clientX - w.left, m = i.clientY - w.top
}
return i.deltaX = g, i.deltaY = d, i.deltaFactor = n, i.offsetX = u, i.offsetY = m, i.deltaMode = 0, h.unshift(i, r, g, d), a && clearTimeout(a), a = setTimeout(e, 200), (t.event.dispatch || t.event.handle).apply(this, h)
}
}
function e() {
n = null
}
function s(t, i) {
return p.settings.adjustOldDeltas && "mousewheel" === t.type && i % 120 == 0
}
var a, n, o = ["wheel", "mousewheel", "DOMMouseScroll", "MozMousePixelScroll"],
h = "onwheel" in document || document.documentMode >= 9 ? ["wheel"] : ["mousewheel", "DomMouseScroll", "MozMousePixelScroll"],
l = Array.prototype.slice;
if (t.event.fixHooks)
for (var r = o.length; r;) t.event.fixHooks[o[--r]] = t.event.mouseHooks;
var p = t.event.special.mousewheel = {
version: "3.1.12",
setup: function() {
if (this.addEventListener)
for (var e = h.length; e;) this.addEventListener(h[--e], i, !1);
else this.onmousewheel = i;
t.data(this, "mousewheel-line-height", p.getLineHeight(this)), t.data(this, "mousewheel-page-height", p.getPageHeight(this))
},
teardown: function() {
if (this.removeEventListener)
for (var e = h.length; e;) this.removeEventListener(h[--e], i, !1);
else this.onmousewheel = null;
t.removeData(this, "mousewheel-line-height"), t.removeData(this, "mousewheel-page-height")
},
getLineHeight: function(i) {
var e = t(i),
s = e["offsetParent" in t.fn ? "offsetParent" : "parent"]();
return s.length || (s = t("body")), parseInt(s.css("fontSize"), 10) || parseInt(e.css("fontSize"), 10) || 16
},
getPageHeight: function(i) {
return t(i).height()
},
settings: {
adjustOldDeltas: !0,
normalizeOffset: !0
}
};
t.fn.extend({
mousewheel: function(t) {
return t ? this.bind("mousewheel", t) : this.trigger("mousewheel")
},
unmousewheel: function(t) {
return this.unbind("mousewheel", t)
}
})
});