GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • @maxgraph/core

This view

  • Original page
  • New address

GeezerVison is showing maxgraph.github.io — ConnectionHandlerCellMarker | @maxgraph/core

  • ConnectionHandlerCellMarker

Class ConnectionHandlerCellMarker

A helper class to process mouse locations and 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: ()=> {}
});

Events

InternalEvent.MARK

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

Hierarchy (View Summary)

  • CellMarker
    • ConnectionHandlerCellMarker
  • Defined in view/plugin/ConnectionHandler.ts:2016
Index

Constructors

constructor

Properties

connectionHandler currentColor enabled eventListeners eventsEnabled eventSource graph highlight hotspot hotspotEnabled invalidColor markedState validColor validState

Methods

addListener createCellHighlight destroy fireEvent getCell getEventSource getHotspot getMarkedState getMarkerColor getState getStateToMark getValidState hasValidState intersects isEnabled isEventsEnabled isHotspotEnabled isValidState mark markCell process removeListener reset setCurrentState setEnabled setEventsEnabled setEventSource setHotspot setHotspotEnabled unmark

Constructors

constructor

  • new ConnectionHandlerCellMarker(
        graph: AbstractGraph,
        connectionHandler: ConnectionHandler,
        validColor?: string,
        invalidColor?: string,
        hotspot?: number,
    ): ConnectionHandlerCellMarker

    Parameters

    • graph: AbstractGraph
    • connectionHandler: ConnectionHandler
    • validColor: string = VALID_COLOR
    • invalidColor: string = DEFAULT_INVALID_COLOR
    • hotspot: number = DEFAULT_HOTSPOT

    Returns ConnectionHandlerCellMarker

    Overrides CellMarker.constructor

    • Defined in view/plugin/ConnectionHandler.ts:2021

Properties

connectionHandler

connectionHandler: ConnectionHandler
  • Defined in view/plugin/ConnectionHandler.ts:2017

currentColor

currentColor: string = NONE

Holds the current marker color.

Inherited from CellMarker.currentColor

  • Defined in view/cell/CellMarker.ts:98

enabled

enabled: boolean = true

Specifies if the marker is enabled.

Default

true

Inherited from CellMarker.enabled

  • Defined in view/cell/CellMarker.ts:69

eventListeners

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.

Inherited from CellMarker.eventListeners

  • Defined in view/event/EventSource.ts:58

eventsEnabled

eventsEnabled: boolean = true

Specifies if events can be fired. Default is true.

Inherited from CellMarker.eventsEnabled

  • Defined in view/event/EventSource.ts:63

eventSource

eventSource: EventTarget | null = null

Optional source for events.

Default

null

Inherited from CellMarker.eventSource

  • Defined in view/event/EventSource.ts:69

graph

graph: AbstractGraph

Reference to the enclosing AbstractGraph.

Inherited from CellMarker.graph

  • Defined in view/cell/CellMarker.ts:63

highlight

highlight: CellHighlight

Inherited from CellMarker.highlight

  • Defined in view/cell/CellMarker.ts:110

hotspot

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

DEFAULT_HOTSPOT

Inherited from CellMarker.hotspot

  • Defined in view/cell/CellMarker.ts:77

hotspotEnabled

hotspotEnabled: boolean = true

Specifies if the hotspot is enabled.

Default

false

Overrides CellMarker.hotspotEnabled

  • Defined in view/plugin/ConnectionHandler.ts:2019

invalidColor

invalidColor: string

Holds the invalid marker color.

Inherited from CellMarker.invalidColor

  • Defined in view/cell/CellMarker.ts:93

markedState

markedState: CellState | null = null

Holds the marked CellState.

Inherited from CellMarker.markedState

  • Defined in view/cell/CellMarker.ts:108

validColor

validColor: string

Holds the valid marker color.

Inherited from CellMarker.validColor

  • Defined in view/cell/CellMarker.ts:88

validState

validState: CellState | null = null

Holds the marked CellState if it is valid.

Inherited from CellMarker.validState

  • Defined in view/cell/CellMarker.ts:103

Methods

addListener

  • addListener(name: string, funct: Function): void

    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

    Inherited from CellMarker.addListener

    • Defined in view/event/EventSource.ts:105

ProtectedcreateCellHighlight

  • createCellHighlight(graph: AbstractGraph): CellHighlight

    Hook method to override the implementation of highlight.

    Parameters

    • graph: AbstractGraph

    Returns CellHighlight

    Since

    0.22.0

    Inherited from CellMarker.createCellHighlight

    • Defined in view/cell/CellMarker.ts:139

destroy

  • destroy(): void

    Destroys the handler and all its resources and DOM nodes.

    Returns void

    Inherited from CellMarker.destroy

    • Defined in view/cell/CellMarker.ts:366

fireEvent

  • fireEvent(evt: EventObject, sender?: EventTarget | null): 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.

    Example:

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

    Parameters

    • evt: EventObject

      EventObject that represents the event.

    • sender: EventTarget | null = null

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

    Returns void

    Inherited from CellMarker.fireEvent

    • Defined in view/event/EventSource.ts:139

getCell

  • getCell(me: InternalMouseEvent): Cell | null

    Returns the Cell for the given event and cell. This implementation returns the given cell.

    Parameters

    • me: InternalMouseEvent

    Returns Cell | null

    Overrides CellMarker.getCell

    • Defined in view/plugin/ConnectionHandler.ts:2034

getEventSource

  • getEventSource(): EventTarget | null

    Returns eventSource.

    Returns EventTarget | null

    Inherited from CellMarker.getEventSource

    • Defined in view/event/EventSource.ts:88

getHotspot

  • getHotspot(): number

    Returns the hotspot.

    Returns number

    Inherited from CellMarker.getHotspot

    • Defined in view/cell/CellMarker.ts:171

getMarkedState

  • getMarkedState(): CellState | null

    Returns the markedState.

    Returns CellState | null

    Inherited from CellMarker.getMarkedState

    • Defined in view/cell/CellMarker.ts:206

getMarkerColor

  • getMarkerColor(evt: Event, state: CellState, isValid: boolean): string

    Returns the validColor or invalidColor depending on the value of isValid. The given CellState is ignored by this implementation.

    Parameters

    • evt: Event
    • state: CellState
    • isValid: boolean

    Returns string

    Overrides CellMarker.getMarkerColor

    • Defined in view/plugin/ConnectionHandler.ts:2114

getState

  • getState(me: InternalMouseEvent): CellState | null

    Uses getCell, getStateToMark and intersects to return the CellState for the given MouseEvent.

    Parameters

    • me: InternalMouseEvent

    Returns CellState | null

    Inherited from CellMarker.getState

    • Defined in view/cell/CellMarker.ts:314

getStateToMark

  • getStateToMark(state: CellState | null): CellState | null

    Returns the CellState to be marked for the given CellState under the mouse. This implementation returns the given state.

    Parameters

    • state: CellState | null

    Returns CellState | null

    Inherited from CellMarker.getStateToMark

    • Defined in view/cell/CellMarker.ts:337

getValidState

  • getValidState(): CellState | null

    Returns the validState.

    Returns CellState | null

    Inherited from CellMarker.getValidState

    • Defined in view/cell/CellMarker.ts:199

hasValidState

  • hasValidState(): boolean

    Returns true if validState is not null.

    Returns boolean

    Inherited from CellMarker.hasValidState

    • Defined in view/cell/CellMarker.ts:192

intersects

  • intersects(state: CellState, evt: InternalMouseEvent): boolean

    Returns true if the given coordinate pair intersects the given state. This returns true if the hotspot is 0 or the coordinates are inside the hotspot for the given cell state.

    Parameters

    • state: CellState
    • evt: InternalMouseEvent

    Returns boolean

    Overrides CellMarker.intersects

    • Defined in view/plugin/ConnectionHandler.ts:2122

isEnabled

  • isEnabled(): boolean

    Returns true if events are handled. This implementation returns enabled.

    Returns boolean

    Inherited from CellMarker.isEnabled

    • Defined in view/cell/CellMarker.ts:157

isEventsEnabled

  • isEventsEnabled(): boolean

    Returns eventsEnabled.

    Returns boolean

    Inherited from CellMarker.isEventsEnabled

    • Defined in view/event/EventSource.ts:74

isHotspotEnabled

  • isHotspotEnabled(): boolean

    Returns true if hotspot is used in .

    Returns boolean

    Inherited from CellMarker.isHotspotEnabled

    • Defined in view/cell/CellMarker.ts:185

isValidState

  • isValidState(state: CellState): boolean

    Returns true if the given CellState is a valid state. If this returns true, then the state is stored in validState. The return value of this method is used as the argument for getMarkerColor.

    Parameters

    • state: CellState

    Returns boolean

    Overrides CellMarker.isValidState

    • Defined in view/plugin/ConnectionHandler.ts:2105

mark

  • mark(): void

    Marks the markedState and fires a InternalEvent.MARK event.

    Returns void

    Inherited from CellMarker.mark

    • Defined in view/cell/CellMarker.ts:281

markCell

  • markCell(cell: Cell, color: string): void

    Marks the given cell using the given color, or validColor if no color is specified.

    Parameters

    • cell: Cell
    • color: string

    Returns void

    Inherited from CellMarker.markCell

    • Defined in view/cell/CellMarker.ts:268

process

  • process(me: InternalMouseEvent): CellState | null

    Processes the given event and cell and marks the state returned by getState with the color returned by getMarkerColor. If the markerColor is not null, then the state is stored in markedState. If isValidState returns true, then the state is stored in validState regardless of the marker color. The state is returned regardless of the marker color and valid state.

    Parameters

    • me: InternalMouseEvent

    Returns CellState | null

    Inherited from CellMarker.process

    • Defined in view/cell/CellMarker.ts:228

removeListener

  • removeListener(funct: Function): void

    Removes all occurrences of the given listener from eventListeners.

    Parameters

    • funct: Function

    Returns void

    Inherited from CellMarker.removeListener

    • Defined in view/event/EventSource.ts:112

reset

  • reset(): void

    Resets the state of the cell marker.

    Returns void

    Inherited from CellMarker.reset

    • Defined in view/cell/CellMarker.ts:213

setCurrentState

  • setCurrentState(
        state: CellState | null,
        me: InternalMouseEvent,
        color?: string,
    ): void

    Sets and marks the current valid state.

    Parameters

    • state: CellState | null
    • me: InternalMouseEvent
    • Optionalcolor: string

    Returns void

    Inherited from CellMarker.setCurrentState

    • Defined in view/cell/CellMarker.ts:242

setEnabled

  • setEnabled(enabled: boolean): void

    Enables or disables event handling. This implementation updates enabled.

    Parameters

    • enabled: boolean

      Boolean that specifies the new enabled state.

    Returns void

    Inherited from CellMarker.setEnabled

    • Defined in view/cell/CellMarker.ts:149

setEventsEnabled

  • setEventsEnabled(value: boolean): void

    Sets eventsEnabled.

    Parameters

    • value: boolean

    Returns void

    Inherited from CellMarker.setEventsEnabled

    • Defined in view/event/EventSource.ts:81

setEventSource

  • setEventSource(value: EventTarget | null): void

    Sets eventSource.

    Parameters

    • value: EventTarget | null

    Returns void

    Inherited from CellMarker.setEventSource

    • Defined in view/event/EventSource.ts:95

setHotspot

  • setHotspot(hotspot: number): void

    Sets the hotspot.

    Parameters

    • hotspot: number

    Returns void

    Inherited from CellMarker.setHotspot

    • Defined in view/cell/CellMarker.ts:164

setHotspotEnabled

  • setHotspotEnabled(enabled: boolean): void

    Specifies whether the hotspot should be used in .

    Parameters

    • enabled: boolean

    Returns void

    Inherited from CellMarker.setHotspotEnabled

    • Defined in view/cell/CellMarker.ts:178

unmark

  • unmark(): void

    Hides the marker and fires a InternalEvent.MARK event.

    Returns void

    Inherited from CellMarker.unmark

    • Defined in view/cell/CellMarker.ts:290

Settings

Member Visibility
  • Protected
  • Inherited
Theme

On This Page

Events
Constructors
constructor
Properties
connectionHandlercurrentColorenabledeventListenerseventsEnabledeventSourcegraphhighlighthotspothotspotEnabledinvalidColormarkedStatevalidColorvalidState
Methods
addListenercreateCellHighlightdestroyfireEventgetCellgetEventSourcegetHotspotgetMarkedStategetMarkerColorgetStategetStateToMarkgetValidStatehasValidStateintersectsisEnabledisEventsEnabledisHotspotEnabledisValidStatemarkmarkCellprocessremoveListenerresetsetCurrentStatesetEnabledsetEventsEnabledsetEventSourcesetHotspotsetHotspotEnabledunmark
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.