1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Auto select node on drop onto canvas so info panel shows relevant info (if visible)

This commit is contained in:
Dave C-J 2013-11-19 08:48:44 +00:00
parent 72f72e8a50
commit 620af84088

View File

@ -125,7 +125,6 @@ RED.view = function() {
deleteWorkspace(activeWorkspace); deleteWorkspace(activeWorkspace);
}); });
function deleteWorkspace(id) { function deleteWorkspace(id) {
if (workspace_tabs.count() == 1) { if (workspace_tabs.count() == 1) {
return; return;
@ -369,6 +368,11 @@ RED.view = function() {
RED.nodes.add(nn); RED.nodes.add(nn);
RED.editor.validateNode(nn); RED.editor.validateNode(nn);
setDirty(true); setDirty(true);
// auto select dropped node - so info shows (if visible)
clearSelection();
nn.selected = true;
moving_set.push({n:nn});
updateSelection();
redraw(); redraw();
if (nn._def.autoedit) { if (nn._def.autoedit) {
@ -645,7 +649,6 @@ RED.view = function() {
if (d._def.button.onclick) { if (d._def.button.onclick) {
d._def.button.onclick.call(d); d._def.button.onclick.call(d);
} }
if (d.dirty) { if (d.dirty) {
redraw(); redraw();
} }
@ -871,7 +874,6 @@ RED.view = function() {
return 1; return 1;
}); });
//thisNode.selectAll('.node_right_button').attr("transform",function(d){return "translate("+(d.w - d._def.button.width.call(d))+","+0+")";}).attr("fill",function(d) { //thisNode.selectAll('.node_right_button').attr("transform",function(d){return "translate("+(d.w - d._def.button.width.call(d))+","+0+")";}).attr("fill",function(d) {
// return typeof d._def.button.color === "function" ? d._def.button.color.call(d):(d._def.button.color != null ? d._def.button.color : d._def.color) // return typeof d._def.button.color === "function" ? d._def.button.color.call(d):(d._def.button.color != null ? d._def.button.color : d._def.color)
//}); //});
@ -971,7 +973,7 @@ RED.view = function() {
if (dirty) { if (dirty) {
$("#btn-deploy").removeClass("disabled").addClass("btn-danger"); $("#btn-deploy").removeClass("disabled").addClass("btn-danger");
} else { } else {
$("#btn-deploy").addClass("disabled").removeClass("btn-danger");; $("#btn-deploy").addClass("disabled").removeClass("btn-danger");
} }
} }
@ -1002,7 +1004,6 @@ RED.view = function() {
for (var i in new_ms) { for (var i in new_ms) {
new_ms[i].n.selected = true; new_ms[i].n.selected = true;
new_ms[i].n.changed = true; new_ms[i].n.changed = true;
new_ms[i].n.x -= dx - mouse_position[0]; new_ms[i].n.x -= dx - mouse_position[0];
new_ms[i].n.y -= dy - mouse_position[1]; new_ms[i].n.y -= dy - mouse_position[1];
new_ms[i].dx = new_ms[i].n.x - mouse_position[0]; new_ms[i].dx = new_ms[i].n.x - mouse_position[0];
@ -1084,7 +1085,6 @@ RED.view = function() {
$( "#node-dialog-rename-workspace" ).dialog("open"); $( "#node-dialog-rename-workspace" ).dialog("open");
} }
$("#node-dialog-rename-workspace form" ).submit(function(e) { e.preventDefault();}); $("#node-dialog-rename-workspace form" ).submit(function(e) { e.preventDefault();});
$( "#node-dialog-rename-workspace" ).dialog({ $( "#node-dialog-rename-workspace" ).dialog({
modal: true, modal: true,
@ -1153,7 +1153,6 @@ RED.view = function() {
] ]
}); });
return { return {
state:function(state) { state:function(state) {
if (state == null) { if (state == null) {