documentationfor yFiles for HTML 3.0.0.3

EditLabelHelper

An IEditLabelHelper implementation which provides a number of methods that can be overridden to change the default behavior.

Inheritance Hierarchy
EditLabelHelper
Implemented Interfaces

Remarks

This implementation exhibits the default behavior which is modeled after the behavior used by GraphEditorInputMode's startLabelAddition and startLabelEditing. It can be customized by overriding its various factory methods.

Examples

It is recommended to use the various protected methods to customize the wanted behavior while keeping the overall functionality unchanged.
Modifying the initial properties of a new edge label
class CustomEditLabelHelper extends BaseClass(EditLabelHelper) {
  protected onLabelAdding(
    context: IInputModeContext,
    evt: LabelEditingEventArgs,
  ): void {
    // let the base implementation do the work
    super.onLabelAdding(context, evt)
    // for new edge labels: use a custom parameter
    if (evt.owner instanceof IEdge) {
      evt.layoutParameter =
        new EdgeSegmentLabelModel().createParameterFromCenter()
    }
  }
}
The new implementation can be conveniently set using the GraphDecorator:
Setting a new EditLabelHelper for edges
graph.decorator.edges.editLabelHelper.addConstant(
  new CustomEditLabelHelper(),
)

Type Details

yFiles module
view

Properties

Methods