Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: [POC] Replace mxGraph with maxGraph 0.1.0 #2366

Closed
wants to merge 132 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
132 commits
Select commit Hold shift + click to select a range
b348567
Uninstall mxgraph
csouchet Nov 23, 2022
e408d8b
Install @maxgraph/core
csouchet Nov 23, 2022
8a27379
Remove @typed-mxgraph/typed-mxgraph
csouchet Nov 23, 2022
cf23662
Remove initializer file
csouchet Nov 23, 2022
cfc224a
Update comment
csouchet Nov 23, 2022
a973656
Replace graph.mxClient by Client
csouchet Nov 23, 2022
aed47ef
Replace mxMouseEvent by InternalMouseEvent
csouchet Nov 23, 2022
e22eb7a
Replace mxgraph.mxEvent by eventUtils
csouchet Nov 23, 2022
78dce88
- Replace mxCell by Cell
csouchet Nov 23, 2022
2fe67e2
Replace mxPoint by Point
csouchet Nov 23, 2022
c3d25d8
Replace mxShape by Shape
csouchet Nov 23, 2022
0d087c6
Replace mxAbstractCanvas2D by AbstractCanvas2D
csouchet Nov 23, 2022
817c114
Replace mxRectangleShape by RectangleShape
csouchet Nov 23, 2022
540adbd
Replace mxRectangle by Rectangle
csouchet Nov 23, 2022
9670fb3
Replace mxImageShape by ImageShape
csouchet Nov 23, 2022
80b3c99
Replace mxDictionary by Dictionary
csouchet Nov 24, 2022
da761e8
- Replace mxSvgCanvas2D by SvgCanvas2D
csouchet Nov 24, 2022
9318fe4
Replace mxGraphView by GraphView
csouchet Nov 23, 2022
f3720ee
Replace mxImageExport by ImageExport
csouchet Nov 23, 2022
3fd2755
Replace mxEllipse by EllipseShape
csouchet Nov 23, 2022
d345f8a
Replace mxRhombus by RhombusShape
csouchet Nov 23, 2022
e497f2a
Replace mxText by TextShape
csouchet Nov 23, 2022
432fe97
Replace mxMarker by MarkerShape
csouchet Nov 23, 2022
0917c5f
Replace mxConnector by ConnectorShape
csouchet Nov 23, 2022
be478dd
Replace mxUtils by utils
csouchet Nov 23, 2022
80177d0
Replace mxGraph by Graph
csouchet Nov 23, 2022
3564c3e
Replace mxEvent.addMouseWheelListener by InternalEvent.addMouseWheelL…
csouchet Nov 23, 2022
529a538
Replace mxEvent.consume by InternalEvent.consume
csouchet Nov 23, 2022
ab7020d
Replace mxStylesheet by Stylesheet
csouchet Nov 23, 2022
7b1d761
Rename MxGraphCustomOverlay in MaxGraphCustomOverlay
csouchet Nov 23, 2022
980f906
Fix some types on test utils
csouchet Nov 23, 2022
9c47cce
Replace mxGraphDataModel.filterDescendants((cell: mxCell) => boolean,…
csouchet Nov 24, 2022
fcbcd3d
Replace mxGeometry by Geometry
csouchet Nov 24, 2022
0e5e8e2
Replace mxGraph.getModel() by graph.model
csouchet Nov 24, 2022
b52ad44
Replace mxGraphDataModel.getGeometry(cell: mxCell) by Cell.getGeometry()
csouchet Nov 24, 2022
a7377f8
Replace mxGraphDataModel.isEdge(cell: mxCell) by Cell.isEdge()
csouchet Nov 24, 2022
50353f9
Replace mxGraphDataModel.getParent(cell: mxCell) by Cell.getParent()
csouchet Nov 24, 2022
01c44f3
Replace mxgraph.mxConstants by constants
csouchet Nov 24, 2022
58ea481
Replace mxStyleMap by CellStateStyle
csouchet Nov 24, 2022
b0430b9
Replace mxConstants by constants
csouchet Nov 24, 2022
1e78a74
Change the way to compute the style
csouchet Nov 25, 2022
78a5406
- Replace mxPerimeter.RhombusPerimeter by Perimeter.RhombusPerimeter
csouchet Nov 25, 2022
cf6b80f
Remove StyleUtils
csouchet Nov 25, 2022
7a15f73
Lint
csouchet Nov 25, 2022
9d668f2
TMP disable the GH workflow running the e2e tests
tbouffard Dec 1, 2022
d52a9c2
Remove unused StyleUtils import (StyleUtils was removed earlier)
tbouffard Dec 1, 2022
1390ae1
Use right imports for PAN event
tbouffard Dec 1, 2022
88bdefc
Fix types
tbouffard Dec 1, 2022
5ecc585
Fix usage of constants.ALIGN
tbouffard Dec 1, 2022
6d35abb
Partially fix SvgExporter (some types are wrong)
tbouffard Dec 1, 2022
7f34578
TMP disable the GH workflow running the e2e tests (fix condition)
tbouffard Dec 1, 2022
3346478
Fix call to panningHandler
tbouffard Dec 1, 2022
cc948ce
BpmnGraph: fix createMouseWheelZoomListener
tbouffard Dec 1, 2022
79ed1cf
WIP: fix mxconstants call use values of types instead
tbouffard Dec 1, 2022
b837f76
fix maxGraph constants "ambient const enums"
tbouffard Dec 1, 2022
68caecd
BpmnGraph: update declaration of methods overriding Graph to match ma…
tbouffard Dec 1, 2022
ec11f1c
integration test: restore maxGraph-config.ts
tbouffard Dec 1, 2022
36db19b
lint
tbouffard Dec 1, 2022
93487f1
TMP ts-ignore for CellRenderer.registerShape
tbouffard Dec 1, 2022
c6bf02f
style-utils.test.ts: adapt inputs
tbouffard Dec 1, 2022
2aed67a
WIP: styles
tbouffard Dec 1, 2022
54de0c8
WIP: styles
tbouffard Dec 1, 2022
eb044f2
WIP: styles test
tbouffard Dec 1, 2022
6cff2a3
WIP: styles fix execution errors
tbouffard Dec 1, 2022
e8bd609
WIP: fix styles to display icon and labels
tbouffard Dec 1, 2022
7e947f8
WIP: add console info to debug 'strokeColor' set to 'none'
tbouffard Dec 1, 2022
19250c8
fix tests in style-utils.ts computeAllBpmnClassNames
tbouffard Dec 1, 2022
e004ae7
Add TODO about BPMNCellStyle
tbouffard Dec 1, 2022
b98134c
Fix the demo build (remove ref to mxgraph in the vite config)
tbouffard Dec 2, 2022
db88858
wip fix StyleComputer.test.ts
tbouffard Dec 2, 2022
5fd3ccd
wip fix StyleComputer.test.ts
tbouffard Dec 2, 2022
2121967
update FIXME
tbouffard Dec 2, 2022
b7becce
wip fix StyleComputer.test.ts
tbouffard Dec 2, 2022
4e5501d
wip fix StyleComputer.test.ts
tbouffard Dec 2, 2022
0ea263d
wip fix StyleComputer.test.ts
tbouffard Dec 2, 2022
5231127
update FIXME
tbouffard Dec 2, 2022
614be6f
StyleComputer: add TODO
tbouffard Dec 2, 2022
37fa21d
wip fix StyleComputer.test.ts
tbouffard Dec 2, 2022
c6aec3c
wip fix StyleComputer.test.ts - pool/lane horizontal
tbouffard Dec 2, 2022
8be028a
event-shapes.ts: fix how we manage isInterrupting (it can be 'undefin…
tbouffard Dec 2, 2022
3e59ff6
demo theme: use property to set style
tbouffard Dec 2, 2022
679a9bf
wip fix StyleComputer.test.ts - pool/lane horizontal
tbouffard Dec 2, 2022
9253df4
wip fix StyleComputer.test.ts - pool/lane horizontal
tbouffard Dec 2, 2022
674bc96
wip fix StyleComputer.test.ts
tbouffard Dec 2, 2022
aba824d
wip fix StyleComputer.test.ts
tbouffard Dec 3, 2022
230553c
wip fix StyleComputer.test.ts
tbouffard Dec 3, 2022
f597460
wip StyleComputer.test.ts - add missing types in signatures
tbouffard Dec 3, 2022
785eb50
wip fix StyleComputer.test.ts
tbouffard Dec 3, 2022
a47b3e2
wip fix StyleComputer.test.ts
tbouffard Dec 3, 2022
18b0a95
wip fix StyleComputer.test.ts
tbouffard Dec 3, 2022
00d43a6
wip fix StyleComputer.test.ts
tbouffard Dec 3, 2022
239710f
wip fix StyleComputer.test.ts
tbouffard Dec 3, 2022
47f7252
wip fix StyleComputer.test.ts
tbouffard Dec 3, 2022
46e217c
wip fix StyleComputer.test.ts
tbouffard Dec 3, 2022
52c396f
wip fix style-utils.test.ts
tbouffard Dec 3, 2022
0481c5c
wip fix style-utils.test.ts
tbouffard Dec 3, 2022
8374b01
integration test: fix types errors
tbouffard Dec 3, 2022
cb99e40
StyleConfigurator: fix typo in TODO
tbouffard Dec 3, 2022
67f329a
integration test: fix types errors
tbouffard Dec 3, 2022
d3d9960
integration test: fix types errors
tbouffard Dec 3, 2022
fd5c047
integration test: make dom.css.classes.test.ts test pass
tbouffard Dec 3, 2022
53c7fbe
integration test: make dom.overlays.test.ts pass
tbouffard Dec 3, 2022
cced7fd
integration test: make BpmnVisualization.test.ts pass
tbouffard Dec 3, 2022
3a373a0
remove console.info
tbouffard Dec 5, 2022
a264214
fix lint warnings
tbouffard Dec 5, 2022
a6347c6
StyleComputer.ts: TODO about isNonInitiating (logic, need)
tbouffard Dec 6, 2022
d282c5a
StyleComputer.ts lane/pool orientation: no issue with maxGraph, the i…
tbouffard Dec 6, 2022
eb951f7
edge shapes: prevent from accessing properties of undefined object
tbouffard Dec 6, 2022
77ab028
EXTRA [email protected] fix: style computation is buggy (missing element…
tbouffard Dec 6, 2022
d7439e2
EXTRA IT: explain the 'isHorizontal' mxGraph/maxGraph semantic in mod…
tbouffard Dec 6, 2022
e6b3dff
WIP model integration tests: adapt for maxGraph
tbouffard Dec 6, 2022
fda5072
WIP model integration tests: adapt for maxGraph - filter descendants …
tbouffard Dec 6, 2022
9868946
WIP model integration tests: adapt for maxGraph - pool (check parentId)
tbouffard Dec 6, 2022
66e5168
EXTRA: workaround to fix overlays position (bug in [email protected])
tbouffard Dec 6, 2022
2f4577b
fix remaining failing integration tests
tbouffard Dec 7, 2022
de48d9d
IT model elements: remove extra added property to check (useless as i…
tbouffard Dec 9, 2022
f12e7a6
docs: revert "remove mxGraph reference in the documentation"
tbouffard Jun 4, 2023
9960731
Revert "Update comment" - restore mxGraph in comments
tbouffard Jun 4, 2023
5a27312
restore the "BpmnStyleIdentifier" to reduce the number of changes in …
tbouffard Jun 4, 2023
29bff4a
StyleComputer: remove extra mxGraph to maxGraph change in comments
tbouffard Jun 4, 2023
7490fa9
Revert "Rename MxGraphCustomOverlay in MaxGraphCustomOverlay"
tbouffard Jun 4, 2023
603fdf1
test: restore the filename of the mxgraph config
tbouffard Jun 4, 2023
29bb2f0
test: remove ref to maxGraph in a comment
tbouffard Jun 4, 2023
ca24bc4
Revert variable rename in GraphCellUpdater.ts (mxCell to cell)
tbouffard Jun 4, 2023
46fde05
Revert comment update in GraphConfigurator.ts (mxCell to cell)
tbouffard Jun 4, 2023
59e2e49
Revert comment update in ShapeConfigurator.ts (mxShape to Shape)
tbouffard Jun 4, 2023
901bb51
Revert comment update in custom-overlay.ts
tbouffard Jun 4, 2023
c2e45ca
Revert comment update in CoordinatesTranslator.ts
tbouffard Jun 4, 2023
ed7373e
Revert comment update in query-selectors.ts
tbouffard Jun 4, 2023
e322f0d
Revert comment update in style-utils.ts
tbouffard Jun 4, 2023
0610b33
Revert comment update in icon-painter.ts
tbouffard Jun 4, 2023
a70e355
BpmnConnector: todo about future integration in maxGraph
tbouffard Jun 7, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/test-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ on:
jobs:
test_e2e:
runs-on: ${{ matrix.os }}
if: github.event_name == 'NOT_SUPPORTED' # TEMP disable e2e until the code compile and the JS doesn't generate runtime errors that block the dev server
strategy:
# we want to run the full build on all os: don't cancel running jobs even if one fails
fail-fast: false
Expand Down
70 changes: 38 additions & 32 deletions dev/ts/component/SvgExporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

import { mxgraph } from '../../../src/component/mxgraph/initializer';
import type { mxGraph, mxSvgCanvas2D } from 'mxgraph';
import type { Graph, AlignValue, VAlignValue, OverflowValue, TextDirectionValue } from '@maxgraph/core';
import { Client, SvgCanvas2D, ImageExport, constants, xmlUtils, domUtils, stringUtils } from '@maxgraph/core';

interface SvgExportOptions {
scale: number;
Expand All @@ -30,7 +30,7 @@ interface SvgExportOptions {
// https://github.com/jgraph/drawio/blob/v14.7.7/src/main/webapp/js/diagramly/Editor.js#L5932
// https://github.com/jgraph/drawio/blob/v14.8.0/src/main/webapp/js/grapheditor/Graph.js#L9007
export class SvgExporter {
constructor(private graph: mxGraph) {}
constructor(private graph: Graph) {}

exportSvg(): string {
return this.doSvgExport(true);
Expand All @@ -40,13 +40,16 @@ export class SvgExporter {
// chrome and webkit: tainted canvas when svg contains foreignObject
// also on brave --> probably fail on chromium based browsers
// so disable foreign objects for such browsers
const isFirefox = mxgraph.mxClient.IS_FF;
const isFirefox = Client.IS_FF;
return this.doSvgExport(isFirefox);
}

private doSvgExport(enableForeignObjectForLabel: boolean): string {
const svgDocument = this.computeSvg({ scale: 1, border: 25, enableForeignObjectForLabel: enableForeignObjectForLabel });
const svgAsString = mxgraph.mxUtils.getXml(svgDocument);
// TODO fix type
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const svgAsString = xmlUtils.getXml(svgDocument);
return `<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
${svgAsString}
Expand All @@ -63,8 +66,8 @@ ${svgAsString}
const viewScale = this.graph.view.scale;

// Prepares SVG document that holds the output
const svgDoc = mxgraph.mxUtils.createXmlDocument();
const root = svgDoc.createElementNS(mxgraph.mxConstants.NS_SVG, 'svg');
const svgDoc = xmlUtils.createXmlDocument();
const root = svgDoc.createElementNS(constants.NS_SVG, 'svg');

const s = scale / viewScale;
const w = Math.max(1, Math.ceil(bounds.width * s) + 2 * border);
Expand All @@ -76,7 +79,7 @@ ${svgAsString}
root.setAttribute('viewBox', (crisp ? '-0.5 -0.5' : '0 0') + ' ' + w + ' ' + h);
svgDoc.appendChild(root);

const group = svgDoc.createElementNS(mxgraph.mxConstants.NS_SVG, 'g');
const group = svgDoc.createElementNS(constants.NS_SVG, 'g');
root.appendChild(group);

const svgCanvas = this.createSvgCanvas(group);
Expand All @@ -91,7 +94,7 @@ ${svgAsString}

svgCanvas.scale(s);

const imgExport = new mxgraph.mxImageExport();
const imgExport = new ImageExport();
// FIXME only the first overlay is placed at the right position
// overlays put on element of subprocess/call-activity are not placed correctly in svg export
imgExport.includeOverlays = true;
Expand All @@ -100,41 +103,37 @@ ${svgAsString}
return svgDoc;
}

createSvgCanvas(node: Element): mxSvgCanvas2D {
const canvas = new CanvasForExport(node);
createSvgCanvas(node: SVGElement): SvgCanvas2D {
const canvas = new CanvasForExport(node, true);
// from the draw.io code, may not be needed here
canvas.pointerEvents = true;
return canvas;
}
}

class CanvasForExport extends mxgraph.mxSvgCanvas2D {
class CanvasForExport extends SvgCanvas2D {
// Convert HTML entities
private htmlConverter = document.createElement('div');

constructor(node: Element) {
super(node);
}

override getAlternateText(
fo: Element,
fo: SVGForeignObjectElement,
x: number,
y: number,
w: number,
h: number,
str: string,
str: Element | string,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
align: string,
align: AlignValue,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
valign: string,
valign: VAlignValue,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
wrap: string,
wrap: boolean,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
format: string,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
overflow: string,
overflow: OverflowValue,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
clip: string,
clip: boolean,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
rotation: number,
): string {
Expand All @@ -147,27 +146,34 @@ class CanvasForExport extends mxgraph.mxSvgCanvas2D {
w: number,
h: number,
str: string,
align: string,
valign: string,
wrap: string,
overflow: string,
clip: string,
align: AlignValue,
valign: VAlignValue,
wrap: boolean,
overflow: OverflowValue,
clip: boolean,
rotation: number,
dir: string,
dir: TextDirectionValue,
): void {
str = this.computeTruncatedText(str, w);
super.plainText(x, y, w, h, str, align, valign, wrap, overflow, clip, rotation, dir);
}

private computeTruncatedText(str: string, w: number): string {
private computeTruncatedText(str: Element | string, w: number): string {
// Assumes a max character width of 0.5em
if (str == null || this.state.fontSize <= 0) {
return '';
}
// TODO manage str when it is an Element (see maxGraph code)
if (str instanceof Element) {
str = str.innerHTML;
}

try {
this.htmlConverter.innerHTML = str;
str = mxgraph.mxUtils.extractTextWithWhitespace(this.htmlConverter.childNodes);
// TODO fix types
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
str = domUtils.extractTextWithWhitespace(this.htmlConverter.childNodes);

// Workaround for substring breaking double byte UTF
const exp = Math.ceil((2 * w) / this.state.fontSize);
Expand All @@ -192,7 +198,7 @@ class CanvasForExport extends mxgraph.mxSvgCanvas2D {

// Uses result and adds ellipsis if more than 1 char remains
if (result.length < str.length && str.length - result.length > 1) {
str = mxgraph.mxUtils.trim(result.join('')) + '...';
str = stringUtils.trim(result.join('')) + '...';
}
} catch (e) {
console.warn('Error while computing txt label', e);
Expand Down
50 changes: 25 additions & 25 deletions dev/ts/component/ThemedBpmnVisualization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import { BpmnVisualization, FlowKind, ShapeBpmnElementKind, ShapeUtil, StyleConfigurator, StyleDefault } from '../../../src/bpmn-visualization';
import { logStartup } from '../utils/internal-helpers';
import { mxgraph } from '../../../src/component/mxgraph/initializer';

interface Theme {
defaultFillColor: string;
Expand Down Expand Up @@ -138,44 +138,44 @@ export class ThemedBpmnVisualization extends BpmnVisualization {
strokeColor = theme.defaultStrokeColor;
break;
}
const style = styleSheet.styles[kind];
style['fillColor'] = fillColor;
style['strokeColor'] = strokeColor;
const style = styleSheet.styles.get(kind);
style.fillColor = fillColor;
style.strokeColor = strokeColor;
});

// TASK
ShapeUtil.taskKinds().forEach(kind => {
const style = styleSheet.styles[kind];
style['fillColor'] = theme.taskAndCallActivityFillColor;
const style = styleSheet.styles.get(kind);
style.fillColor = theme.taskAndCallActivityFillColor;
});

// CALL ACTIVITY
const callActivityStyle = styleSheet.styles[ShapeBpmnElementKind.CALL_ACTIVITY];
callActivityStyle['fillColor'] = theme.taskAndCallActivityFillColor;
const callActivityStyle = styleSheet.styles.get(ShapeBpmnElementKind.CALL_ACTIVITY);
callActivityStyle.fillColor = theme.taskAndCallActivityFillColor;

// TEXT ANNOTATION
const textAnnotationStyle = styleSheet.styles[ShapeBpmnElementKind.TEXT_ANNOTATION];
textAnnotationStyle['fillColor'] = theme.textAnnotationFillColor ?? StyleDefault.TEXT_ANNOTATION_FILL_COLOR;
const textAnnotationStyle = styleSheet.styles.get(ShapeBpmnElementKind.TEXT_ANNOTATION);
textAnnotationStyle.fillColor = theme.textAnnotationFillColor ?? StyleDefault.TEXT_ANNOTATION_FILL_COLOR;

// POOL
const poolStyle = styleSheet.styles[ShapeBpmnElementKind.POOL];
poolStyle['fillColor'] = theme.poolFillColor;
poolStyle['swimlaneFillColor'] = theme.defaultFillColor;
const poolStyle = styleSheet.styles.get(ShapeBpmnElementKind.POOL);
poolStyle.fillColor = theme.poolFillColor;
poolStyle.swimlaneFillColor = theme.defaultFillColor;

// LANE
const laneStyle = styleSheet.styles[ShapeBpmnElementKind.LANE];
laneStyle['fillColor'] = theme.laneFillColor;
const laneStyle = styleSheet.styles.get(ShapeBpmnElementKind.LANE);
laneStyle.fillColor = theme.laneFillColor;

// DEFAULTS
const defaultVertexStyle = styleSheet.getDefaultVertexStyle();
defaultVertexStyle['fontColor'] = theme.defaultFontColor;
defaultVertexStyle['fillColor'] = theme.defaultFillColor;
defaultVertexStyle['strokeColor'] = theme.defaultStrokeColor;
defaultVertexStyle.fontColor = theme.defaultFontColor;
defaultVertexStyle.fillColor = theme.defaultFillColor;
defaultVertexStyle.strokeColor = theme.defaultStrokeColor;

const defaultEdgeStyle = styleSheet.getDefaultEdgeStyle();
defaultEdgeStyle['fontColor'] = theme.defaultFontColor;
defaultEdgeStyle['fillColor'] = theme.defaultFillColor;
defaultEdgeStyle['strokeColor'] = theme.flowColor ?? theme.defaultStrokeColor;
defaultEdgeStyle.fontColor = theme.defaultFontColor;
defaultEdgeStyle.fillColor = theme.defaultFillColor;
defaultEdgeStyle.strokeColor = theme.flowColor ?? theme.defaultStrokeColor;

// theme configuration completed
return true;
Expand All @@ -186,10 +186,10 @@ export class ThemedBpmnVisualization extends BpmnVisualization {

const stylesheet = this.graph.getStylesheet();

// directly access the 'styles' map to update values. Using stylesheet.getCellStyle returns a copy of the style
const seqFlowStyle = stylesheet.styles[FlowKind.SEQUENCE_FLOW];
seqFlowStyle[mxgraph.mxConstants.STYLE_STROKECOLOR] = color;
seqFlowStyle[mxgraph.mxConstants.STYLE_FILLCOLOR] = color;
// directly access the 'styles' map to update values. Using stylesheet.getBPMNCellStyle returns a copy of the style
const seqFlowStyle = stylesheet.styles.get(FlowKind.SEQUENCE_FLOW);
seqFlowStyle.strokeColor = color;
seqFlowStyle.fillColor = color;

logStartup('Sequence flows style updated');
}
Expand Down
2 changes: 1 addition & 1 deletion dev/ts/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ function collapseBpmnElement(bpmnElementId: string): void {
return;
}
log('Updating model, bpmnElement to collapse:', bpmnElementId);
const model = bpmnVisualization.graph.getModel();
const model = bpmnVisualization.graph.model;
const cell = model.getCell(bpmnElementId);
if (!cell) {
log('Element not found in the model, do nothing');
Expand Down
34 changes: 11 additions & 23 deletions package-lock.json

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

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,11 @@
"utils:test:model": "node ./scripts/utils/dist/utils.mjs test/fixtures/bpmn/simple-start-task-end.bpmn --output model"
},
"dependencies": {
"@typed-mxgraph/typed-mxgraph": "~1.0.7",
"@maxgraph/core": "^0.1.0",
"entities": "~4.3.1",
"fast-xml-parser": "4.0.12",
"lodash.debounce": "~4.0.8",
"lodash.throttle": "~4.1.1",
"mxgraph": "4.2.2",
"strnum": "1.0.5"
},
"devDependencies": {
Expand Down
3 changes: 0 additions & 3 deletions src/bpmn-visualization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
* limitations under the License.
*/

// Use mxgraph types
/// <reference types="@typed-mxgraph/typed-mxgraph" />

// export types first, otherwise typedoc doesn't generate the subsequent doc correctly (no category and uses the file header instead of the actual TSDoc)
export * from './component/options';
export { BpmnVisualization } from './component/BpmnVisualization';
Expand Down
Loading
Loading