diff --git a/code/modules/html_interface/crew/crew.dm b/code/modules/html_interface/crew/crew.dm
index 406c8a338ce..40c72f7d2b3 100644
--- a/code/modules/html_interface/crew/crew.dm
+++ b/code/modules/html_interface/crew/crew.dm
@@ -258,6 +258,13 @@ var/global/datum/crewmonitor/crewmonitor = new
spawn(min(30, get_dist(get_turf(C), AI.eyeobj) / 4))
if (AI && AI.eyeobj && current_loc == AI.eyeobj.loc)
AI.switchCamera(C)
+ if ("crewclick")
+ var/x = text2num(href_list["x"])
+ var/y = text2num(href_list["y"])
+ var/turf/tile = locate(x, y, AI.z)
+ if(tile)
+ AI.eyeobj.setLoc(tile)
+
else if(hclient && hclient.client && hclient.client.mob)
var/mob/living/L = hclient.client.mob
if(!istype(L)) return
diff --git a/code/modules/html_interface/crew/crew.js b/code/modules/html_interface/crew/crew.js
index c23dc8f7846..6096b325043 100644
--- a/code/modules/html_interface/crew/crew.js
+++ b/code/modules/html_interface/crew/crew.js
@@ -249,7 +249,7 @@
var isAI = null;
var scale_x;
var scale_y;
-
+var defaultzoom = 4;
function disableSelection(){ return false; };
$(window).on("onUpdateContent", function()
@@ -264,18 +264,27 @@ $(window).on("onUpdateContent", function()
$("#switches").append("
");
//$("body")[0].onselectstart = disableSelection;
- var width = $("#uiMapImage").width();
+ var width = $("#uiMap").width();
scale_x = width / (maxx * tile_size);
scale_y = width / (maxy * tile_size); // height is assumed to be the same
-
+/*
$("#uiMap").on("click", function(e)
{
var x = ((((e.clientX - 8) / scale_x) / tile_size) + 1).toFixed(0);
var y = ((maxy - (((e.clientY - 8) / scale_y) / tile_size)) + 1).toFixed(0);
window.location.href = "byond://?src=" + hSrc + "&action=select_position&x=" + x + "&y=" + y;
- });
+ });*/
+ $("#uiMap").css({ position: 'absolute',
+ top: '50%',
+ left: '50%',
+ margin: '-512px 0 0 -512px',
+ width: '256px',
+ height: '256px',
+ overflow: 'hidden',
+ zoom: '4'
+ });
$('#uiMap').drags({handle : '#uiMapImage'});
$('#uiMapTooltip')
.off('click')
@@ -283,6 +292,19 @@ $(window).on("onUpdateContent", function()
event.preventDefault();
$(this).fadeOut(400);
});
+ $('#uiMap').click(function(ev) {
+ var el = document.getElementById('uiMap');
+ var rect = el.getBoundingClientRect();
+ var tileX = (((ev.clientX - rect.left - el.clientLeft + el.scrollLeft)) / defaultzoom + 7).toFixed(0);
+ var tileY = (maxy-((ev.clientY - rect.top - el.clientTop + el.scrollTop)) / defaultzoom).toFixed(0);
+ var xx = ((ev.clientX - rect.left - el.clientLeft + el.scrollLeft) / defaultzoom).toFixed(0);
+ var yy = ((ev.clientY - rect.top - el.clientTop + el.scrollTop) / defaultzoom).toFixed(0);
+ //var dot = document.createElement('div');
+ //dot.setAttribute('style', 'position:absolute; width: 2px; height: 2px; top: '+top+'px; left: '+left+'px; background: red; z-index: 99999999;');
+ //el.appendChild(dot);
+ //alert(tileX + ' ' + tileY);
+ window.location.href = "byond://?src=" + hSrc + "&action=crewclick&x=" + tileX + "&y=" + tileY + "&z=" + z;
+ });
});
var updateMap = true;
@@ -347,7 +369,7 @@ function switchTo(i)
//$("document").height("800px");
}
}
-var defaultzoom = 4;
+
function changeZoom(offset){
defaultzoom = Math.max(defaultzoom + offset, 1);
var uiMapObject = $('#uiMap');