mxCellTracker

Event handler that highlights cells.  Inherits from mxCellMarker.

Example

new mxCellTracker(graph, '#00FF00');

For detecting dragEnter, dragOver and dragLeave on cells, the following code can be used:

graph.addMouseListener(
{
  cell: null,
  mouseDown: function(sender, me) { },
  mouseMove: function(sender, me)
  {
    let tmp = me.getCell();

    if (tmp != this.cell)
    {
      if (this.cell != null)
      {
        this.dragLeave(me.getEvent(), this.cell);
      }

      this.cell = tmp;

      if (this.cell != null)
      {
        this.dragEnter(me.getEvent(), this.cell);
      }
    }

    if (this.cell != null)
    {
      this.dragOver(me.getEvent(), this.cell);
    }
  },
  mouseUp: function(sender, me) { },
  dragEnter: function(evt, cell)
  {
    mxLog.debug('dragEnter', cell.value);
  },
  dragOver: function(evt, cell)
  {
    mxLog.debug('dragOver', cell.value);
  },
  dragLeave: function(evt, cell)
  {
    mxLog.debug('dragLeave', cell.value);
  }
});
Summary
mxCellTrackerEvent handler that highlights cells.
Functions
mxCellTrackerConstructs an event handler that highlights cells.
mouseDownIgnores the event.
mouseMoveHandles the event by highlighting the cell under the mousepointer if it is over the hotspot region of the cell.
mouseUpHandles the event by reseting the highlight.
destroyDestroys the object and all its resources and DOM nodes.

Functions

mxCellTracker

function mxCellTracker(graph,
color,
funct)

Constructs an event handler that highlights cells.

Parameters

graphReference to the enclosing mxGraph.
colorColor of the highlight.  Default is blue.
functOptional JavaScript function that is used to override mxCellMarker.getCell.

mouseDown

mxCellTracker.prototype.mouseDown = function(sender,
me)

Ignores the event.  The event is not consumed.

mouseMove

mxCellTracker.prototype.mouseMove = function(sender,
me)

Handles the event by highlighting the cell under the mousepointer if it is over the hotspot region of the cell.

mouseUp

mxCellTracker.prototype.mouseUp = function(sender,
me)

Handles the event by reseting the highlight.

destroy

mxCellTracker.prototype.destroy = function()

Destroys the object and all its resources and DOM nodes.  This doesn’t normally need to be called.  It is called automatically when the window unloads.

function mxCellTracker(graph,
color,
funct)
Constructs an event handler that highlights cells.
mxCellTracker.prototype.mouseDown = function(sender,
me)
Ignores the event.
mxCellTracker.prototype.mouseMove = function(sender,
me)
Handles the event by highlighting the cell under the mousepointer if it is over the hotspot region of the cell.
mxCellTracker.prototype.mouseUp = function(sender,
me)
Handles the event by reseting the highlight.
mxCellTracker.prototype.destroy = function()
Destroys the object and all its resources and DOM nodes.
A helper class to process mouse locations and highlight cells.
Extends mxEventSource to implement a graph component for the browser.
mxCellMarker.prototype.getCell = function(me)
Returns the mxCell for the given event and cell.
Close