|
|
@@ -360,11 +360,18 @@ Graph = function(container, model, renderHint, stylesheet, themes, standalone)
|
|
|
if (handler == null || handler.getHandleForEvent(me) == null)
|
|
|
{
|
|
|
var box = new mxRectangle(me.getGraphX() - 1, me.getGraphY() - 1);
|
|
|
- box.grow(mxEvent.isTouchEvent(me.getEvent()) ?
|
|
|
- mxShape.prototype.svgStrokeTolerance - 1 :
|
|
|
- (mxShape.prototype.svgStrokeTolerance + 1) / 2);
|
|
|
-
|
|
|
- if (this.isTableCell(state.cell) && !this.isCellSelected(state.cell))
|
|
|
+ var tol = mxEvent.isTouchEvent(me.getEvent()) ?
|
|
|
+ mxShape.prototype.svgStrokeTolerance - 1 :
|
|
|
+ (mxShape.prototype.svgStrokeTolerance + 1) / 2;
|
|
|
+ box.grow(tol);
|
|
|
+
|
|
|
+ // Ignores clicks on cell background to avoid delayed selection on
|
|
|
+ // merged cells when clicking on invisible dividers
|
|
|
+ if (this.isTableCell(state.cell) && !this.isCellSelected(state.cell) &&
|
|
|
+ (!mxUtils.contains(state, me.getGraphX() - tol, me.getGraphY() - tol) ||
|
|
|
+ !mxUtils.contains(state, me.getGraphX() - tol, me.getGraphY() + tol) ||
|
|
|
+ !mxUtils.contains(state, me.getGraphX() + tol, me.getGraphY() + tol) ||
|
|
|
+ !mxUtils.contains(state, me.getGraphX() + tol, me.getGraphY() - tol)))
|
|
|
{
|
|
|
var row = this.model.getParent(state.cell);
|
|
|
var table = this.model.getParent(row);
|
|
|
@@ -382,7 +389,7 @@ Graph = function(container, model, renderHint, stylesheet, themes, standalone)
|
|
|
state.x + g.width * s - 2, state.y, 2, g.height * s)))
|
|
|
{
|
|
|
var wasSelected = this.selectionCellsHandler.isHandled(table);
|
|
|
- this.selectCellForEvent(table, me.getEvent());
|
|
|
+ this.selectCellForEvent(table, me.getEvent());
|
|
|
handler = this.selectionCellsHandler.getHandler(table);
|
|
|
|
|
|
if (handler != null)
|
|
|
@@ -649,8 +656,9 @@ Graph = function(container, model, renderHint, stylesheet, themes, standalone)
|
|
|
}
|
|
|
else if (!mxEvent.isControlDown(me.getEvent()))
|
|
|
{
|
|
|
+ var tol = mxShape.prototype.svgStrokeTolerance / 2;
|
|
|
var box = new mxRectangle(me.getGraphX() - 1, me.getGraphY() - 1);
|
|
|
- box.grow(mxShape.prototype.svgStrokeTolerance / 2);
|
|
|
+ box.grow(tol);
|
|
|
|
|
|
if (this.isTableCell(state.cell))
|
|
|
{
|
|
|
@@ -659,15 +667,15 @@ Graph = function(container, model, renderHint, stylesheet, themes, standalone)
|
|
|
|
|
|
if (!this.isCellSelected(table))
|
|
|
{
|
|
|
- if ((mxUtils.intersects(box, new mxRectangle(state.x - 2, state.y, 2, state.height)) &&
|
|
|
+ if ((mxUtils.intersects(box, new mxRectangle(state.x - 2, state.y, 4, state.height)) &&
|
|
|
this.model.getChildAt(row, 0) != state.cell) || mxUtils.intersects(box,
|
|
|
- new mxRectangle(state.x + state.width - 2, state.y, 2, state.height)))
|
|
|
+ new mxRectangle(state.x + state.width - 2, state.y, 4, state.height)))
|
|
|
{
|
|
|
cursor ='col-resize';
|
|
|
}
|
|
|
- else if ((mxUtils.intersects(box, new mxRectangle(state.x, state.y - 2, state.width, 3)) &&
|
|
|
+ else if ((mxUtils.intersects(box, new mxRectangle(state.x, state.y - 2, state.width, 4)) &&
|
|
|
this.model.getChildAt(table, 0) != row) || mxUtils.intersects(box,
|
|
|
- new mxRectangle(state.x, state.y + state.height - 2, state.width, 3)))
|
|
|
+ new mxRectangle(state.x, state.y + state.height - 2, state.width, 4)))
|
|
|
{
|
|
|
cursor ='row-resize';
|
|
|
}
|
|
|
@@ -5956,7 +5964,7 @@ Graph.prototype.createTable = function(rowCount, colCount, w, h, title, startSiz
|
|
|
tableStyle = (tableStyle != null) ? tableStyle : 'shape=table;startSize=' +
|
|
|
((title != null) ? startSize : '0') + ';container=1;collapsible=0;childLayout=tableLayout;';
|
|
|
rowStyle = (rowStyle != null) ? rowStyle : 'shape=partialRectangle;collapsible=0;dropTarget=0;' +
|
|
|
- 'pointerEvents=0;fillColor=none;top=0;left=0;bottom=0;right=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;';
|
|
|
+ 'fillColor=none;top=0;left=0;bottom=0;right=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;';
|
|
|
cellStyle = (cellStyle != null) ? cellStyle : 'shape=partialRectangle;html=1;whiteSpace=wrap;connectable=0;' +
|
|
|
'overflow=hidden;fillColor=none;top=0;left=0;bottom=0;right=0;pointerEvents=1;';
|
|
|
|
|
|
@@ -6005,17 +6013,16 @@ Graph.prototype.createCrossFunctionalSwimlane = function(rowCount, colCount, w,
|
|
|
{
|
|
|
w = (w != null) ? w : 120;
|
|
|
h = (h != null) ? h : 120;
|
|
|
- var startSize = (title == null) ? 0 : 40;
|
|
|
|
|
|
- var s = 'collapsible=0;recursiveResize=0;expand=0;pointerEvents=0;';
|
|
|
- tableStyle = (tableStyle != null) ? tableStyle : 'shape=table;childLayout=tableLayout;startSize=' + startSize + ';' +
|
|
|
- ((title == null) ? 'fillColor=none;' : '') + s;
|
|
|
-
|
|
|
- rowStyle = (rowStyle != null) ? rowStyle : 'swimlane;horizontal=0;fontStyle=0;points=[[0,0.5],[1,0.5]];' +
|
|
|
- 'fillColor=none;strokeColor=none;portConstraint=eastwest;startSize=' + startSize + ';' + s;
|
|
|
- firstCellStyle = (firstCellStyle != null) ? firstCellStyle : 'swimlane;fontStyle=0;connectable=0;fillColor=none;startSize=40;' + s;
|
|
|
- cellStyle = (cellStyle != null) ? cellStyle : 'swimlane;fontStyle=0;connectable=0;fillColor=none;startSize=' +
|
|
|
- ((title == null) ? '40' : '0') + ';' + s;
|
|
|
+ var s = 'collapsible=0;recursiveResize=0;expand=0;';
|
|
|
+ tableStyle = (tableStyle != null) ? tableStyle : 'shape=table;childLayout=tableLayout;' +
|
|
|
+ ((title == null) ? 'startSize=0;fillColor=none;' : 'startSize=40;') + s;
|
|
|
+ rowStyle = (rowStyle != null) ? rowStyle : 'swimlane;horizontal=0;swimlaneHead=0;swimlaneBody=0;fontStyle=0;' +
|
|
|
+ 'fillColor=none;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;startSize=40;' + s;
|
|
|
+ firstCellStyle = (firstCellStyle != null) ? firstCellStyle : 'swimlane;swimlaneHead=0;swimlaneBody=0;fontStyle=0;' +
|
|
|
+ 'connectable=0;fillColor=none;startSize=40;' + s;
|
|
|
+ cellStyle = (cellStyle != null) ? cellStyle : 'swimlane;swimlaneHead=0;swimlaneBody=0;fontStyle=0;connectable=0;' +
|
|
|
+ 'fillColor=none;startSize=0;' + s;
|
|
|
|
|
|
var table = this.createVertex(null, null, (title != null) ? title : '', 0, 0,
|
|
|
colCount * w, rowCount * h, tableStyle);
|
|
|
@@ -6055,6 +6062,7 @@ Graph.prototype.visitTableCells = function(cell, visitor)
|
|
|
{
|
|
|
var rowStart = this.getActualStartSize(rows[i], true);
|
|
|
var cols = this.model.getChildCells(rows[i], true);
|
|
|
+ var rowStyle = this.getCellStyle(rows[i], true);
|
|
|
var lastCol = null;
|
|
|
var row = [];
|
|
|
|
|
|
@@ -6093,7 +6101,13 @@ Graph.prototype.visitTableCells = function(cell, visitor)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- visitor(col, cols.length, rows.length, start.x + rowStart.x, start.y + rowStart.y);
|
|
|
+ var head = mxUtils.getValue(rowStyle, mxConstants.STYLE_SWIMLANE_HEAD, 1) == 1 &&
|
|
|
+ mxUtils.getValue(rowStyle, mxConstants.STYLE_STROKECOLOR,
|
|
|
+ mxConstants.NONE) != mxConstants.NONE;
|
|
|
+
|
|
|
+ visitor(col, cols.length, rows.length,
|
|
|
+ start.x + ((head) ? rowStart.x : 0),
|
|
|
+ start.y + ((head) ? rowStart.y : 0));
|
|
|
row.push(col);
|
|
|
lastCol = col;
|
|
|
}
|
|
|
@@ -7849,20 +7863,21 @@ if (typeof mxVertexHandler != 'undefined')
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
- * Overridden to check for table shape.
|
|
|
+ * Overridden to use table cell instead of table as parent.
|
|
|
*/
|
|
|
Graph.prototype.isSwimlane = function(cell, ignoreState)
|
|
|
{
|
|
|
- if (cell != null && this.model.getParent(cell) != this.model.getRoot() &&
|
|
|
- !this.model.isEdge(cell))
|
|
|
+ var shape = null;
|
|
|
+
|
|
|
+ if (cell != null && !this.model.isEdge(cell) &&
|
|
|
+ this.model.getParent(cell) !=
|
|
|
+ this.model.getRoot())
|
|
|
{
|
|
|
- var shape = this.getCurrentCellStyle(cell, ignoreState)
|
|
|
- [mxConstants.STYLE_SHAPE];
|
|
|
-
|
|
|
- return shape == mxConstants.SHAPE_SWIMLANE || shape == 'table';
|
|
|
+ var style = this.getCurrentCellStyle(cell, ignoreState)
|
|
|
+ shape = style[mxConstants.STYLE_SHAPE];
|
|
|
}
|
|
|
|
|
|
- return false;
|
|
|
+ return shape == mxConstants.SHAPE_SWIMLANE || shape == 'table';
|
|
|
};
|
|
|
|
|
|
/**
|