InputModeItemChangedEventArgs<TItem extends IModelItem,TDetail extends EventArgs>
Event argument that is used by events that indicate deletion or change of an item which is triggered by IInputMode implementations.
Remarks
A specialized subclass of the InputModeItemEventArgs<TModelItem> class that is bound to the IModelItem type and carries detailed context information about the state before the item has been changed or deleted.
If the deleted or changed item was an INode the details property holds a NodeEventArgs instance that provides additional information about the parent node and the group node status of the node before it was deleted or changed.
If the deleted or changed item was an IEdge the details property holds a EdgeEventArgs instance that provides the source and target port information of the edge before it was deleted or changed.
If the deleted item was an IPort the details property holds a PortEventArgs instance that provides the owner of the port before it was deleted.
If the deleted item was an ILabel the details property holds a LabelEventArgs instance that provides the owner of the label before it was deleted.
If the deleted item was an IBend the details property holds a BendEventArgs instance that provides owner and index information of the bend before it was deleted.
Examples
function OnItemDeleted(
e: InputModeItemChangedEventArgs<IModelItem, EventArgs>,
) {
if (e.details instanceof NodeEventArgs) {
const ne = e.details as NodeEventArgs
console.log(`Old parent: ${ne.parent}`)
} else if (e.details instanceof EdgeEventArgs) {
const ee = e.details as EdgeEventArgs
console.log(`Old source port owner: ${ee.sourcePortOwner}`)
console.log(`Old target port owner: ${ee.targetPortOwner}`)
} else if (e.details instanceof PortEventArgs) {
const pe = e.details as PortEventArgs
console.log(`Old port owner: ${pe.owner}`)
} else if (e.details instanceof LabelEventArgs) {
const le = e.details as LabelEventArgs
console.log(`Old label owner: ${le.owner}`)
} else if (e.details instanceof BendEventArgs) {
const be = e.details as BendEventArgs
console.log(`Old bend owner: ${be.owner}`)
}
}
Type Parameters
- TItem: IModelItem
- The type of the changed item.
- TDetail: EventArgs
- Holder of additional details, see above.
Type Details
- yFiles module
- view
Constructors
Initializes a new instance of the InputModeItemChangedEventArgs<TItem,TDetail> class.
Parameters
A map of options to pass to the method.
- context - IInputModeContext
- The context to initialize the context property with.
- item - TItem
- The item that has been deleted.
- detail - TDetail
- Additional information about the state of the item, before it has been deleted.
Properties
Gets the context for the current event.
Gets the item which has been created or changed.