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);
});
function deleteWorkspace(id) {
if (workspace_tabs.count() == 1) {
return;
@ -369,6 +368,11 @@ RED.view = function() {
RED.nodes.add(nn);
RED.editor.validateNode(nn);
setDirty(true);
// auto select dropped node - so info shows (if visible)
clearSelection();
nn.selected = true;
moving_set.push({n:nn});
updateSelection();
redraw();
if (nn._def.autoedit) {
@ -645,7 +649,6 @@ RED.view = function() {
if (d._def.button.onclick) {
d._def.button.onclick.call(d);
}
if (d.dirty) {
redraw();
}
@ -871,7 +874,6 @@ RED.view = function() {
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) {
// 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) {
$("#btn-deploy").removeClass("disabled").addClass("btn-danger");
} 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) {
new_ms[i].n.selected = true;
new_ms[i].n.changed = true;
new_ms[i].n.x -= dx - mouse_position[0];
new_ms[i].n.y -= dy - mouse_position[1];
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 form" ).submit(function(e) { e.preventDefault();});
$( "#node-dialog-rename-workspace" ).dialog({
modal: true,
@ -1153,7 +1153,6 @@ RED.view = function() {
]
});
return {
state:function(state) {
if (state == null) {