Skip to content

Commit

Permalink
Release v3.7.3 (#2233)
Browse files Browse the repository at this point in the history
  • Loading branch information
zbynekstara authored Jun 22, 2023
1 parent ddc5345 commit 4c27eb9
Show file tree
Hide file tree
Showing 37 changed files with 239 additions and 141 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
22-06-2023 (v3.7.3)

* demo.Isometric - add new demo as example of isometric projection
* dia.Cell - add `foregroundEmbeds` option to `toFront()` and `toBack()` methods
* dia.Cell - fix the depth-first algorithm in `getEmbeddedCells()` method

16-05-2023 (v3.7.2)

* demo - add DWDM (Dense wavelength-division multiplexing) example
Expand Down
2 changes: 1 addition & 1 deletion dist/geometry.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! JointJS v3.7.2 (2023-05-16) - JavaScript diagramming library
/*! JointJS v3.7.3 (2023-06-22) - JavaScript diagramming library
This Source Code Form is subject to the terms of the Mozilla Public
Expand Down
2 changes: 1 addition & 1 deletion dist/geometry.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/joint.core.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

97 changes: 63 additions & 34 deletions dist/joint.core.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! JointJS v3.7.2 (2023-05-16) - JavaScript diagramming library
/*! JointJS v3.7.3 (2023-06-22) - JavaScript diagramming library


This Source Code Form is subject to the terms of the Mozilla Public
Expand Down Expand Up @@ -15862,24 +15862,24 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
toFront: function(opt) {
var graph = this.graph;
if (graph) {
opt = opt || {};
opt = defaults(opt || {}, { foregroundEmbeds: true });

var cells;
if (opt.deep) {
cells = this.getEmbeddedCells({ deep: true, breadthFirst: opt.breadthFirst !== false });
cells = this.getEmbeddedCells({ deep: true, breadthFirst: opt.breadthFirst !== false, sortSiblings: opt.foregroundEmbeds });
cells.unshift(this);
} else {
cells = [this];
}

var sortedCells = sortBy(cells, function (cell) { return cell.z(); });
var sortedCells = opt.foregroundEmbeds ? cells : sortBy(cells, function (cell) { return cell.z(); });

var maxZ = graph.maxZIndex();
var z = maxZ - cells.length + 1;

var collection = graph.get('cells');

var shouldUpdate = (collection.indexOf(this) !== (collection.length - cells.length));
var shouldUpdate = (collection.indexOf(sortedCells[0]) !== (collection.length - cells.length));
if (!shouldUpdate) {
shouldUpdate = sortedCells.some(function(cell, index) {
return cell.z() !== z + index;
Expand All @@ -15905,23 +15905,23 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
toBack: function(opt) {
var graph = this.graph;
if (graph) {
opt = opt || {};
opt = defaults(opt || {}, { foregroundEmbeds: true });

var cells;
if (opt.deep) {
cells = this.getEmbeddedCells({ deep: true, breadthFirst: opt.breadthFirst !== false });
cells = this.getEmbeddedCells({ deep: true, breadthFirst: opt.breadthFirst !== false, sortSiblings: opt.foregroundEmbeds });
cells.unshift(this);
} else {
cells = [this];
}

var sortedCells = sortBy(cells, function (cell) { return cell.z(); });
var sortedCells = opt.foregroundEmbeds ? cells : sortBy(cells, function (cell) { return cell.z(); });

var z = graph.minZIndex();

var collection = graph.get('cells');

var shouldUpdate = (collection.indexOf(this) !== 0);
var shouldUpdate = (collection.indexOf(sortedCells[0]) !== 0);
if (!shouldUpdate) {
shouldUpdate = sortedCells.some(function(cell, index) {
return cell.z() !== z + index;
Expand Down Expand Up @@ -16039,42 +16039,71 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
// There is no way this element knows about other cells otherwise.
// This also means that calling e.g. `translate()` on an element with embeds before
// adding it to a graph does not translate its embeds.
if (this.graph) {
if (!this.graph) {
return [];
}

var cells;
if (opt.deep) {
if (opt.breadthFirst) {
return this._getEmbeddedCellsBfs(opt.sortSiblings);
} else {
return this._getEmbeddedCellsDfs(opt.sortSiblings);
}
}

if (opt.deep) {
var embeddedIds = this.get('embeds');
if (isEmpty(embeddedIds)) {
return [];
}

if (opt.breadthFirst) {
var cells = embeddedIds.map(this.graph.getCell, this.graph);
if (opt.sortSiblings) {
cells = sortBy(cells, function (cell) { return cell.z(); });
}

// breadthFirst algorithm
cells = [];
var queue = this.getEmbeddedCells();
return cells;
},

while (queue.length > 0) {
_getEmbeddedCellsBfs: function(sortSiblings) {
var cells = [];

var parent = queue.shift();
cells.push(parent);
queue.push.apply(queue, parent.getEmbeddedCells());
}
var queue = [];
queue.push(this);

} else {
while (queue.length > 0) {
var current = queue.shift();
cells.push(current);

// depthFirst algorithm
cells = this.getEmbeddedCells();
cells.forEach(function(cell) {
cells.push.apply(cells, cell.getEmbeddedCells(opt));
});
}
var embeddedCells = current.getEmbeddedCells({ sortSiblings: sortSiblings });

} else {
queue.push.apply(queue, embeddedCells);
}
cells.shift();

cells = toArray(this.get('embeds')).map(this.graph.getCell, this.graph);
}
return cells;
},

_getEmbeddedCellsDfs: function(sortSiblings) {
var cells = [];

var stack = [];
stack.push(this);

while (stack.length > 0) {
var current = stack.pop();
cells.push(current);

return cells;
var embeddedCells = current.getEmbeddedCells({ sortSiblings: sortSiblings });

// When using the stack, cells that are embedded last are processed first.
// To maintain the original order, we need to push the cells in reverse order
for (var i = embeddedCells.length - 1; i >= 0; --i) {
stack.push(embeddedCells[i]);
}
}
return [];
cells.shift();

return cells;
},

isEmbeddedIn: function(cell, opt) {
Expand Down Expand Up @@ -36670,7 +36699,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
Control: Control
});

var version = "3.7.2";
var version = "3.7.3";

var Vectorizer = V;
var layout = { PortLabel: PortLabel, Port: Port };
Expand Down
2 changes: 1 addition & 1 deletion dist/joint.core.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/joint.core.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/joint.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions dist/joint.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! JointJS v3.7.2 (2023-05-16) - JavaScript diagramming library
/*! JointJS v3.7.3 (2023-06-22) - JavaScript diagramming library
This Source Code Form is subject to the terms of the Mozilla Public
Expand Down Expand Up @@ -1468,6 +1468,11 @@ export namespace dia {

interface GetEmbeddedCellsOptions extends EmbeddableOptions {
breadthFirst?: boolean;
sortSiblings?: boolean;
}

interface ToFrontAndBackOptions extends GetEmbeddedCellsOptions {
foregroundEmbeds?: boolean;
}

interface TransitionOptions extends Options {
Expand Down Expand Up @@ -1496,9 +1501,9 @@ export namespace dia {

remove(opt?: Cell.DisconnectableOptions): this;

toFront(opt?: Cell.GetEmbeddedCellsOptions): this;
toFront(opt?: Cell.ToFrontAndBackOptions): this;

toBack(opt?: Cell.GetEmbeddedCellsOptions): this;
toBack(opt?: Cell.ToFrontAndBackOptions): this;

parent(): string;
parent(parentId: Cell.ID): this;
Expand Down
Loading

0 comments on commit 4c27eb9

Please sign in to comment.