mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 03:44:02 +02:00
[Case 6491] Some adjustments to isActiveTool (details below).
* isActiveTool now respects null and undefined args. * If null or undefined toolHandle is passed, activeTool is directly tested against those values. Rather than explicitly returning false. * Added some clarification to unknown tool warning message. Reviewed-by: Leander Hasty <leander@1stplayable.com> Changes Committed: modified: scripts/system/libraries/entitySelectionTool.js
This commit is contained in:
parent
bed50dda2f
commit
2bb76a357a
1 changed files with 13 additions and 13 deletions
|
@ -1087,23 +1087,23 @@ SelectionDisplay = (function() {
|
|||
return tool;
|
||||
}
|
||||
|
||||
// toolHandle: The overlayID associated with the tool
|
||||
// that correlates to the tool you wish to query.
|
||||
// @param: toolHandle: The overlayID associated with the tool
|
||||
// that correlates to the tool you wish to query.
|
||||
// @note: If toolHandle is null or undefined then activeTool
|
||||
// will be checked against those values as opposed to
|
||||
// the tool registered under toolHandle. Null & Undefined
|
||||
// are treated as separate values.
|
||||
// @return: bool - Indicates if the activeTool is that queried.
|
||||
function isActiveTool(toolHandle) {
|
||||
var wantDebug = false;
|
||||
if ( ! activeTool || ! toolHandle ){
|
||||
if(wantDebug){
|
||||
if ( activeTool ){
|
||||
print("WARNING: entitySelectionTool.isActiveTool - Encountered invalid toolHandle: " + toolHandle );
|
||||
}
|
||||
}
|
||||
return false;
|
||||
if ( ! toolHandle ) {
|
||||
// Allow isActiveTool( null ) and similar to return true if there's
|
||||
// no active tool
|
||||
return ( activeTool === toolHandle );
|
||||
}
|
||||
|
||||
if ( ! grabberTools.hasOwnProperty( toolHandle ) ) {
|
||||
if(wantDebug){
|
||||
print("WARNING: entitySelectionTool.isActiveTool - Encountered unknown grabberToolHandle: " + toolHandle );
|
||||
}
|
||||
print("WARNING: entitySelectionTool.isActiveTool - Encountered unknown grabberToolHandle: " + toolHandle + ". Tools should be egistered via addGrabberTool." );
|
||||
//--EARLY EXIT--
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue