UNPKG

planit

Version:

Interactive markers on an image or blank canvas

979 lines (896 loc) 117 kB
var Planit, bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; Planit = (function() { function Planit() {} Planit.containerClass = 'planit-container'; Planit.draggingClass = 'is-dragging'; Planit.imageContainer = 'planit-image-container'; Planit.infoboxClass = 'planit-infobox'; Planit.infoboxContainerClass = 'planit-infobox-container'; Planit.markerClass = 'planit-marker'; Planit.markerContainerClass = 'planit-markers-container'; Planit.markerContentClass = 'planit-marker-content'; Planit.prototype["new"] = function(options1) { this.options = options1 != null ? options1 : {}; return new Planit.Plan(this.options); }; Planit.randomString = function(length) { var str; if (length == null) { length = 16; } str = Math.random().toString(36).slice(2); str = str + Math.random().toString(36).slice(2); return str.substring(0, length - 1); }; return Planit; })(); Planit.Plan = (function() { var animateBackground, animateMarkers, containerHeight, containerWidth, draggingMarker, getEventPosition, imgHeight, imgHeightClickIncrement, imgOffsetLeft, imgOffsetTop, imgWidth, imgWidthClickIncrement, initCanvasMarkers, initContainer, initEvents, initImage, initMarkers, initMethods, initOptions, initZoomControls, initZoomable, mousemove, mouseup, positionInfoboxes, resize, setBackground, setMarkers, zDblClick, zEventPosition, zMouseDown, zMouseMove, zMouseUp; function Plan(options1) { var j, len, method, ref; this.options = options1 != null ? options1 : {}; this.allMarkers = bind(this.allMarkers, this); this.addMarker = bind(this.addMarker, this); this.zoomOut = bind(this.zoomOut, this); this.zoomIn = bind(this.zoomIn, this); this.calc = bind(this.calc, this); this.zoomTo = bind(this.zoomTo, this); this.centerOn = bind(this.centerOn, this); this.resetImage = bind(this.resetImage, this); ref = initMethods(); for (j = 0, len = ref.length; j < len; j++) { method = ref[j]; method.call(this); } } initMethods = function() { return [initOptions, initContainer, initImage, initCanvasMarkers, initEvents]; }; initOptions = function() { if (this.options.container) { this.options.container = $("#" + this.options.container); } else { this.options.container = $('#planit'); } return this.container = this.options.container; }; initContainer = function() { this.container.addClass(Planit.containerClass); this.container.append("<div class=\"" + Planit.infoboxContainerClass + "\"></div>\n<div class=\"" + Planit.markerContainerClass + "\"></div>"); return this.markersContainer = this.container.find("." + Planit.markerContainerClass).first(); }; initImage = function() { if (this.options.image && this.options.image.url) { this.container.prepend("<div class=\"" + Planit.imageContainer + "\">\n <img src=\"" + this.options.image.url + "\">\n</div>"); this.image = this.container.find('img').first(); return this.image.load((function(_this) { return function() { _this.container.css({ height: _this.image.height() }); initZoomable.call(_this); return initMarkers.call(_this); }; })(this)); } }; initZoomable = function() { this.zoomId = Planit.randomString(); this.markersContainer.attr('data-zoom-id', this.zoomId); this.resetImage(); if (this.options.image.zoom) { return initZoomControls.call(this); } }; initZoomControls = function() { this.container.prepend("<div class=\"planit-controls\">\n <a href=\"#\" class=\"zoom\" data-action=\"in\">+</a>\n <a href=\"#\" class=\"zoom\" data-action=\"out\">-</a>\n</div>"); this.container.find(".zoom[data-action='in']").click((function(_this) { return function(e) { e.preventDefault(); return _this.zoomIn(); }; })(this)); this.container.find(".zoom[data-action='out']").click((function(_this) { return function(e) { e.preventDefault(); return _this.zoomOut(); }; })(this)); this.container.on('dblclick', (function(_this) { return function(e) { return zDblClick.call(_this, e); }; })(this)); this.container.on('mousedown', (function(_this) { return function(e) { return zMouseDown.call(_this, e); }; })(this)); $(document).on('mousemove', (function(_this) { return function(e) { return zMouseMove.call(_this, e); }; })(this)); return $(document).on('mouseup', (function(_this) { return function(e) { return zMouseUp.call(_this, e); }; })(this)); }; initCanvasMarkers = function() { if (!(this.options.image && this.options.image.url)) { return initMarkers.call(this); } }; initMarkers = function() { var j, len, marker, ref, results; if (this.options.markers && this.options.markers.length > 0) { ref = this.options.markers; results = []; for (j = 0, len = ref.length; j < len; j++) { marker = ref[j]; marker.plan = this; results.push(Planit.Marker.create(marker)); } return results; } }; initEvents = function() { if (this.container.find("." + Planit.imageContainer + " > img").length > 0) { this.image = this.container.find("." + Planit.imageContainer + " > img").first(); } $(document).on('mousemove', (function(_this) { return function(e) { return mousemove.call(_this, e); }; })(this)); $(document).on('mouseup', (function(_this) { return function(e) { return mouseup.call(_this, e); }; })(this)); return $(window).resize((function(_this) { return function(e) { return resize.call(_this, e); }; })(this)); }; Plan.prototype.resetImage = function() { this.imagePosition = { leftPx: 0, topPx: 0, width: this.image.width(), height: this.image.height(), scale: 1, increment: 0.5 }; setBackground.call(this); return true; }; setBackground = function() { this.image.css({ left: this.imagePosition.leftPx + "px", top: this.imagePosition.topPx + "px", width: (this.imagePosition.scale * 100.0) + "%", height: 'auto' }); return setMarkers.call(this); }; animateBackground = function() { this.image.animate({ left: this.imagePosition.leftPx + "px", top: this.imagePosition.topPx + "px", width: (this.imagePosition.scale * 100.0) + "%", height: 'auto' }, 250); return animateMarkers.call(this); }; setMarkers = function() { var j, left, len, marker, markers, top; markers = this.container.find("." + Planit.markerClass); if (markers.length > 0) { for (j = 0, len = markers.length; j < len; j++) { marker = markers[j]; left = (this.calc(imgWidth) * ($(marker).attr('data-xPc') / 100)) + this.imagePosition.leftPx - ($(marker).outerWidth() / 2); top = (this.calc(imgHeight) * ($(marker).attr('data-yPc') / 100)) + this.imagePosition.topPx - ($(marker).outerHeight() / 2); $(marker).css({ left: left + "px", top: top + "px" }); } return positionInfoboxes.call(this); } }; animateMarkers = function() { var j, left, len, m, marker, markers, results, top; markers = this.container.find("." + Planit.markerClass); if (markers.length > 0) { results = []; for (j = 0, len = markers.length; j < len; j++) { marker = markers[j]; m = new Planit.Marker(this, $(marker).attr('data-marker')); m.hideInfobox(); left = (this.calc(imgWidth) * ($(marker).attr('data-xPc') / 100)) + this.imagePosition.leftPx - ($(marker).outerWidth() / 2); top = (this.calc(imgHeight) * ($(marker).attr('data-yPc') / 100)) + this.imagePosition.topPx - ($(marker).outerHeight() / 2); results.push((function(m) { return $(marker).animate({ left: left + "px", top: top + "px" }, 250, (function(_this) { return function() { m.positionInfobox(); return m.unhideInfobox(); }; })(this)); })(m)); } return results; } }; positionInfoboxes = function() { var j, len, m, marker, ref; ref = this.container.find("." + Planit.markerClass); for (j = 0, len = ref.length; j < len; j++) { marker = ref[j]; m = new Planit.Marker(this, $(marker).attr('data-marker')); m.positionInfobox(); } return true; }; Plan.prototype.centerOn = function(coords) { var hMin, wMin, x, y; if (coords[0] >= 50) { x = 100 - coords[0]; } else { x = coords[0]; } if (coords[1] >= 50) { y = 100 - coords[1]; } else { y = coords[1]; } wMin = 50 * (this.calc(containerWidth) / x); hMin = 50 * (this.calc(containerHeight) / y); this.container.find("." + Planit.infoboxClass).removeClass('active'); this.imagePosition.leftPx = -((this.calc(imgWidth) * (coords[0] / 100)) - (this.calc(containerWidth) / 2)); this.imagePosition.topPx = -((this.calc(imgHeight) * (coords[1] / 100)) - (this.calc(containerHeight) / 2)); while ((this.calc(imgWidth) < wMin) || (this.calc(imgHeight) < hMin)) { this.imagePosition.scale = this.imagePosition.scale + this.imagePosition.increment; this.imagePosition.leftPx = -((this.calc(imgWidth) * (coords[0] / 100)) - (this.calc(containerWidth) / 2)); this.imagePosition.topPx = -((this.calc(imgHeight) * (coords[1] / 100)) - (this.calc(containerHeight) / 2)); } animateBackground.call(this); return coords; }; Plan.prototype.zoomTo = function(level) { var i; i = this.imagePosition.increment; if (((level * i) + 1) !== this.imagePosition.scale) { this.imagePosition.scale = (level * i) + 1 + i; this.zoomOut(); } return level; }; Plan.prototype.calc = function(method) { return method.call(this); }; imgWidth = function() { return parseFloat(this.imagePosition.width * this.imagePosition.scale); }; imgWidthClickIncrement = function() { return parseFloat(this.imagePosition.width * this.imagePosition.increment); }; containerWidth = function() { return parseFloat(this.markersContainer.width()); }; imgOffsetLeft = function() { return Math.abs(parseFloat(this.image.css('left'))); }; imgHeight = function() { return parseFloat(this.imagePosition.height * this.imagePosition.scale); }; imgHeightClickIncrement = function() { return parseFloat(this.imagePosition.height * this.imagePosition.increment); }; containerHeight = function() { return parseFloat(this.markersContainer.height()); }; imgOffsetTop = function() { return Math.abs(parseFloat(this.image.css('top'))); }; zEventPosition = function(e) { return { left: (e.pageX - this.container.offset().left) / this.calc(containerWidth), top: (e.pageY - this.container.offset().top) / this.calc(containerHeight) }; }; zDblClick = function(e) { var click; if ($(e.target).attr('data-zoom-id') === this.zoomId) { click = zEventPosition.call(this, e); return this.zoomIn('click', click.left, click.top); } }; zMouseDown = function(e) { var coords; if ($(e.target).attr('data-zoom-id') === this.zoomId && e.which === 1) { this.isDragging = true; coords = zEventPosition.call(this, e); this.dragCoords = { pointRef: coords, imgRef: { left: 0 - this.calc(imgOffsetLeft), top: 0 - this.calc(imgOffsetTop) }, max: { right: (coords.left * this.calc(containerWidth)) + this.calc(imgOffsetLeft), left: (coords.left * this.calc(containerWidth)) - (this.calc(imgWidth) - (this.calc(containerWidth) + this.calc(imgOffsetLeft))), bottom: (coords.top * this.calc(containerHeight)) + this.calc(imgOffsetTop), top: (coords.top * this.calc(containerHeight)) - (this.calc(imgHeight) - (this.calc(containerHeight) + this.calc(imgOffsetTop))) } }; } return true; }; zMouseMove = function(e) { var coords, dragLeft, dragTop, left, top; if (this.isDragging) { coords = zEventPosition.call(this, e); dragLeft = coords.left * this.calc(containerWidth); dragTop = coords.top * this.calc(containerHeight); if (dragLeft >= this.dragCoords.max.left && dragLeft <= this.dragCoords.max.right) { left = (coords.left - this.dragCoords.pointRef.left) * this.calc(containerWidth); this.imagePosition.leftPx = this.dragCoords.imgRef.left + left; } else if (dragLeft < this.dragCoords.max.left) { this.imagePosition.leftPx = this.calc(containerWidth) - this.calc(imgWidth); } else if (dragLeft > this.dragCoords.max.right) { this.imagePosition.leftPx = 0; } if (dragTop >= this.dragCoords.max.top && dragTop <= this.dragCoords.max.bottom) { top = (coords.top - this.dragCoords.pointRef.top) * this.calc(containerHeight); this.imagePosition.topPx = this.dragCoords.imgRef.top + top; } else if (dragTop < this.dragCoords.max.top) { this.imagePosition.topPx = this.calc(containerHeight) - this.calc(imgHeight); } else if (dragTop > this.dragCoords.max.bottom) { this.imagePosition.topPx = 0; } setBackground.call(this); } return true; }; zMouseUp = function(e) { this.isDragging = false; positionInfoboxes.call(this); return true; }; Plan.prototype.zoomIn = function() { this.imagePosition.scale = this.imagePosition.scale + this.imagePosition.increment; this.imagePosition.leftPx = -this.calc(imgOffsetLeft) - (this.calc(imgWidthClickIncrement) / 2); this.imagePosition.topPx = -this.calc(imgOffsetTop) - (this.calc(imgHeightClickIncrement) / 2); animateBackground.call(this); return true; }; Plan.prototype.zoomOut = function() { var leftPx, topPx; if (this.imagePosition.scale > 1) { this.imagePosition.scale = this.imagePosition.scale - this.imagePosition.increment; leftPx = -this.calc(imgOffsetLeft) + (this.calc(imgWidthClickIncrement) / 2); topPx = -this.calc(imgOffsetTop) + (this.calc(imgHeightClickIncrement) / 2); if (leftPx > 0) { this.imagePosition.leftPx = 0; } else if (leftPx < this.calc(containerWidth) - this.calc(imgWidth)) { this.imagePosition.leftPx = this.calc(containerWidth) - this.calc(imgWidth); } else { this.imagePosition.leftPx = leftPx; } if (topPx > 0) { this.imagePosition.topPx = 0; } else if (topPx < this.calc(containerHeight) - this.calc(imgHeight)) { this.imagePosition.topPx = this.calc(containerHeight) - this.calc(imgHeight); } else { this.imagePosition.topPx = topPx; } animateBackground.call(this); return true; } else { return false; } }; draggingMarker = function() { return this.markersContainer.find("." + Planit.markerClass + "." + Planit.draggingClass); }; getEventPosition = function(e) { var hImg, wImg, xImg, xPc, xPx, yImg, yPc, yPx; if (this.image) { xPx = e.pageX - this.container.offset().left; yPx = e.pageY - this.container.offset().top; wImg = this.image.width(); hImg = this.image.height(); xImg = parseInt(this.image.css('left')); yImg = parseInt(this.image.css('top')); xPc = ((xPx + Math.abs(xImg)) / wImg) * 100; yPc = ((yPx + Math.abs(yImg)) / hImg) * 100; } else { xPc = (e.pageX - this.container.offset().left) / this.calc(containerWidth); yPc = (e.pageY - this.container.offset().top) / this.calc(containerHeight); } return [xPc, yPc]; }; mouseup = function(e) { var m, marker; marker = this.markersContainer.find("." + Planit.draggingClass).first(); if (draggingMarker.call(this).length > 0) { m = new Planit.Marker(this, marker.attr('data-marker')); if (this.options.markerDragEnd) { this.options.markerDragEnd(e, m); } m.savePosition(); m.positionInfobox(); draggingMarker.call(this).removeClass(Planit.draggingClass); } if ($(e.target).hasClass(Planit.markerContainerClass)) { if (this.options.canvasClick) { this.options.canvasClick(e, getEventPosition.call(this, e)); } } if ($(e.target).hasClass(Planit.markerClass) || $(e.target).parents("." + Planit.markerClass).length > 0) { if ($(e.target).hasClass(Planit.markerClass)) { marker = $(e.target); } else { marker = $(e.target).parents("." + Planit.markerClass).first(); } m = new Planit.Marker(this, marker.attr('data-marker')); if (this.options.markerClick) { this.options.markerClick(e, m); } } return true; }; mousemove = function(e) { var marker, markerBottom, markerHeight, markerLeft, markerRight, markerTop, markerWidth, markerX, markerY, markers, mouseLeft, mouseTop, planBottom, planRight; markers = this.markersContainer.find("." + Planit.markerClass + "." + Planit.draggingClass); if (markers.length > 0) { marker = markers.first(); if (Math.abs(e.pageX - marker.attr('data-drag-start-x')) > 0 || Math.abs(e.pageY - marker.attr('data-drag-start-y')) > 0) { this.container.find("#" + (marker.attr('data-infobox'))).removeClass('active'); } mouseLeft = e.pageX - this.container.offset().left; mouseTop = e.pageY - this.container.offset().top; planRight = this.container.width(); planBottom = this.container.height(); markerLeft = mouseLeft - (marker.outerWidth() / 2); markerTop = mouseTop - (marker.outerHeight() / 2); markerRight = mouseLeft + (marker.outerWidth() / 2); markerBottom = mouseTop + (marker.outerHeight() / 2); markerWidth = marker.outerWidth(); markerHeight = marker.outerHeight(); if (markerLeft <= 0) { markerX = 0; } else if (markerRight < planRight) { markerX = markerLeft; } else { markerX = planRight - markerWidth; } if (markerTop <= 0) { markerY = 0; } else if (markerBottom < planBottom) { markerY = markerTop; } else { markerY = planBottom - markerHeight; } return marker.css({ left: markerX, top: markerY }); } }; resize = function(e) { var j, len, m, marker, ref, results; if (this.image) { this.resetImage(); this.container.height(this.image.height()); } ref = this.markersContainer.find('.planit-marker'); results = []; for (j = 0, len = ref.length; j < len; j++) { marker = ref[j]; m = new Planit.Marker(this, $(marker).attr('data-marker')); results.push(m.set()); } return results; }; Plan.prototype.addMarker = function(options) { var marker; if (options == null) { options = {}; } options.plan = this; marker = Planit.Marker.create(options); return marker; }; Plan.prototype.allMarkers = function() { var j, len, marker, markers, ref; markers = []; ref = this.container.find("." + Planit.markerClass); for (j = 0, len = ref.length; j < len; j++) { marker = ref[j]; markers.push(new Planit.Marker(this, $(marker).attr('data-marker'))); } return markers; }; return Plan; })(); Planit.Marker = (function() { function Marker(plan1, id) { this.plan = plan1; this.remove = bind(this.remove, this); this.update = bind(this.update, this); this.savePosition = bind(this.savePosition, this); this.set = bind(this.set, this); this.animateInfobox = bind(this.animateInfobox, this); this.positionInfobox = bind(this.positionInfobox, this); this.infoboxCoords = bind(this.infoboxCoords, this); this.unhideInfobox = bind(this.unhideInfobox, this); this.showInfobox = bind(this.showInfobox, this); this.hideInfobox = bind(this.hideInfobox, this); this.infoboxVisible = bind(this.infoboxVisible, this); this.infoboxHTML = bind(this.infoboxHTML, this); this.infobox = bind(this.infobox, this); this.isDraggable = bind(this.isDraggable, this); this.id = bind(this.id, this); this.planitID = bind(this.planitID, this); this.color = bind(this.color, this); this.relativePosition = bind(this.relativePosition, this); this.position = bind(this.position, this); this.enableDragging = bind(this.enableDragging, this); this.container = this.plan.container; this.markersContainer = this.container.find("." + Planit.markerContainerClass); if (this.container.find("." + Planit.imageContainer + " > img").length > 0) { this.image = this.container.find("." + Planit.imageContainer + " > img").first(); } this.marker = this.markersContainer.find("." + Planit.markerClass + "[data-marker='" + id + "']").first(); this; } Marker.create = function(options) { var arrow, arrowClass, classes, color, container, id, infobox, left, marker, markerObj, markersContainer, plan, position, top; plan = options.plan; container = plan.container; markersContainer = container.find("." + Planit.markerContainerClass).first(); if (!options.planitID) { options.planitID = Planit.randomString(20); } if (options.color) { color = options.color; } else { color = '#FC5B3F'; } left = ((parseFloat(options.coords[0]) / 100) * container.width()) - 15; top = ((parseFloat(options.coords[1]) / 100) * container.height()) - 15; markersContainer.append($('<div></div>').addClass(Planit.markerClass).attr({ 'data-marker': options.planitID, 'data-xPc': options.coords[0], 'data-yPc': options.coords[1] }).css({ left: left + "px", top: top + "px", backgroundColor: color })); marker = markersContainer.find("." + Planit.markerClass).last(); markerObj = new Planit.Marker(plan, options.planitID); if (options.id) { marker.attr({ 'data-id': options.id }); } if (options["class"]) { marker.addClass(options["class"]); } if (options.html) { marker.html(options.html); } if (options.size) { marker.css({ width: options.size + "px", height: options.size + "px" }); } if (options.draggable) { marker.addClass('draggable'); markerObj.enableDragging(marker); } if (plan.options.markerMouseOver) { marker.on('mouseover', (function(_this) { return function(e) { plan.options.markerMouseOver(e, markerObj); return true; }; })(this)); } if (plan.options.markerMouseOut) { marker.on('mouseout', (function(_this) { return function(e) { plan.options.markerMouseOut(e, markerObj); return true; }; })(this)); } if (options.infobox) { id = Planit.randomString(16); infobox = options.infobox; if (infobox.position) { position = infobox.position; } else { position = 'top'; } if (infobox.arrow) { arrow = true; } else { arrow = false; } if (arrow === true) { arrowClass = 'arrow'; } else { arrowClass = ''; } classes = Planit.infoboxClass + " " + position + " " + arrowClass; container.find("." + Planit.infoboxContainerClass).append("<div class=\"" + classes + "\" id=\"info-" + id + "\"\n data-position=\"" + position + "\">\n " + infobox.html + "\n</div>"); if (infobox.offsetX) { container.find("." + Planit.infoboxClass).last().attr({ 'data-offset-x': infobox.offsetX }); } if (infobox.offsetY) { container.find("." + Planit.infoboxClass).last().attr({ 'data-offset-y': infobox.offsetY }); } marker.attr('data-infobox', "info-" + id); markerObj.positionInfobox(); } return markerObj; }; Marker.prototype.enableDragging = function(marker) { return marker.on('mousedown', (function(_this) { return function(e) { if (e.which === 1) { marker = $(e.target).closest("." + Planit.markerClass); marker.addClass(Planit.draggingClass); return marker.attr({ 'data-drag-start-x': e.pageX, 'data-drag-start-y': e.pageY }); } }; })(this)); }; Marker.prototype.position = function() { var hImg, wImg, xImg, xPc, xPx, yImg, yPc, yPx; xPx = this.marker.position().left + (this.marker.outerWidth() / 2); yPx = this.marker.position().top + (this.marker.outerHeight() / 2); if (this.image) { wImg = this.image.width(); hImg = this.image.height(); xImg = parseInt(this.image.css('left')); yImg = parseInt(this.image.css('top')); xPc = ((xPx + Math.abs(xImg)) / wImg) * 100; yPc = ((yPx + Math.abs(yImg)) / hImg) * 100; } else { xPc = (xPx / this.container.width()) * 100; yPc = (yPx / this.container.height()) * 100; } return [xPc, yPc]; }; Marker.prototype.relativePosition = function() { var xPc, xPx, yPc, yPx; xPx = this.marker.position().left + (this.marker.outerWidth() / 2); yPx = this.marker.position().top + (this.marker.outerHeight() / 2); xPc = (xPx / this.container.width()) * 100; yPc = (yPx / this.container.height()) * 100; return [xPc, yPc]; }; Marker.prototype.color = function() { return this.marker.css('backgroundColor'); }; Marker.prototype.planitID = function() { return this.marker.attr('data-marker'); }; Marker.prototype.id = function() { return this.marker.attr('data-id'); }; Marker.prototype.isDraggable = function() { return this.marker.hasClass('draggable'); }; Marker.prototype.infobox = function() { var infobox; infobox = this.container.find("#" + (this.marker.attr('data-infobox'))); if (infobox.length > 0) { return infobox; } else { return null; } }; Marker.prototype.infoboxHTML = function() { if (this.infobox() && this.infobox().length > 0) { return this.infobox().html(); } else { return null; } }; Marker.prototype.infoboxVisible = function() { return this.infobox() && this.infobox().hasClass('active'); }; Marker.prototype.hideInfobox = function() { if (this.infoboxVisible()) { this.infobox().addClass('hidden'); return true; } else { return false; } }; Marker.prototype.showInfobox = function() { if (this.infobox() && !this.infoboxVisible()) { this.infobox().addClass('active'); this.unhideInfobox(); return true; } else { return false; } }; Marker.prototype.unhideInfobox = function() { if (this.infoboxVisible()) { this.infobox().removeClass('hidden'); return true; } else { return false; } }; Marker.prototype.infoboxCoords = function() { var buffer, cHeight, cWidth, iHalfHeight, iHalfWidth, iHeight, iWidth, infoLeft, infoTop, infobox, mHalfHeight, mHalfWidth, mHeight, mWidth, markerCenterX, markerCenterY, offsetX, offsetY; infobox = this.container.find("#" + (this.marker.attr('data-infobox'))); markerCenterX = parseFloat(this.relativePosition()[0] / 100) * this.container.width(); markerCenterY = parseFloat(this.relativePosition()[1] / 100) * this.container.height(); iWidth = infobox.outerWidth(); iHalfWidth = iWidth / 2; iHeight = infobox.outerHeight(); iHalfHeight = iHeight / 2; cWidth = this.container.width(); cHeight = this.container.height(); mWidth = this.marker.outerWidth(); mHalfWidth = mWidth / 2; mHeight = this.marker.outerHeight(); mHalfHeight = mHeight / 2; buffer = 5; offsetX = parseInt(infobox.attr('data-offset-x')); if (!offsetX) { offsetX = 0; } offsetY = parseInt(infobox.attr('data-offset-y')); if (!offsetY) { offsetY = 0; } switch (infobox.attr('data-position')) { case 'top': infoLeft = markerCenterX - iHalfWidth; infoTop = markerCenterY - iHeight - mHalfHeight - buffer; break; case 'right': infoLeft = markerCenterX + mHalfWidth + buffer; infoTop = markerCenterY - iHalfHeight; break; case 'bottom': infoLeft = markerCenterX - iHalfWidth; infoTop = markerCenterY + mHalfHeight + buffer; break; case 'left': infoLeft = markerCenterX - iWidth - mHalfWidth - buffer; infoTop = markerCenterY - iHalfHeight; break; case 'top-left': infoLeft = markerCenterX - iWidth - mHalfWidth + buffer; infoTop = markerCenterY - iHeight - mHalfHeight + buffer; break; case 'top-right': infoLeft = markerCenterX + mHalfWidth - buffer; infoTop = markerCenterY - iHeight - mHalfHeight + buffer; break; case 'bottom-left': infoLeft = markerCenterX - iWidth - mHalfWidth + buffer; infoTop = markerCenterY + mHalfHeight - buffer; break; case 'bottom-right': infoLeft = markerCenterX + mHalfWidth - buffer; infoTop = markerCenterY + mHalfHeight - buffer; } return { left: infoLeft + offsetX, top: infoTop + offsetY }; }; Marker.prototype.positionInfobox = function() { var coords; coords = this.infoboxCoords(); this.container.find("#" + (this.marker.attr('data-infobox'))).css({ left: coords.left + "px", top: coords.top + "px" }); return this.position(); }; Marker.prototype.animateInfobox = function() { var coords; coords = this.infoboxCoords(); return this.container.find("#" + (this.marker.attr('data-infobox'))).animate({ left: coords.left + "px", top: coords.top + "px" }, 250, (function(_this) { return function() { return _this.position(); }; })(this)); }; Marker.prototype.set = function() { var left, top; if (this.image) { left = (this.image.width() * (this.marker.attr('data-xPc') / 100)) + parseFloat(this.image.css('left')) - (this.marker.outerWidth() / 2); top = (this.image.height() * (this.marker.attr('data-yPc') / 100)) + parseFloat(this.image.css('top')) - (this.marker.outerHeight() / 2); } else { left = (this.container.width() * (this.marker.attr('data-xPc') / 100)) - (this.marker.outerWidth() / 2); top = (this.container.height() * (this.marker.attr('data-yPc') / 100)) - (this.marker.outerHeight() / 2); } this.marker.css({ left: left + "px", top: top + "px" }); this.positionInfobox(); return [left, top]; }; Marker.prototype.savePosition = function() { var coords; coords = this.position(); this.marker.attr({ 'data-xPc': coords[0], 'data-yPc': coords[1] }); return coords; }; Marker.prototype.update = function(options) { var left, top; if (options.color) { this.marker.css({ backgroundColor: options.color }); } if (options.infobox) { this.marker.find("." + Planit.infoboxClass).html(options.infobox); this.positionInfobox(); } if (options.draggable !== void 0) { if (options.draggable === true) { this.marker.addClass('draggable'); this.enableDragging(this.marker); } else { this.marker.removeClass('draggable'); this.marker.off('mousedown'); } } if (options.coords) { left = ((parseFloat(options.coords[0]) / 100) * this.container.width()) - 15; top = ((parseFloat(options.coords[1]) / 100) * this.container.height()) - 15; this.marker.css({ left: left + "px", top: top + "px" }); } return true; }; Marker.prototype.remove = function() { if (this.infobox()) { this.infobox().remove(); } this.marker.remove(); return true; }; return Marker; })(); window.planit = new Planit; //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInBsYW5pdC10bXAuY29mZmVlIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLElBQUEsTUFBQTtFQUFBOztBQUFNOzs7RUFJSixNQUFDLENBQUEsY0FBRCxHQUF3Qjs7RUFDeEIsTUFBQyxDQUFBLGFBQUQsR0FBd0I7O0VBQ3hCLE1BQUMsQ0FBQSxjQUFELEdBQXdCOztFQUN4QixNQUFDLENBQUEsWUFBRCxHQUF3Qjs7RUFDeEIsTUFBQyxDQUFBLHFC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