OperatorStack
-
class
cee.OperatorStack() The
OperatorStackmanages registeredOperatorinstances for a view. Any active operators on the stack will be called in a “Last In, First Called” order. An operator event listener method (i.e. onMouseDown, onWheel, onKeyDown, etc.) will return anOperatorEventStatusto indicate whether the particular event should be propagated to the next operator in the stack, or if it should be stopped.Since multiple operators can be added to the stack and respond to the same single event, the order of operators matters and it is important to understand an operator propagates different events. It is recommend that more global operators, such as the
NavigationOperator, are added first, and more specific and local operators are added last. This way, local operations can be captured and handled before they are propagated to the more global operations, if so desired.When a new operator is pushed to the stack, the operator stack will track the reference to that operator object. You can then use the
OperatorStack.getmethod to retrieve a reference to the operator object by name (regardless of whether that operator object is active and on the stack or not). The prevents the need to instantiate and set up the same operator again, and preserves the state of any setup operators. If you push a new instance of an operator with a previously used name, the old operator reference will be replaced with the new one.By default, the
OperatorStackis empty when aViewis created. It is the developers responsibility to add any desired default operators in your application. You can remove operators with theOperatorStack.pop,OperatorStack.remove, orOperatorStack.clearmethods.
Accessors
-
cee.OperatorStack.activeOperators() - get activeOperators():
Operator[]Returns the array of active
OperatorobjectsReturns:
Operator[]
-
cee.OperatorStack.hotKeyOperator() - get hotKeyOperator():
OperatorSets the hot key operator for this operator stack. The hot key (Alt/Opt) can be held to temporarily use this operator without reordering the stack. The operator must already be in the stack to be used with the hot key. Other stack operators will not be called while the hot key is held. To remove the hot key operator designation, but keep the operator on the stack, set the hot key operator to null.
Returns:
Operatorset hotKeyOperator(operator:Operator): voidParameters
operator:OperatorReturns: void
Methods
-
cee.OperatorStack.clear() - clear(): void
Removes all operators from the stack
Returns: void
-
cee.OperatorStack.get() - get(operatorName: S): GetOperatorType
Returns a reference to the operator object with the given name and type. The desired operator does not need to be active on the stack. If the operator was pushed to the stack during the lifetime of the view, it is registered and the reference to the operator can be returned.
If the operator is not found, null will be returned. You can always check if the operator is registered by using the
OperatorStack.hasmethodExmaple usage:
// Standard Operator const standardOperator = view.operators.get(cee.StandardOperator.OPERATOR_ENUM); // Custom User-Provided Operator const myCustomOperator = view.operators.get(MyCustomOperatorName) as MyCustomOperator; const myCustomOperator = view.operators.get<MyCustomOperator>(MyCustomOperatorName); // Generic Operator const generic = view.operators.get("MyOperatorName"); // Returns Operator type w/o cast
Parameters
operatorName: SReturns: GetOperatorType
-
cee.OperatorStack.has() - has(operator: string): boolean
Returns true if the operator has been registered with the operator stack.
Parameters
operator: stringReturns: boolean
-
cee.OperatorStack.indexOf() - indexOf(operator:
Operator): numberReturns the index of an operator on the stack If the operator is not found on the stack, -1 is returned.
Parameters
operator:OperatorReturns: number
-
cee.OperatorStack.peek() - peek():
OperatorReturns the operator at the top of the stack
Returns:
Operator
-
cee.OperatorStack.pop() - pop():
OperatorRemoves an operator from the top of the stack
Returns:
Operator
-
cee.OperatorStack.push() - push(operator:
Operator, setAsHotKeyOperator: boolean): booleanAdds an operator on the stack if it’s not already on the stack
Parameters
operator:
OperatorsetAsHotKeyOperator: boolean
Returns: boolean
-
cee.OperatorStack.remove() - remove(operatorInput: (string |
Operator)): voidRemoves an operator from the stack
Parameters
operatorInput: (string |Operator)Returns: void
-
cee.OperatorStack.set() - set(operator:
Operator, position: number): booleanSets an operator to the 0 based index position on the stack. If there is already an operator in that position, it is replaced. If the operator is already on the stack, it is moved to the requested position.
Parameters
operator:
Operatorposition: number
Returns: boolean
-
cee.OperatorStack.size() - size(): number
Returns the operator stack size
Returns: number