From 51e670c7175917a2a61a53e5d9c951ee9e0b10a9 Mon Sep 17 00:00:00 2001 From: tgoff0 Date: Tue, 9 Dec 2014 21:37:17 +0000 Subject: [PATCH] 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. --- gui/api.tcl | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/gui/api.tcl b/gui/api.tcl index 8e3f2031..871fa29c 100755 --- a/gui/api.tcl +++ b/gui/api.tcl @@ -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 + } } #