|
@@ -5250,9 +5250,9 @@ if (typeof mxVertexHandler != 'undefined')
|
|
|
links[i].setAttribute('href', href);
|
|
|
|
|
|
if (beforeClick != null)
|
|
|
- {
|
|
|
+ {
|
|
|
mxEvent.addGestureListeners(links[i], null, null, beforeClick);
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -5277,157 +5277,178 @@ if (typeof mxVertexHandler != 'undefined')
|
|
|
scrollTop: 0,
|
|
|
updateCurrentState: function(me)
|
|
|
{
|
|
|
- var tmp = me.sourceState;
|
|
|
-
|
|
|
+ var tmp = me.sourceState;
|
|
|
+
|
|
|
+ // Gets topmost intersecting cell with link
|
|
|
+ if (tmp == null || graph.getLinkForCell(tmp.cell) == null)
|
|
|
+ {
|
|
|
+ var cell = graph.getCellAt(me.getGraphX(), me.getGraphY(), null, null, null, function(state, x, y)
|
|
|
+ {
|
|
|
+ return graph.getLinkForCell(state.cell) == null;
|
|
|
+ });
|
|
|
+
|
|
|
+ tmp = graph.view.getState(cell);
|
|
|
+ }
|
|
|
+
|
|
|
if (tmp != this.currentState)
|
|
|
{
|
|
|
- if (this.currentState != null)
|
|
|
- {
|
|
|
+ if (this.currentState != null)
|
|
|
+ {
|
|
|
this.clear();
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- this.currentState = tmp;
|
|
|
+ this.currentState = tmp;
|
|
|
|
|
|
- if (this.currentState != null)
|
|
|
- {
|
|
|
+ if (this.currentState != null)
|
|
|
+ {
|
|
|
this.activate(this.currentState);
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
mouseDown: function(sender, me)
|
|
|
{
|
|
|
- this.startX = me.getGraphX();
|
|
|
- this.startY = me.getGraphY();
|
|
|
- this.scrollLeft = graph.container.scrollLeft;
|
|
|
- this.scrollTop = graph.container.scrollTop;
|
|
|
-
|
|
|
- if (this.currentLink == null && graph.container.style.overflow == 'auto')
|
|
|
- {
|
|
|
- graph.container.style.cursor = 'move';
|
|
|
- }
|
|
|
-
|
|
|
- this.updateCurrentState(me);
|
|
|
+ this.startX = me.getGraphX();
|
|
|
+ this.startY = me.getGraphY();
|
|
|
+ this.scrollLeft = graph.container.scrollLeft;
|
|
|
+ this.scrollTop = graph.container.scrollTop;
|
|
|
+
|
|
|
+ if (this.currentLink == null && graph.container.style.overflow == 'auto')
|
|
|
+ {
|
|
|
+ graph.container.style.cursor = 'move';
|
|
|
+ }
|
|
|
+
|
|
|
+ this.updateCurrentState(me);
|
|
|
},
|
|
|
mouseMove: function(sender, me)
|
|
|
{
|
|
|
- if (graph.isMouseDown)
|
|
|
- {
|
|
|
- if (this.currentLink != null)
|
|
|
- {
|
|
|
- var dx = Math.abs(this.startX - me.getGraphX());
|
|
|
- var dy = Math.abs(this.startY - me.getGraphY());
|
|
|
-
|
|
|
- if (dx > tol || dy > tol)
|
|
|
- {
|
|
|
- this.clear();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- // Checks for parent link
|
|
|
- var linkNode = me.getSource();
|
|
|
+ if (graph.isMouseDown)
|
|
|
+ {
|
|
|
+ if (this.currentLink != null)
|
|
|
+ {
|
|
|
+ var dx = Math.abs(this.startX - me.getGraphX());
|
|
|
+ var dy = Math.abs(this.startY - me.getGraphY());
|
|
|
|
|
|
- while (linkNode != null && linkNode.nodeName.toLowerCase() != 'a')
|
|
|
+ if (dx > tol || dy > tol)
|
|
|
{
|
|
|
- linkNode = linkNode.parentNode;
|
|
|
+ this.clear();
|
|
|
}
|
|
|
-
|
|
|
- if (linkNode != null)
|
|
|
- {
|
|
|
- this.clear();
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if (this.currentState != null && (me.getState() == this.currentState || me.sourceState == null) &&
|
|
|
- graph.intersects(this.currentState, me.getGraphX(), me.getGraphY()))
|
|
|
- {
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- this.updateCurrentState(me);
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- mouseUp: function(sender, me)
|
|
|
- {
|
|
|
- var source = me.getSource();
|
|
|
- var evt = me.getEvent();
|
|
|
-
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
// Checks for parent link
|
|
|
- var linkNode = source;
|
|
|
+ var linkNode = me.getSource();
|
|
|
|
|
|
while (linkNode != null && linkNode.nodeName.toLowerCase() != 'a')
|
|
|
{
|
|
|
linkNode = linkNode.parentNode;
|
|
|
}
|
|
|
|
|
|
- // Ignores clicks on links and collapse/expand icon
|
|
|
- if (linkNode == null &&
|
|
|
- (((Math.abs(this.scrollLeft - graph.container.scrollLeft) < tol &&
|
|
|
- Math.abs(this.scrollTop - graph.container.scrollTop) < tol) &&
|
|
|
- (me.sourceState == null || !me.isSource(me.sourceState.control))) &&
|
|
|
- (((mxEvent.isLeftMouseButton(evt) || mxEvent.isMiddleMouseButton(evt)) &&
|
|
|
- !mxEvent.isPopupTrigger(evt)) || mxEvent.isTouchEvent(evt))))
|
|
|
- {
|
|
|
- if (this.currentLink != null)
|
|
|
+ if (linkNode != null)
|
|
|
+ {
|
|
|
+ this.clear();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (graph.tooltipHandler != null && this.currentLink != null && this.currentState != null)
|
|
|
+ {
|
|
|
+ graph.tooltipHandler.reset(me, true, this.currentState);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (this.currentState != null && (me.getState() == this.currentState || me.sourceState == null) &&
|
|
|
+ graph.intersects(this.currentState, me.getGraphX(), me.getGraphY()))
|
|
|
{
|
|
|
- var blank = graph.isBlankLink(this.currentLink);
|
|
|
-
|
|
|
- if ((this.currentLink.substring(0, 5) === 'data:' ||
|
|
|
- !blank) && beforeClick != null)
|
|
|
- {
|
|
|
- beforeClick(evt, this.currentLink);
|
|
|
- }
|
|
|
-
|
|
|
- if (!mxEvent.isConsumed(evt))
|
|
|
- {
|
|
|
- var target = (mxEvent.isMiddleMouseButton(evt)) ? '_blank' :
|
|
|
- ((blank) ? graph.linkTarget : '_top');
|
|
|
- graph.openLink(this.currentLink, target);
|
|
|
- me.consume();
|
|
|
- }
|
|
|
+ return;
|
|
|
}
|
|
|
- else if (onClick != null && !me.isConsumed() &&
|
|
|
- (Math.abs(this.scrollLeft - graph.container.scrollLeft) < tol &&
|
|
|
- Math.abs(this.scrollTop - graph.container.scrollTop) < tol) &&
|
|
|
- (Math.abs(this.startX - me.getGraphX()) < tol &&
|
|
|
- Math.abs(this.startY - me.getGraphY()) < tol))
|
|
|
- {
|
|
|
- onClick(me.getEvent());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- this.clear();
|
|
|
+
|
|
|
+ this.updateCurrentState(me);
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
- activate: function(state)
|
|
|
+ mouseUp: function(sender, me)
|
|
|
{
|
|
|
- this.currentLink = graph.getAbsoluteUrl(graph.getLinkForCell(state.cell));
|
|
|
-
|
|
|
+ var source = me.getSource();
|
|
|
+ var evt = me.getEvent();
|
|
|
+
|
|
|
+ // Checks for parent link
|
|
|
+ var linkNode = source;
|
|
|
+
|
|
|
+ while (linkNode != null && linkNode.nodeName.toLowerCase() != 'a')
|
|
|
+ {
|
|
|
+ linkNode = linkNode.parentNode;
|
|
|
+ }
|
|
|
+
|
|
|
+ // Ignores clicks on links and collapse/expand icon
|
|
|
+ if (linkNode == null &&
|
|
|
+ (((Math.abs(this.scrollLeft - graph.container.scrollLeft) < tol &&
|
|
|
+ Math.abs(this.scrollTop - graph.container.scrollTop) < tol) &&
|
|
|
+ (me.sourceState == null || !me.isSource(me.sourceState.control))) &&
|
|
|
+ (((mxEvent.isLeftMouseButton(evt) || mxEvent.isMiddleMouseButton(evt)) &&
|
|
|
+ !mxEvent.isPopupTrigger(evt)) || mxEvent.isTouchEvent(evt))))
|
|
|
+ {
|
|
|
if (this.currentLink != null)
|
|
|
{
|
|
|
- graph.container.style.cursor = 'pointer';
|
|
|
-
|
|
|
- if (this.highlight != null)
|
|
|
+ var blank = graph.isBlankLink(this.currentLink);
|
|
|
+
|
|
|
+ if ((this.currentLink.substring(0, 5) === 'data:' ||
|
|
|
+ !blank) && beforeClick != null)
|
|
|
+ {
|
|
|
+ beforeClick(evt, this.currentLink);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!mxEvent.isConsumed(evt))
|
|
|
{
|
|
|
- this.highlight.highlight(state);
|
|
|
+ var target = (mxEvent.isMiddleMouseButton(evt)) ? '_blank' :
|
|
|
+ ((blank) ? graph.linkTarget : '_top');
|
|
|
+ graph.openLink(this.currentLink, target);
|
|
|
+ me.consume();
|
|
|
}
|
|
|
+ }
|
|
|
+ else if (onClick != null && !me.isConsumed() &&
|
|
|
+ (Math.abs(this.scrollLeft - graph.container.scrollLeft) < tol &&
|
|
|
+ Math.abs(this.scrollTop - graph.container.scrollTop) < tol) &&
|
|
|
+ (Math.abs(this.startX - me.getGraphX()) < tol &&
|
|
|
+ Math.abs(this.startY - me.getGraphY()) < tol))
|
|
|
+ {
|
|
|
+ onClick(me.getEvent());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ this.clear();
|
|
|
+ },
|
|
|
+ activate: function(state)
|
|
|
+ {
|
|
|
+ this.currentLink = graph.getAbsoluteUrl(graph.getLinkForCell(state.cell));
|
|
|
+
|
|
|
+ if (this.currentLink != null)
|
|
|
+ {
|
|
|
+ graph.container.style.cursor = 'pointer';
|
|
|
+
|
|
|
+ if (this.highlight != null)
|
|
|
+ {
|
|
|
+ this.highlight.highlight(state);
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
clear: function()
|
|
|
{
|
|
|
- if (graph.container != null)
|
|
|
- {
|
|
|
- graph.container.style.cursor = cursor;
|
|
|
- }
|
|
|
-
|
|
|
- this.currentState = null;
|
|
|
- this.currentLink = null;
|
|
|
-
|
|
|
- if (this.highlight != null)
|
|
|
- {
|
|
|
- this.highlight.hide();
|
|
|
- }
|
|
|
+ if (graph.container != null)
|
|
|
+ {
|
|
|
+ graph.container.style.cursor = cursor;
|
|
|
+ }
|
|
|
+
|
|
|
+ this.currentState = null;
|
|
|
+ this.currentLink = null;
|
|
|
+
|
|
|
+ if (this.highlight != null)
|
|
|
+ {
|
|
|
+ this.highlight.hide();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (graph.tooltipHandler != null)
|
|
|
+ {
|
|
|
+ graph.tooltipHandler.hide();
|
|
|
+ }
|
|
|
}
|
|
|
};
|
|
|
|