From 2fda9c1497db4c15036110d0ee4ab193763c5069 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 14 Apr 2014 11:16:14 +0200 Subject: Small fixes to the ping display and drag. --- web/nms.gathering.org/ping.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'web/nms.gathering.org/ping.js') diff --git a/web/nms.gathering.org/ping.js b/web/nms.gathering.org/ping.js index c0f6b46..1299567 100644 --- a/web/nms.gathering.org/ping.js +++ b/web/nms.gathering.org/ping.js @@ -82,12 +82,18 @@ function create_switch(switchnum, sysname, x, y, width, height) { s.style.height = height + 'px'; s.style.backgroundColor = '#0000ff'; s.style.border = '1px solid black'; + s.style.padding = "0"; switches[switchnum] = s; + var span = document.createElement("div"); + span.className = "switchname"; + span.style.border = "0"; + span.style.padding = "0"; + s.appendChild(span); + var text = document.createTextNode(sysname); - s.appendChild(text); + span.appendChild(text); - //var attr = document.createAttribute("data-switchnum", switchnum); s.setAttribute("data-switchnum", switchnum); document.body.appendChild(s); @@ -118,8 +124,8 @@ document.onmouseup = function(e) { if (dragging_switch === null) { return; } - var x = e.clientX + delta_x; - var y = e.clientY + delta_y; + var x = e.clientX + delta_x - map.getBoundingClientRect().top; + var y = e.clientY + delta_y - map.getBoundingClientRect().left; var request = new XMLHttpRequest(); request.open('POST', '/change-switch-pos.pl', true); -- cgit v1.2.3