Commit 1e3fa3ce authored by Leigh B Stoller's avatar Leigh B Stoller

Fix for the topo window; click and drag was also invoking

the shell function, cause the the ssh handle was using click.
I changed the handler to use mouseup,mousemove,mousedown events
(derived from a google search).
parent d2eb80d3
......@@ -576,6 +576,9 @@ function StartCountdownClock(when)
}, 1000);
}
// Flag to distinguish between click and click/drag.
var isDragging = false;
function maketopmap(divname, width, height, json)
{
var ismousedown = false;
......@@ -701,13 +704,25 @@ function maketopmap(divname, width, height, json)
.enter().append("svg:g")
.call(node_drag);
// var nodea = nodeg.append("svg:a")
// .attr("xlink:href", function(d) { return d.sshurl });
//
// The mouse events are to distinguish between click and drag.
// I found it with a Google search of course.
//
var node = nodeg.append("svg:rect")
.attr("class", "nodebox")
.on("click", function(d) {
NewSSHTab(d.hostport, d.client_id);
.on("mousedown", function(d) {
$(window).mousemove(function() {
isDragging = true;
$(window).unbind("mousemove");
});
})
.on("mouseup", function(d) {
var wasDragging = isDragging;
isDragging = false;
$(window).unbind("mousemove");
if (!wasDragging) { //was clicking
NewSSHTab(d.hostport, d.client_id);
}
})
.attr("x", "-10px")
.attr("y", "-10px")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment