gui: Check if a node is on the current canvas when modifying its appearance.

This also fixes a bug where a node's name would not be correctly
updated if it was on the current canvas.

Adapted from a patch by Yueli Yang.
This commit is contained in:
tgoff0 2014-12-09 21:37:17 +00:00
parent b89e7d6471
commit 51e670c717

View file

@ -431,14 +431,13 @@ proc parseNodeMessage { data len flags } {
# modify a node
#
proc apiNodeModify { node vals_ref } {
global c eid zoom
global c eid zoom curcanvas
upvar $vals_ref vals
if { ![info exists c] } { return } ;# batch mode
set draw 0
if { $vals(icon) != "" } {
setCustomImage $node $vals(icon)
.c delete withtag "node && $node"
.c delete withtag "nodelabel && $node"
drawNode .c $node
set draw 1
}
# move the node and its links
if {$vals(xpos) != 0 && $vals(ypos) != 0} {
@ -447,6 +446,7 @@ proc apiNodeModify { node vals_ref } {
}
if { $vals(name) != "" } {
setNodeName $node $vals(name)
set draw 1
}
if { $vals(services) != "" } {
set services [split $vals(services) |]
@ -454,6 +454,11 @@ proc apiNodeModify { node vals_ref } {
}
# TODO: handle other optional on-screen data
# lat, long, alt, heading, platform type, platform id
if { $draw && [getNodeCanvas $node] == $curcanvas } {
.c delete withtag "node && $node"
.c delete withtag "nodelabel && $node"
drawNode .c $node
}
}
#