@maxgraph/core
    Preparing search index...

    Class CellMarker

    A helper class to process mouse locations and highlight cells.

    Helper class to highlight cells. To add a cell marker to an existing graph for highlighting all cells, the following code is used:

    const marker = new CellMarker(graph);
    graph.addMouseListener({
    mouseDown: ()=> {},
    mouseMove: (sender, me)=>
    {
    marker.process(me);
    },
    mouseUp: ()=> {}
    });

    Event: InternalEvent.MARK

    Fires after a cell has been marked or unmarked. The state property contains the marked or null if no state is marked.

    Hierarchy (View Summary)

    Index

    Constructors

    • Constructs a new cell marker.

      Parameters

      • graph: Graph

        Reference to the enclosing Graph.

      • validColor: string = DEFAULT_VALID_COLOR

        Optional marker color for valid states. Default is DEFAULT_VALID_COLOR.

      • invalidColor: string = DEFAULT_INVALID_COLOR

        Optional marker color for invalid states. Default is DEFAULT_INVALID_COLOR.

      • hotspot: number = DEFAULT_HOTSPOT

        Portion of the width and height where a state intersects a given coordinate pair. A value of 0 means always highlight. Default is DEFAULT_HOTSPOT.

      Returns CellMarker

    Properties

    currentColor: string = NONE

    Holds the current marker color.

    enabled: boolean = true

    Specifies if the marker is enabled.

    true
    
    eventListeners: EventListenerObject[] = []

    Holds the event names and associated listeners in an array. The array contains the event name followed by the respective listener for each registered listener.

    eventsEnabled: boolean = true

    Specifies if events can be fired. Default is true.

    eventSource: null | EventTarget = null

    Optional source for events. Default is null.

    graph: Graph

    Reference to the enclosing Graph.

    highlight: CellHighlight
    hotspot: number = DEFAULT_HOTSPOT

    Specifies the portion of the width and height that should trigger a highlight.

    The area around the center of the cell to be marked is used as the hotspot. Possible values are between 0 and 1.

    DEFAULT_HOTSPOT
    
    hotspotEnabled: boolean = false

    Specifies if the hotspot is enabled.

    false
    
    invalidColor: string

    Holds the invalid marker color.

    markedState: null | CellState = null

    Holds the marked CellState.

    validColor: string

    Holds the valid marker color.

    validState: null | CellState = null

    Holds the marked CellState if it is valid.

    Methods

    • Binds the specified function to the given event name. If no event name is given, then the listener is registered for all events.

      The parameters of the listener are the sender and an EventObject.

      Parameters

      • name: string
      • funct: Function

      Returns void

    • Dispatches the given event to the listeners which are registered for the event. The sender argument is optional. The current execution scope ("this") is used for the listener invocation (see Utils#bind).

      Example:

      fireEvent(new mxEventObject("eventName", key1, val1, .., keyN, valN))
      

      Parameters

      • evt: EventObject

        EventObject that represents the event.

      • sender: null | EventTarget = null

        Optional sender to be passed to the listener. Default value is the return value of .

      Returns void

    • Enables or disables event handling. This implementation updates enabled.

      Parameters

      • enabled: boolean

        Boolean that specifies the new enabled state.

      Returns void

    • Specifies whether the hotspot should be used in .

      Parameters

      • enabled: boolean

      Returns void