Skip to content

Commit

Permalink
22.0.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
davidjgraph committed Sep 28, 2023
1 parent dd9027c commit 8906f90
Show file tree
Hide file tree
Showing 211 changed files with 90,986 additions and 2,513 deletions.
9 changes: 9 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
28-SEP-2023: 22.0.0

- Adds DRAWIO_SERVER_URL as an additional URL to DRAWIO_BASE_URL. BASE_URL used to indicate
the URL both the back-end and static code were delivered on. SERVER_URL now provides a
way to delivery on one URL and server the back-end functions on a different URL.
By default the server URL value is blank.
- Fixes search for uncompressed shapes, result order
- Fixes dialog stack order [drawio-3883]

24-SEP-2023: 21.8.2

- Confirm escape key for insert layout [drawio-3880]
Expand Down
10 changes: 3 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ As well as running this project, we run a production-grade deployment of the dia
License
-----------------

The source code authored by us in this repo is licensed under the Apache v2, however, we do not claim to be an open source project.
The source code authored by us in this repo is licensed under the Apache v2. The full core is open source, but the are some boundary functions that are difficult to publish in a way we can maintain them.

The JGraph provided icons and diagram templates are licensed under the [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/). Additional terms may also apply where the icons are originally defined by a third-party copyright holder. We have checked in all cases that the original license allows use in this project. Also see the terms for using the draw.io logo below.

Expand Down Expand Up @@ -40,17 +40,13 @@ Supported Browsers

draw.io supports Chrome 70+, Firefox 70+, Safari 11+, Opera 50+, Native Android browser 7x+, the default browser in the current and previous major iOS versions (e.g. 11.2.x and 10.3.x) and Edge 79+.

This project is not open-source, nor open-contribution
This project is not open-contribution
------------------------------------------------------

draw.io is not open source software. The complete source code required to build the app from scratch is not available. The Apache license allows you to deploy the project and make changes to the source code that is available on the site.

We do not make full human readable sources available to avoid a position where another commercial product affects our revenues.
draw.io is also closed to contributions. We follow a development process compliant with our SOC 2 Type II process. We do not have a mechanism where we can accept contributions from non-staff members.

