highlight a list of nodes by name or number

This commit is contained in:
BigEd 2010-11-05 21:21:06 +00:00
parent 18e1946488
commit 353e0a8f78
2 changed files with 40 additions and 4 deletions

View File

@ -85,14 +85,17 @@ $().ready(function(){
<input type="checkbox" name="0" id="updateShow0" onchange="updateShow(this.name,this.checked)" />(metal)
<input type="checkbox" name="2" id="updateShow2" onchange="updateShow(this.name,this.checked)" />(protection)
</form>
<form>
<input type="button" value="Hide Chip Layout" onclick="updateChipLayoutVisibility(false)" />
<input type="button" value="Clear Highlighting" onclick="clearHighlight()" />
<form action="javascript:hiliteNodeList();" />
<input type="button" value="Highlight:" onclick="hiliteNodeList();" />
<input type="text" id="HighlightThese" name="HighlightThese" value="" />
<input type="button" value="Clear Highlighting" onclick="clearHighlight();" />
<span class="animatebox">
Animate during simulation:
<input type="checkbox" id="animateModeCheckbox" onchange="updateChipLayoutAnimation(this.checked)"
/></span>
&nbsp;
</form>
<form>
<input type="button" value="Hide Chip Layout" onclick="updateChipLayoutVisibility(false)" />
<a href="" id="linkHere" >Link to this location</a>
</form>
</div>

View File

@ -279,6 +279,39 @@ function recenter(){
document.getElementById('linkHere').href=location.pathname+"?"+whereAmIAsQuery();
}
var highlightThese;
// flash some set of nodes according to user input
function hiliteNodeList(){
var tmplist = document.getElementById('HighlightThese').value.split(/[\s,]+/);
if(tmplist.length==0){
// request to highlight nothing, so switch off any signal highlighting
hiliteNode(-1);
return;
}
highlightThese = [];
for(var i=0;i<tmplist.length;i++){
// get a node number from a signal name or a node number
var name = tmplist[i];
var value = parseInt(tmplist[i]);
if((value!=NaN) && (typeof nodes[name] != "undefined")) {
highlightThese.push(value);
} else if(typeof nodenames[name] != "undefined") {
highlightThese.push(nodenames[name]);
}
// invalid input: how to tell the user?
}
if(highlightThese.length==0){
// all input rejected: how to tell the user?
return;
}
clearHighlight(); // nullify the simulation overlay (orange/purple)
hiliteNode(-1); // unhighlight all nodes
setTimeout("hiliteNode(highlightThese);", 400);
setTimeout("hiliteNode(-1);", 800);
setTimeout("hiliteNode(highlightThese);", 1200);
}
function handleClick(e){
var x = localx(hilite, e.clientX)/zoom;
var y = localy(hilite, e.clientY)/zoom;