mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Touch ui - deselect nodes when touch on canvas
This commit is contained in:
parent
da3fbd3b62
commit
034f17a8e8
@ -214,13 +214,7 @@ RED.view = function() {
|
|||||||
//d3.select(window).on("keydown", keydown);
|
//d3.select(window).on("keydown", keydown);
|
||||||
|
|
||||||
function canvasMouseDown() {
|
function canvasMouseDown() {
|
||||||
// if (d3.event.shiftKey) {
|
|
||||||
// var point = d3.mouse(this),
|
|
||||||
// node = {x: point[0], y: point[1], w:node_width, h:node_height, type:Math.floor(Math.random()*3)},
|
|
||||||
// n = nodes.push(node);
|
|
||||||
// redraw();
|
|
||||||
// } else
|
|
||||||
//
|
|
||||||
if (!mousedown_node && !mousedown_link) {
|
if (!mousedown_node && !mousedown_link) {
|
||||||
selected_link = null;
|
selected_link = null;
|
||||||
updateSelection();
|
updateSelection();
|
||||||
@ -233,17 +227,17 @@ RED.view = function() {
|
|||||||
}
|
}
|
||||||
var point = d3.touches(this)[0]||d3.mouse(this);
|
var point = d3.touches(this)[0]||d3.mouse(this);
|
||||||
if (d3.touches(this).length === 0) {
|
if (d3.touches(this).length === 0) {
|
||||||
lasso = vis.append('rect')
|
lasso = vis.append('rect')
|
||||||
.attr("ox",point[0])
|
.attr("ox",point[0])
|
||||||
.attr("oy",point[1])
|
.attr("oy",point[1])
|
||||||
.attr("rx",2)
|
.attr("rx",2)
|
||||||
.attr("ry",2)
|
.attr("ry",2)
|
||||||
.attr("x",point[0])
|
.attr("x",point[0])
|
||||||
.attr("y",point[1])
|
.attr("y",point[1])
|
||||||
.attr("width",0)
|
.attr("width",0)
|
||||||
.attr("height",0)
|
.attr("height",0)
|
||||||
.attr("class","lasso");
|
.attr("class","lasso");
|
||||||
d3.event.preventDefault();
|
d3.event.preventDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -252,6 +246,11 @@ RED.view = function() {
|
|||||||
clearTimeout(pressTimer);
|
clearTimeout(pressTimer);
|
||||||
mouse_position = d3.touches(this)[0]||d3.mouse(this);
|
mouse_position = d3.touches(this)[0]||d3.mouse(this);
|
||||||
|
|
||||||
|
// Prevent touch scrolling...
|
||||||
|
//if (d3.touches(this)[0]) {
|
||||||
|
// d3.event.preventDefault();
|
||||||
|
//}
|
||||||
|
|
||||||
// TODO: auto scroll the container
|
// TODO: auto scroll the container
|
||||||
//var point = d3.mouse(this);
|
//var point = d3.mouse(this);
|
||||||
//if (point[0]-container.scrollLeft < 30 && container.scrollLeft > 0) { container.scrollLeft -= 15; }
|
//if (point[0]-container.scrollLeft < 30 && container.scrollLeft > 0) { container.scrollLeft -= 15; }
|
||||||
@ -394,6 +393,9 @@ RED.view = function() {
|
|||||||
updateSelection();
|
updateSelection();
|
||||||
lasso.remove();
|
lasso.remove();
|
||||||
lasso = null;
|
lasso = null;
|
||||||
|
} else if (mouse_mode == RED.state.DEFAULT) {
|
||||||
|
clearSelection();
|
||||||
|
updateSelection();
|
||||||
}
|
}
|
||||||
if (mouse_mode == RED.state.MOVING_ACTIVE) {
|
if (mouse_mode == RED.state.MOVING_ACTIVE) {
|
||||||
if (moving_set.length > 0) {
|
if (moving_set.length > 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user