A specialized subclass of PopulateMenuEventArgs that carries the item for which the context menu should be populated.
Type Parameters
- TModelItem
- The type of the
.
Type Details
- yfiles module
- view-component
- yfiles-umd modules
- All view modules
- Legacy UMD name
- yfiles.input.PopulateItemContextMenuEventArgs
Constructors
PopulateItemContextMenuEventArgs
(context: IInputModeContext, queryLocation: Point, item: TModelItem)Initializes a new instance of the PopulateItemContextMenuEventArgs<TModelItem> class.
Parameters
A map of options to pass to the method.
- context - IInputModeContext
- The context to populate the menu for.
- queryLocation - Point
- The query location.
- item - TModelItem
- The item for which the context menu should be populated, may be
null
.
Properties
Gets the context for the current event.
Defined in
Gets or sets a value indicating whether this PopulateMenuEventArgs has been handled.
Remarks
If this event is marked as handled, the input mode will use the property showMenu to decide whether to show the context menu.
This property is automatically set to true
if a value is assigned to the property showMenu.
Note that this property needs to be set before the function synchronously returns. This means that setting the value in an async
function after the first await
or in an asynchronous callback, it cannot not be seen by the emitter of the event and the sender will consider the event as not being handled.
// wrong:
mode.addPopulateMenuListener(async (sender, args) => {
await something()
args.handled = true // will be set *after* all other event listeners have been invoked, only
})
// correct:
mode.addPopulateMenuListener(async (sender, args) => {
args.handled = true // will be set immediately and 'mode' will see the change
await something()
})
Defined in
Gets the queried location in world coordinates.
Defined in
Gets or sets a value indicating whether to actually display the context menu.
Remarks
This will set the handled property to true
.
The default value of this property is true
.