OperatorStack
-
class
cee.
OperatorStack
() The
OperatorStack
manages registeredOperator``s 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 an ``OperatorEventStatus
to 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.get
method 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
OperatorStack
is empty when aView
is 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.clear
methods.
Accessors
Accessors
-
OperatorStack.
activeOperators
() Returns the array of active
Operator
objectsReturn type: [Operator]
-
OperatorStack.
hotKeyOperator
() Sets 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.
Return type: Operator
Methods
get
-
OperatorStack.
get
(operatorName) Arguments: - operatorName (
S
) – None
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.has
methodExmaple 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
Return type: GetOperatorType <S, T> - operatorName (
has
-
OperatorStack.
has
(operator) Arguments: - operator (
string
) – None
Returns true if the operator has been registered with the operator stack.
Return type: boolean - operator (
indexOf
push
remove
-
OperatorStack.
remove
(operatorInput) Arguments: - operatorInput (
string | Operator
) – None
Removes an operator from the stack
Return type: void - operatorInput (
set
-
OperatorStack.
set
(operator, position) Arguments: - operator (
Operator
) – None - position (
number
) – None
Sets 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.
Return type: boolean - operator (