draw.io is not suitable as a framework for building other products from. For this try either [Tldraw](https://github.com/tldraw/tldraw) or [Excalidraw](https://github.com/excalidraw/excalidraw).

draw.io is also closed to contributions. We follow a development process compliant with our SOC 2 Type II process. We do not have a mechanism where we can accept contributions from non-staff members.

Logo and trademark usage
------------------------

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
21.8.2
22.0.0
296 changes: 296 additions & 0 deletions src/main/mxgraph/handler/mxCellHighlight.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,296 @@
/**
* Copyright (c) 2006-2015, JGraph Ltd
* Copyright (c) 2006-2015, Gaudenz Alder
*/
/**
* Class: mxCellHighlight
*
* A helper class to highlight cells. Here is an example for a given cell.
*
* (code)
* var highlight = new mxCellHighlight(graph, '#ff0000', 2);
* highlight.highlight(graph.view.getState(cell)));
* (end)
*
* Constructor: mxCellHighlight
*
* Constructs a cell highlight.
*/
function mxCellHighlight(graph, highlightColor, strokeWidth, dashed)
{
if (graph != null)
{
this.graph = graph;
this.highlightColor = (highlightColor != null) ? highlightColor : mxConstants.DEFAULT_VALID_COLOR;
this.strokeWidth = (strokeWidth != null) ? strokeWidth : mxConstants.HIGHLIGHT_STROKEWIDTH;
this.dashed = (dashed != null) ? dashed : false;
this.opacity = mxConstants.HIGHLIGHT_OPACITY;

// Updates the marker if the graph changes
this.repaintHandler = mxUtils.bind(this, function()
{
// Updates reference to state
if (this.state != null)
{
var tmp = this.graph.view.getState(this.state.cell);

if (tmp == null)
{
this.hide();
}
else
{
this.state = tmp;
this.repaint();
}
}
});

this.graph.getView().addListener(mxEvent.SCALE, this.repaintHandler);
this.graph.getView().addListener(mxEvent.TRANSLATE, this.repaintHandler);
this.graph.getView().addListener(mxEvent.SCALE_AND_TRANSLATE, this.repaintHandler);
this.graph.getModel().addListener(mxEvent.CHANGE, this.repaintHandler);

// Hides the marker if the current root changes
this.resetHandler = mxUtils.bind(this, function()
{
this.hide();
});

this.graph.getView().addListener(mxEvent.DOWN, this.resetHandler);
this.graph.getView().addListener(mxEvent.UP, this.resetHandler);
}
};

/**
* Variable: keepOnTop
*
* Specifies if the highlights should appear on top of everything
* else in the overlay pane. Default is false.
*/
mxCellHighlight.prototype.keepOnTop = false;

/**
* Variable: graph
*
* Reference to the enclosing <mxGraph>.
*/
mxCellHighlight.prototype.graph = null;

/**
* Variable: state
*
* Reference to the <mxCellState>.
*/
mxCellHighlight.prototype.state = null;

/**
* Variable: spacing
*
* Specifies the spacing between the highlight for vertices and the vertex.
* Default is 2.
*/
mxCellHighlight.prototype.spacing = 2;

/**
* Variable: resetHandler
*
* Holds the handler that automatically invokes reset if the highlight
* should be hidden.
*/
mxCellHighlight.prototype.resetHandler = null;

/**
* Function: setHighlightColor
*
* Sets the color of the rectangle used to highlight drop targets.
*
* Parameters:
*
* color - String that represents the new highlight color.
*/
mxCellHighlight.prototype.setHighlightColor = function(color)
{
this.highlightColor = color;

if (this.shape != null)
{
this.shape.stroke = color;
}
};

/**
* Function: drawHighlight
*
* Creates and returns the highlight shape for the given state.
*/
mxCellHighlight.prototype.drawHighlight = function()
{
this.shape = this.createShape();
this.repaint();

if (!this.keepOnTop && this.shape.node.parentNode.firstChild != this.shape.node)
{
this.shape.node.parentNode.insertBefore(this.shape.node, this.shape.node.parentNode.firstChild);
}
};

/**
* Function: createShape
*
* Creates and returns the highlight shape for the given state.
*/
mxCellHighlight.prototype.createShape = function()
{
var shape = this.graph.cellRenderer.createShape(this.state);

shape.svgStrokeTolerance = this.graph.tolerance;
shape.points = this.state.absolutePoints;
shape.apply(this.state);
shape.stroke = this.highlightColor;
shape.opacity = this.opacity;
shape.isDashed = this.dashed;
shape.isShadow = false;

shape.dialect = mxConstants.DIALECT_SVG;
shape.init(this.graph.getView().getOverlayPane());
mxEvent.redirectMouseEvents(shape.node, this.graph, this.state);

if (this.graph.dialect != mxConstants.DIALECT_SVG)
{
shape.pointerEvents = false;
}
else
{
shape.svgPointerEvents = 'stroke';
}

return shape;
};

/**
* Function: getStrokeWidth
*
* Returns the stroke width.
*/
mxCellHighlight.prototype.getStrokeWidth = function(state)
{
return this.strokeWidth;
};

/**
* Function: repaint
*
* Updates the highlight after a change of the model or view.
*/
mxCellHighlight.prototype.repaint = function()
{
if (this.state != null && this.shape != null)
{
this.shape.scale = this.state.view.scale;

if (this.graph.model.isEdge(this.state.cell))
{
this.shape.strokewidth = this.getStrokeWidth();
this.shape.points = this.state.absolutePoints;
this.shape.outline = false;
}
else
{
this.shape.bounds = new mxRectangle(this.state.x - this.spacing, this.state.y - this.spacing,
this.state.width + 2 * this.spacing, this.state.height + 2 * this.spacing);
this.shape.rotation = Number(this.state.style[mxConstants.STYLE_ROTATION] || '0');
this.shape.strokewidth = this.getStrokeWidth() / this.state.view.scale;
this.shape.outline = true;
}

// Uses cursor from shape in highlight
if (this.state.shape != null)
{
this.shape.setCursor(this.state.shape.getCursor());
}

this.shape.redraw();
}
};

/**
* Function: hide
*
* Resets the state of the cell marker.
*/
mxCellHighlight.prototype.hide = function()
{
this.highlight(null);
};

/**
* Function: mark
*
* Marks the <markedState> and fires a <mark> event.
*/
mxCellHighlight.prototype.highlight = function(state)
{
if (this.state != state)
{
if (this.shape != null)
{
this.shape.destroy();
this.shape = null;
}

this.state = state;

if (this.state != null)
{
this.drawHighlight();
}
}
};

/**
* Function: isHighlightAt
*
* Returns true if this highlight is at the given position.
*/
mxCellHighlight.prototype.isHighlightAt = function(x, y)
{
var hit = false;

// Quirks mode is currently not supported as it used a different coordinate system
if (this.shape != null && document.elementFromPoint != null)
{
var elt = document.elementFromPoint(x, y);

while (elt != null)
{
if (elt == this.shape.node)
{
hit = true;
break;
}

elt = elt.parentNode;
}
}

return hit;
};

/**
* Function: destroy
*
* Destroys the handler and all its resources and DOM nodes.
*/
mxCellHighlight.prototype.destroy = function()
{
this.graph.getView().removeListener(this.resetHandler);
this.graph.getView().removeListener(this.repaintHandler);
this.graph.getModel().removeListener(this.repaintHandler);

if (this.shape != null)
{
this.shape.destroy();
this.shape = null;
}
};
Loading

0 comments on commit 8906f90

Please sign in to comment.