|
|
@@ -2565,9 +2565,10 @@ var WrapperWindow = function(editorUi, title, x, y, w, h, fn)
|
|
|
};
|
|
|
|
|
|
// Updates the CSS of the background to draw the grid
|
|
|
- mxGraphView.prototype.validateBackgroundStyles = function()
|
|
|
+ mxGraphView.prototype.validateBackgroundStyles = function(factor, cx, cy)
|
|
|
{
|
|
|
var graph = this.graph;
|
|
|
+ factor = (factor != null) ? factor : 1;
|
|
|
var color = (graph.background == null || graph.background == mxConstants.NONE) ?
|
|
|
graph.defaultPageBackgroundColor : graph.background;
|
|
|
var gridColor = (color != null && this.gridColor != color.toLowerCase()) ? this.gridColor : '#ffffff';
|
|
|
@@ -2581,10 +2582,10 @@ var WrapperWindow = function(editorUi, title, x, y, w, h, fn)
|
|
|
if (mxClient.IS_SVG)
|
|
|
{
|
|
|
// Generates the SVG required for drawing the dynamic grid
|
|
|
- image = unescape(encodeURIComponent(this.createSvgGrid(gridColor)));
|
|
|
+ image = unescape(encodeURIComponent(this.createSvgGrid(gridColor, factor)));
|
|
|
image = (window.btoa) ? btoa(image) : Base64.encode(image, true);
|
|
|
image = 'url(' + 'data:image/svg+xml;base64,' + image + ')'
|
|
|
- phase = graph.gridSize * this.scale * this.gridSteps;
|
|
|
+ phase = graph.gridSize * this.scale * this.gridSteps * factor;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -2594,6 +2595,13 @@ var WrapperWindow = function(editorUi, title, x, y, w, h, fn)
|
|
|
|
|
|
var x0 = 0;
|
|
|
var y0 = 0;
|
|
|
+
|
|
|
+ var dx = (cx != null) ? cx - this.translate.x * this.scale : 0;
|
|
|
+ var dy = (cy != null) ? cy - this.translate.y * this.scale : 0;
|
|
|
+
|
|
|
+ var p = graph.gridSize * this.scale * this.gridSteps;
|
|
|
+ var ddx = dx % p;
|
|
|
+ var ddy = dy % p;
|
|
|
|
|
|
if (graph.view.backgroundPageShape != null)
|
|
|
{
|
|
|
@@ -2604,8 +2612,8 @@ var WrapperWindow = function(editorUi, title, x, y, w, h, fn)
|
|
|
}
|
|
|
|
|
|
// Computes the offset to maintain origin for grid
|
|
|
- position = -Math.round(phase - mxUtils.mod(this.translate.x * this.scale - x0, phase)) + 'px ' +
|
|
|
- -Math.round(phase - mxUtils.mod(this.translate.y * this.scale - y0, phase)) + 'px';
|
|
|
+ position = -Math.round(phase - mxUtils.mod(this.translate.x * this.scale - x0 + dx, phase) + ddx * factor) + 'px ' +
|
|
|
+ -Math.round(phase - mxUtils.mod(this.translate.y * this.scale - y0 + dy, phase) + ddy * factor) + 'px';
|
|
|
}
|
|
|
|
|
|
var canvas = graph.view.canvas;
|
|
|
@@ -2656,9 +2664,10 @@ var WrapperWindow = function(editorUi, title, x, y, w, h, fn)
|
|
|
};
|
|
|
|
|
|
// Returns the SVG required for painting the background grid.
|
|
|
- mxGraphView.prototype.createSvgGrid = function(color)
|
|
|
+ mxGraphView.prototype.createSvgGrid = function(color, factor)
|
|
|
{
|
|
|
- var tmp = this.graph.gridSize * this.scale;
|
|
|
+ factor = (factor != null) ? factor : 1;
|
|
|
+ var tmp = this.graph.gridSize * this.scale * factor;
|
|
|
|
|
|
while (tmp < this.minGridSize)
|
|
|
{
|