@metadev/daga 4.2.3 → 4.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Changelog.md +13 -0
- package/index.cjs.js +31 -12
- package/index.esm.js +31 -12
- package/package.json +1 -1
- package/src/lib/diagram/canvas/diagram-canvas-util.d.ts +7 -1
- package/src/lib/diagram/canvas/diagram-canvas.d.ts +2 -0
- package/src/lib/diagram/config/diagram-components-config.d.ts +10 -0
- package/src/lib/diagram/config/diagram-look-config.d.ts +17 -8
- package/src/lib/diagram/property/property.d.ts +10 -4
- package/src/lib/interfaces/canvas.d.ts +10 -0
package/Changelog.md
CHANGED
|
@@ -6,6 +6,19 @@ List of releases and changes.
|
|
|
6
6
|
|
|
7
7
|
## Next release Joyeuse
|
|
8
8
|
|
|
9
|
+
## v. 4.2.5
|
|
10
|
+
|
|
11
|
+
- Add methods `getZoomLevel()` and `getViewCoordinates()` in `canvas` to obtain the current zoom and pan level of the view [#317](https://github.com/metadevpro/daga/pull/317)
|
|
12
|
+
- Enable configuring the height of the palette and property editor [#319](https://github.com/metadevpro/daga/pull/319)
|
|
13
|
+
- Correctly update the connection point of ports when pasting [#321](https://github.com/metadevpro/daga/pull/321)
|
|
14
|
+
|
|
15
|
+
## v. 4.2.4
|
|
16
|
+
|
|
17
|
+
- Enable configuring line style in shaped looks [#313](https://github.com/metadevpro/daga/pull/313)
|
|
18
|
+
- Enable default values for parameters of looks [#313](https://github.com/metadevpro/daga/pull/313)
|
|
19
|
+
- Use optional `label` fields in `Property` [#314](https://github.com/metadevpro/daga/pull/314)
|
|
20
|
+
- Use default values for `basic` and `editable` fields of `Property` [#315](https://github.com/metadevpro/daga/pull/315)
|
|
21
|
+
|
|
9
22
|
## v. 4.2.3
|
|
10
23
|
|
|
11
24
|
- Enable toggling whether individual sections can be highlighted or entire nodes [#308](https://github.com/metadevpro/daga/pull/308)
|
package/index.cjs.js
CHANGED
|
@@ -1224,8 +1224,9 @@ class DiagramElementSet extends DiagramEntitySet {
|
|
|
1224
1224
|
* @see ValueSet
|
|
1225
1225
|
*/
|
|
1226
1226
|
class Property {
|
|
1227
|
-
constructor(name, type, defaultValue, basic, editable, rootAttribute) {
|
|
1227
|
+
constructor(name, label, type, defaultValue, basic, editable, rootAttribute) {
|
|
1228
1228
|
this.name = name;
|
|
1229
|
+
this.label = label;
|
|
1229
1230
|
this.type = type;
|
|
1230
1231
|
this.defaultValue = defaultValue;
|
|
1231
1232
|
this.basic = basic;
|
|
@@ -1745,7 +1746,7 @@ class ValueSet {
|
|
|
1745
1746
|
this.setRootElementValue(rootAttribute, this.values[key]);
|
|
1746
1747
|
}
|
|
1747
1748
|
}
|
|
1748
|
-
if (property.basic) {
|
|
1749
|
+
if (property.basic !== false) {
|
|
1749
1750
|
this.displayedProperties.push(property);
|
|
1750
1751
|
} else {
|
|
1751
1752
|
this.hiddenProperties.push(property);
|
|
@@ -4517,7 +4518,7 @@ class DagaImporter {
|
|
|
4517
4518
|
let portCounter = 0;
|
|
4518
4519
|
for (const port of section.ports || []) {
|
|
4519
4520
|
const newPortType = port.type !== undefined ? model.ports.types.get(port.type) : undefined;
|
|
4520
|
-
const newPort = new DiagramPort(model, newPortType, newSection, port.coords, port.connectionPoint, port.direction, port.id);
|
|
4521
|
+
const newPort = new DiagramPort(model, newPortType, newSection, port.coords, port.connectionPoint || port.coords, port.direction, port.id);
|
|
4521
4522
|
newSection.ports.push(newPort);
|
|
4522
4523
|
model.ports.add(newPort);
|
|
4523
4524
|
if (port.label) {
|
|
@@ -4564,7 +4565,7 @@ class DagaImporter {
|
|
|
4564
4565
|
let portCounter = 0;
|
|
4565
4566
|
for (const port of node.ports || []) {
|
|
4566
4567
|
const newPortType = port.type !== undefined ? model.ports.types.get(port.type) : undefined;
|
|
4567
|
-
const newPort = new DiagramPort(model, newPortType, newNode, port.coords, port.connectionPoint, port.direction, port.id);
|
|
4568
|
+
const newPort = new DiagramPort(model, newPortType, newNode, port.coords, port.connectionPoint || port.coords, port.direction, port.id);
|
|
4568
4569
|
newNode.ports.push(newPort);
|
|
4569
4570
|
model.ports.add(newPort);
|
|
4570
4571
|
if (port.label) {
|
|
@@ -5799,6 +5800,9 @@ class PasteAction {
|
|
|
5799
5800
|
idRefresh[oldPortId] = port.id;
|
|
5800
5801
|
if (coordsDiff) {
|
|
5801
5802
|
port.coords = [port.coords[0] + coordsDiff[0], port.coords[1] + coordsDiff[1]];
|
|
5803
|
+
if (port.connectionPoint) {
|
|
5804
|
+
port.connectionPoint = [port.connectionPoint[0] + coordsDiff[0], port.connectionPoint[1] + coordsDiff[1]];
|
|
5805
|
+
}
|
|
5802
5806
|
}
|
|
5803
5807
|
}
|
|
5804
5808
|
}
|
|
@@ -5815,6 +5819,9 @@ class PasteAction {
|
|
|
5815
5819
|
idRefresh[oldPortId] = port.id;
|
|
5816
5820
|
if (coordsDiff) {
|
|
5817
5821
|
port.coords = [port.coords[0] + coordsDiff[0], port.coords[1] + coordsDiff[1]];
|
|
5822
|
+
if (port.connectionPoint) {
|
|
5823
|
+
port.connectionPoint = [port.connectionPoint[0] + coordsDiff[0], port.connectionPoint[1] + coordsDiff[1]];
|
|
5824
|
+
}
|
|
5818
5825
|
}
|
|
5819
5826
|
}
|
|
5820
5827
|
}
|
|
@@ -6254,8 +6261,14 @@ const initializeLook = selection => {
|
|
|
6254
6261
|
selection.filter('.stretchable-image-look').append('image').attr('class', 'bottom-image').attr('preserveAspectRatio', 'none');
|
|
6255
6262
|
selection.filter('.stretchable-image-look').append('image').attr('class', 'bottom-right-image').attr('preserveAspectRatio', 'none');
|
|
6256
6263
|
};
|
|
6264
|
+
const SHAPED_LOOK_DEFAULTS = {
|
|
6265
|
+
fillColor: '#FFFFFF',
|
|
6266
|
+
borderColor: '#000000',
|
|
6267
|
+
borderThickness: 1,
|
|
6268
|
+
borderStyle: exports.LineStyle.Solid
|
|
6269
|
+
};
|
|
6257
6270
|
const updateLook = selection => {
|
|
6258
|
-
selection.filter('.shaped-look').select('path').attr('d', d => generalClosedPath(d.look.shape, 0, 0, d.width, d.height)).attr('fill', d => d.look.fillColor).attr('stroke', d => d.look.borderColor).attr('stroke-width', d => `${d.look.borderThickness}px`);
|
|
6271
|
+
selection.filter('.shaped-look').select('path').attr('d', d => generalClosedPath(d.look.shape || exports.ClosedShape.Rectangle, 0, 0, d.width, d.height)).attr('fill', d => d.look.fillColor || SHAPED_LOOK_DEFAULTS.fillColor).attr('stroke', d => d.look.borderColor || SHAPED_LOOK_DEFAULTS.borderColor).attr('stroke-width', d => `${d.look.borderThickness || SHAPED_LOOK_DEFAULTS.borderThickness}px`).attr('stroke-dasharray', d => lineStyleDasharray(d.look.borderStyle || SHAPED_LOOK_DEFAULTS.borderStyle, d.look.borderThickness || SHAPED_LOOK_DEFAULTS.borderThickness));
|
|
6259
6272
|
selection.filter('.image-look').select('image').attr('x', 0).attr('y', 0).attr('width', d => d.width).attr('height', d => d.height).attr('href', d => d.look.backgroundImage);
|
|
6260
6273
|
selection.filter('.stretchable-image-look').select('image.top-left-image').attr('x', 0).attr('y', 0).attr('width', d => d.look.leftMargin).attr('height', d => d.look.topMargin).attr('href', d => d.look.backgroundImageTopLeft);
|
|
6261
6274
|
selection.filter('.stretchable-image-look').select('image.top-image').attr('x', d => d.look.leftMargin).attr('y', 0).attr('width', d => d.width - d.look.rightMargin - d.look.leftMargin).attr('height', d => d.look.topMargin).attr('href', d => d.look.backgroundImageTop);
|
|
@@ -6582,7 +6595,7 @@ class DagaExporter {
|
|
|
6582
6595
|
id: port.id,
|
|
6583
6596
|
type: (_a = port.type) === null || _a === void 0 ? void 0 : _a.id,
|
|
6584
6597
|
coords: roundPoint(port.coords),
|
|
6585
|
-
connectionPoint: roundPoint(port.connectionPoint),
|
|
6598
|
+
connectionPoint: roundPoint(port.connectionPoint || port.coords),
|
|
6586
6599
|
direction: port.direction,
|
|
6587
6600
|
label: ((_b = port.label) === null || _b === void 0 ? void 0 : _b.text) || ''
|
|
6588
6601
|
}, includeCollabMeta ? {
|
|
@@ -6616,7 +6629,7 @@ class DagaExporter {
|
|
|
6616
6629
|
id: port.id,
|
|
6617
6630
|
type: (_d = port.type) === null || _d === void 0 ? void 0 : _d.id,
|
|
6618
6631
|
coords: roundPoint(port.coords),
|
|
6619
|
-
connectionPoint: roundPoint(port.connectionPoint),
|
|
6632
|
+
connectionPoint: roundPoint(port.connectionPoint || port.coords),
|
|
6620
6633
|
direction: port.direction,
|
|
6621
6634
|
label: ((_e = port.label) === null || _e === void 0 ? void 0 : _e.text) || ''
|
|
6622
6635
|
}, includeCollabMeta ? {
|
|
@@ -7294,6 +7307,9 @@ class DiagramCanvas {
|
|
|
7294
7307
|
initializeGrid(this, canvasView, this.backgroundPatternId);
|
|
7295
7308
|
canvasView.append('g').attr('class', 'daga-canvas-elements');
|
|
7296
7309
|
}
|
|
7310
|
+
getZoomLevel() {
|
|
7311
|
+
return this.zoomTransform.k;
|
|
7312
|
+
}
|
|
7297
7313
|
zoomBy(factor) {
|
|
7298
7314
|
if (!isNaN(factor)) {
|
|
7299
7315
|
this.zoomBehavior.scaleBy(this.selectCanvasView(), factor);
|
|
@@ -7304,6 +7320,9 @@ class DiagramCanvas {
|
|
|
7304
7320
|
this.zoomBehavior.scaleTo(this.selectCanvasView(), level);
|
|
7305
7321
|
}
|
|
7306
7322
|
}
|
|
7323
|
+
getViewCoordinates() {
|
|
7324
|
+
return [this.zoomTransform.x, this.zoomTransform.y];
|
|
7325
|
+
}
|
|
7307
7326
|
translateBy(x, y) {
|
|
7308
7327
|
if (!isNaN(x) && !isNaN(y)) {
|
|
7309
7328
|
this.zoomBehavior.translateBy(this.selectCanvasView(), x, y);
|
|
@@ -7920,7 +7939,7 @@ class DiagramCanvas {
|
|
|
7920
7939
|
if (this.canUserPerformAction(exports.DiagramActions.AddConnection) && !d.removed) {
|
|
7921
7940
|
if (this.unfinishedConnection !== undefined) {
|
|
7922
7941
|
const endCoords = [event.x, event.y];
|
|
7923
|
-
(_a = this.unfinishedConnectionTracer) === null || _a === void 0 ? void 0 : _a.attr('d', getConnectionPath(this.unfinishedConnection.look.shape, this.unfinishedConnection.startCoords, endCoords, this.unfinishedConnection.startDirection, this.unfinishedConnection.endDirection, this.unfinishedConnection.look.thickness, (_b = this.unfinishedConnection.startMarkerLook) === null || _b === void 0 ? void 0 : _b.width, (_c = this.unfinishedConnection.endMarkerLook) === null || _c === void 0 ? void 0 : _c.width));
|
|
7942
|
+
(_a = this.unfinishedConnectionTracer) === null || _a === void 0 ? void 0 : _a.attr('d', getConnectionPath(this.unfinishedConnection.look.shape || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.shape, this.unfinishedConnection.startCoords, endCoords, this.unfinishedConnection.startDirection, this.unfinishedConnection.endDirection, this.unfinishedConnection.look.thickness || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.thickness, (_b = this.unfinishedConnection.startMarkerLook) === null || _b === void 0 ? void 0 : _b.width, (_c = this.unfinishedConnection.endMarkerLook) === null || _c === void 0 ? void 0 : _c.width));
|
|
7924
7943
|
const unfinishedConnectionGhostNode = (_d = this.unfinishedConnectionTracer) === null || _d === void 0 ? void 0 : _d.node();
|
|
7925
7944
|
if (unfinishedConnectionGhostNode) {
|
|
7926
7945
|
let margin = 2;
|
|
@@ -8068,14 +8087,14 @@ class DiagramCanvas {
|
|
|
8068
8087
|
enterSelection.select('g.diagram-connection-end-label').append('text').style('user-select', 'none');
|
|
8069
8088
|
mergeSelection.attr('opacity', d => d.removed ? 0.5 : 1).select('path.diagram-connection-path').attr('d', d => {
|
|
8070
8089
|
var _a, _b;
|
|
8071
|
-
return getConnectionPath(d.look.shape, d.startCoords, d.endCoords, d.startDirection, d.endDirection, d.look.thickness, (_a = d.startMarkerLook) === null || _a === void 0 ? void 0 : _a.width, (_b = d.endMarkerLook) === null || _b === void 0 ? void 0 : _b.width);
|
|
8072
|
-
}).attr('marker-start', d => `url(#${d.id}-start-marker)`).attr('marker-end', d => `url(#${d.id}-end-marker)`).attr('stroke', d => d.look.color).attr('stroke-width', d => `${d.look.thickness}px`).attr('stroke-dasharray', d => lineStyleDasharray(d.look.style, d.look.thickness)).attr('fill', 'none');
|
|
8090
|
+
return getConnectionPath(d.look.shape || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.shape, d.startCoords, d.endCoords, d.startDirection, d.endDirection, d.look.thickness || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.thickness, (_a = d.startMarkerLook) === null || _a === void 0 ? void 0 : _a.width, (_b = d.endMarkerLook) === null || _b === void 0 ? void 0 : _b.width);
|
|
8091
|
+
}).attr('marker-start', d => `url(#${d.id}-start-marker)`).attr('marker-end', d => `url(#${d.id}-end-marker)`).attr('stroke', d => d.look.color || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.color).attr('stroke-width', d => `${d.look.thickness}px`).attr('stroke-dasharray', d => lineStyleDasharray(d.look.style || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.style, d.look.thickness || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.thickness)).attr('fill', 'none');
|
|
8073
8092
|
mergeSelection.select('path.diagram-connection-path-box').attr('d', d => {
|
|
8074
8093
|
var _a, _b;
|
|
8075
|
-
return getConnectionPath(d.look.shape, d.startCoords, d.endCoords, d.startDirection, d.endDirection, d.look.thickness, (_a = d.startMarkerLook) === null || _a === void 0 ? void 0 : _a.width, (_b = d.endMarkerLook) === null || _b === void 0 ? void 0 : _b.width);
|
|
8094
|
+
return getConnectionPath(d.look.shape || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.shape, d.startCoords, d.endCoords, d.startDirection, d.endDirection, d.look.thickness || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.thickness, (_a = d.startMarkerLook) === null || _a === void 0 ? void 0 : _a.width, (_b = d.endMarkerLook) === null || _b === void 0 ? void 0 : _b.width);
|
|
8076
8095
|
}).attr('stroke', 'transparent')
|
|
8077
8096
|
// allow generating pointer events even when it is transparent
|
|
8078
|
-
.attr('pointer-events', 'stroke').attr('stroke-width', d => `${d.look.thickness + CONNECTION_PATH_BOX_THICKNESS}px`).attr('stroke-dasharray', d => lineStyleDasharray(d.look.style, d.look.thickness)).attr('fill', 'none');
|
|
8097
|
+
.attr('pointer-events', 'stroke').attr('stroke-width', d => `${(d.look.thickness || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.thickness) + CONNECTION_PATH_BOX_THICKNESS}px`).attr('stroke-dasharray', d => lineStyleDasharray(d.look.style || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.style, d.look.thickness || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.thickness)).attr('fill', 'none');
|
|
8079
8098
|
mergeSelection.data().forEach(connection => {
|
|
8080
8099
|
this.updateConnectionLabelsInView(connection);
|
|
8081
8100
|
this.updateConnectionMarkersInView(connection);
|
package/index.esm.js
CHANGED
|
@@ -1203,8 +1203,9 @@ class DiagramElementSet extends DiagramEntitySet {
|
|
|
1203
1203
|
* @see ValueSet
|
|
1204
1204
|
*/
|
|
1205
1205
|
class Property {
|
|
1206
|
-
constructor(name, type, defaultValue, basic, editable, rootAttribute) {
|
|
1206
|
+
constructor(name, label, type, defaultValue, basic, editable, rootAttribute) {
|
|
1207
1207
|
this.name = name;
|
|
1208
|
+
this.label = label;
|
|
1208
1209
|
this.type = type;
|
|
1209
1210
|
this.defaultValue = defaultValue;
|
|
1210
1211
|
this.basic = basic;
|
|
@@ -1724,7 +1725,7 @@ class ValueSet {
|
|
|
1724
1725
|
this.setRootElementValue(rootAttribute, this.values[key]);
|
|
1725
1726
|
}
|
|
1726
1727
|
}
|
|
1727
|
-
if (property.basic) {
|
|
1728
|
+
if (property.basic !== false) {
|
|
1728
1729
|
this.displayedProperties.push(property);
|
|
1729
1730
|
} else {
|
|
1730
1731
|
this.hiddenProperties.push(property);
|
|
@@ -4496,7 +4497,7 @@ class DagaImporter {
|
|
|
4496
4497
|
let portCounter = 0;
|
|
4497
4498
|
for (const port of section.ports || []) {
|
|
4498
4499
|
const newPortType = port.type !== undefined ? model.ports.types.get(port.type) : undefined;
|
|
4499
|
-
const newPort = new DiagramPort(model, newPortType, newSection, port.coords, port.connectionPoint, port.direction, port.id);
|
|
4500
|
+
const newPort = new DiagramPort(model, newPortType, newSection, port.coords, port.connectionPoint || port.coords, port.direction, port.id);
|
|
4500
4501
|
newSection.ports.push(newPort);
|
|
4501
4502
|
model.ports.add(newPort);
|
|
4502
4503
|
if (port.label) {
|
|
@@ -4543,7 +4544,7 @@ class DagaImporter {
|
|
|
4543
4544
|
let portCounter = 0;
|
|
4544
4545
|
for (const port of node.ports || []) {
|
|
4545
4546
|
const newPortType = port.type !== undefined ? model.ports.types.get(port.type) : undefined;
|
|
4546
|
-
const newPort = new DiagramPort(model, newPortType, newNode, port.coords, port.connectionPoint, port.direction, port.id);
|
|
4547
|
+
const newPort = new DiagramPort(model, newPortType, newNode, port.coords, port.connectionPoint || port.coords, port.direction, port.id);
|
|
4547
4548
|
newNode.ports.push(newPort);
|
|
4548
4549
|
model.ports.add(newPort);
|
|
4549
4550
|
if (port.label) {
|
|
@@ -5778,6 +5779,9 @@ class PasteAction {
|
|
|
5778
5779
|
idRefresh[oldPortId] = port.id;
|
|
5779
5780
|
if (coordsDiff) {
|
|
5780
5781
|
port.coords = [port.coords[0] + coordsDiff[0], port.coords[1] + coordsDiff[1]];
|
|
5782
|
+
if (port.connectionPoint) {
|
|
5783
|
+
port.connectionPoint = [port.connectionPoint[0] + coordsDiff[0], port.connectionPoint[1] + coordsDiff[1]];
|
|
5784
|
+
}
|
|
5781
5785
|
}
|
|
5782
5786
|
}
|
|
5783
5787
|
}
|
|
@@ -5794,6 +5798,9 @@ class PasteAction {
|
|
|
5794
5798
|
idRefresh[oldPortId] = port.id;
|
|
5795
5799
|
if (coordsDiff) {
|
|
5796
5800
|
port.coords = [port.coords[0] + coordsDiff[0], port.coords[1] + coordsDiff[1]];
|
|
5801
|
+
if (port.connectionPoint) {
|
|
5802
|
+
port.connectionPoint = [port.connectionPoint[0] + coordsDiff[0], port.connectionPoint[1] + coordsDiff[1]];
|
|
5803
|
+
}
|
|
5797
5804
|
}
|
|
5798
5805
|
}
|
|
5799
5806
|
}
|
|
@@ -6233,8 +6240,14 @@ const initializeLook = selection => {
|
|
|
6233
6240
|
selection.filter('.stretchable-image-look').append('image').attr('class', 'bottom-image').attr('preserveAspectRatio', 'none');
|
|
6234
6241
|
selection.filter('.stretchable-image-look').append('image').attr('class', 'bottom-right-image').attr('preserveAspectRatio', 'none');
|
|
6235
6242
|
};
|
|
6243
|
+
const SHAPED_LOOK_DEFAULTS = {
|
|
6244
|
+
fillColor: '#FFFFFF',
|
|
6245
|
+
borderColor: '#000000',
|
|
6246
|
+
borderThickness: 1,
|
|
6247
|
+
borderStyle: LineStyle.Solid
|
|
6248
|
+
};
|
|
6236
6249
|
const updateLook = selection => {
|
|
6237
|
-
selection.filter('.shaped-look').select('path').attr('d', d => generalClosedPath(d.look.shape, 0, 0, d.width, d.height)).attr('fill', d => d.look.fillColor).attr('stroke', d => d.look.borderColor).attr('stroke-width', d => `${d.look.borderThickness}px`);
|
|
6250
|
+
selection.filter('.shaped-look').select('path').attr('d', d => generalClosedPath(d.look.shape || ClosedShape.Rectangle, 0, 0, d.width, d.height)).attr('fill', d => d.look.fillColor || SHAPED_LOOK_DEFAULTS.fillColor).attr('stroke', d => d.look.borderColor || SHAPED_LOOK_DEFAULTS.borderColor).attr('stroke-width', d => `${d.look.borderThickness || SHAPED_LOOK_DEFAULTS.borderThickness}px`).attr('stroke-dasharray', d => lineStyleDasharray(d.look.borderStyle || SHAPED_LOOK_DEFAULTS.borderStyle, d.look.borderThickness || SHAPED_LOOK_DEFAULTS.borderThickness));
|
|
6238
6251
|
selection.filter('.image-look').select('image').attr('x', 0).attr('y', 0).attr('width', d => d.width).attr('height', d => d.height).attr('href', d => d.look.backgroundImage);
|
|
6239
6252
|
selection.filter('.stretchable-image-look').select('image.top-left-image').attr('x', 0).attr('y', 0).attr('width', d => d.look.leftMargin).attr('height', d => d.look.topMargin).attr('href', d => d.look.backgroundImageTopLeft);
|
|
6240
6253
|
selection.filter('.stretchable-image-look').select('image.top-image').attr('x', d => d.look.leftMargin).attr('y', 0).attr('width', d => d.width - d.look.rightMargin - d.look.leftMargin).attr('height', d => d.look.topMargin).attr('href', d => d.look.backgroundImageTop);
|
|
@@ -6561,7 +6574,7 @@ class DagaExporter {
|
|
|
6561
6574
|
id: port.id,
|
|
6562
6575
|
type: (_a = port.type) === null || _a === void 0 ? void 0 : _a.id,
|
|
6563
6576
|
coords: roundPoint(port.coords),
|
|
6564
|
-
connectionPoint: roundPoint(port.connectionPoint),
|
|
6577
|
+
connectionPoint: roundPoint(port.connectionPoint || port.coords),
|
|
6565
6578
|
direction: port.direction,
|
|
6566
6579
|
label: ((_b = port.label) === null || _b === void 0 ? void 0 : _b.text) || ''
|
|
6567
6580
|
}, includeCollabMeta ? {
|
|
@@ -6595,7 +6608,7 @@ class DagaExporter {
|
|
|
6595
6608
|
id: port.id,
|
|
6596
6609
|
type: (_d = port.type) === null || _d === void 0 ? void 0 : _d.id,
|
|
6597
6610
|
coords: roundPoint(port.coords),
|
|
6598
|
-
connectionPoint: roundPoint(port.connectionPoint),
|
|
6611
|
+
connectionPoint: roundPoint(port.connectionPoint || port.coords),
|
|
6599
6612
|
direction: port.direction,
|
|
6600
6613
|
label: ((_e = port.label) === null || _e === void 0 ? void 0 : _e.text) || ''
|
|
6601
6614
|
}, includeCollabMeta ? {
|
|
@@ -7273,6 +7286,9 @@ class DiagramCanvas {
|
|
|
7273
7286
|
initializeGrid(this, canvasView, this.backgroundPatternId);
|
|
7274
7287
|
canvasView.append('g').attr('class', 'daga-canvas-elements');
|
|
7275
7288
|
}
|
|
7289
|
+
getZoomLevel() {
|
|
7290
|
+
return this.zoomTransform.k;
|
|
7291
|
+
}
|
|
7276
7292
|
zoomBy(factor) {
|
|
7277
7293
|
if (!isNaN(factor)) {
|
|
7278
7294
|
this.zoomBehavior.scaleBy(this.selectCanvasView(), factor);
|
|
@@ -7283,6 +7299,9 @@ class DiagramCanvas {
|
|
|
7283
7299
|
this.zoomBehavior.scaleTo(this.selectCanvasView(), level);
|
|
7284
7300
|
}
|
|
7285
7301
|
}
|
|
7302
|
+
getViewCoordinates() {
|
|
7303
|
+
return [this.zoomTransform.x, this.zoomTransform.y];
|
|
7304
|
+
}
|
|
7286
7305
|
translateBy(x, y) {
|
|
7287
7306
|
if (!isNaN(x) && !isNaN(y)) {
|
|
7288
7307
|
this.zoomBehavior.translateBy(this.selectCanvasView(), x, y);
|
|
@@ -7899,7 +7918,7 @@ class DiagramCanvas {
|
|
|
7899
7918
|
if (this.canUserPerformAction(DiagramActions.AddConnection) && !d.removed) {
|
|
7900
7919
|
if (this.unfinishedConnection !== undefined) {
|
|
7901
7920
|
const endCoords = [event.x, event.y];
|
|
7902
|
-
(_a = this.unfinishedConnectionTracer) === null || _a === void 0 ? void 0 : _a.attr('d', getConnectionPath(this.unfinishedConnection.look.shape, this.unfinishedConnection.startCoords, endCoords, this.unfinishedConnection.startDirection, this.unfinishedConnection.endDirection, this.unfinishedConnection.look.thickness, (_b = this.unfinishedConnection.startMarkerLook) === null || _b === void 0 ? void 0 : _b.width, (_c = this.unfinishedConnection.endMarkerLook) === null || _c === void 0 ? void 0 : _c.width));
|
|
7921
|
+
(_a = this.unfinishedConnectionTracer) === null || _a === void 0 ? void 0 : _a.attr('d', getConnectionPath(this.unfinishedConnection.look.shape || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.shape, this.unfinishedConnection.startCoords, endCoords, this.unfinishedConnection.startDirection, this.unfinishedConnection.endDirection, this.unfinishedConnection.look.thickness || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.thickness, (_b = this.unfinishedConnection.startMarkerLook) === null || _b === void 0 ? void 0 : _b.width, (_c = this.unfinishedConnection.endMarkerLook) === null || _c === void 0 ? void 0 : _c.width));
|
|
7903
7922
|
const unfinishedConnectionGhostNode = (_d = this.unfinishedConnectionTracer) === null || _d === void 0 ? void 0 : _d.node();
|
|
7904
7923
|
if (unfinishedConnectionGhostNode) {
|
|
7905
7924
|
let margin = 2;
|
|
@@ -8047,14 +8066,14 @@ class DiagramCanvas {
|
|
|
8047
8066
|
enterSelection.select('g.diagram-connection-end-label').append('text').style('user-select', 'none');
|
|
8048
8067
|
mergeSelection.attr('opacity', d => d.removed ? 0.5 : 1).select('path.diagram-connection-path').attr('d', d => {
|
|
8049
8068
|
var _a, _b;
|
|
8050
|
-
return getConnectionPath(d.look.shape, d.startCoords, d.endCoords, d.startDirection, d.endDirection, d.look.thickness, (_a = d.startMarkerLook) === null || _a === void 0 ? void 0 : _a.width, (_b = d.endMarkerLook) === null || _b === void 0 ? void 0 : _b.width);
|
|
8051
|
-
}).attr('marker-start', d => `url(#${d.id}-start-marker)`).attr('marker-end', d => `url(#${d.id}-end-marker)`).attr('stroke', d => d.look.color).attr('stroke-width', d => `${d.look.thickness}px`).attr('stroke-dasharray', d => lineStyleDasharray(d.look.style, d.look.thickness)).attr('fill', 'none');
|
|
8069
|
+
return getConnectionPath(d.look.shape || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.shape, d.startCoords, d.endCoords, d.startDirection, d.endDirection, d.look.thickness || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.thickness, (_a = d.startMarkerLook) === null || _a === void 0 ? void 0 : _a.width, (_b = d.endMarkerLook) === null || _b === void 0 ? void 0 : _b.width);
|
|
8070
|
+
}).attr('marker-start', d => `url(#${d.id}-start-marker)`).attr('marker-end', d => `url(#${d.id}-end-marker)`).attr('stroke', d => d.look.color || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.color).attr('stroke-width', d => `${d.look.thickness}px`).attr('stroke-dasharray', d => lineStyleDasharray(d.look.style || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.style, d.look.thickness || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.thickness)).attr('fill', 'none');
|
|
8052
8071
|
mergeSelection.select('path.diagram-connection-path-box').attr('d', d => {
|
|
8053
8072
|
var _a, _b;
|
|
8054
|
-
return getConnectionPath(d.look.shape, d.startCoords, d.endCoords, d.startDirection, d.endDirection, d.look.thickness, (_a = d.startMarkerLook) === null || _a === void 0 ? void 0 : _a.width, (_b = d.endMarkerLook) === null || _b === void 0 ? void 0 : _b.width);
|
|
8073
|
+
return getConnectionPath(d.look.shape || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.shape, d.startCoords, d.endCoords, d.startDirection, d.endDirection, d.look.thickness || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.thickness, (_a = d.startMarkerLook) === null || _a === void 0 ? void 0 : _a.width, (_b = d.endMarkerLook) === null || _b === void 0 ? void 0 : _b.width);
|
|
8055
8074
|
}).attr('stroke', 'transparent')
|
|
8056
8075
|
// allow generating pointer events even when it is transparent
|
|
8057
|
-
.attr('pointer-events', 'stroke').attr('stroke-width', d => `${d.look.thickness + CONNECTION_PATH_BOX_THICKNESS}px`).attr('stroke-dasharray', d => lineStyleDasharray(d.look.style, d.look.thickness)).attr('fill', 'none');
|
|
8076
|
+
.attr('pointer-events', 'stroke').attr('stroke-width', d => `${(d.look.thickness || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.thickness) + CONNECTION_PATH_BOX_THICKNESS}px`).attr('stroke-dasharray', d => lineStyleDasharray(d.look.style || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.style, d.look.thickness || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.thickness)).attr('fill', 'none');
|
|
8058
8077
|
mergeSelection.data().forEach(connection => {
|
|
8059
8078
|
this.updateConnectionLabelsInView(connection);
|
|
8060
8079
|
this.updateConnectionMarkersInView(connection);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as d3 from 'd3';
|
|
2
2
|
import { Point } from '../../util/canvas-util';
|
|
3
|
-
import { LineFunction, LineShape } from '../../util/line';
|
|
3
|
+
import { LineFunction, LineShape, LineStyle } from '../../util/line';
|
|
4
4
|
import { CursorStyle } from '../../util/style';
|
|
5
5
|
import { Side } from '../../util/svg-util';
|
|
6
6
|
import { DiagramField } from '../model/diagram-field';
|
|
@@ -24,6 +24,12 @@ export declare const getConnectionPath: (shape: LineShape | LineFunction, startC
|
|
|
24
24
|
export declare const setCursorStyle: (style?: CursorStyle) => void;
|
|
25
25
|
export declare const getRelatedNodeOrItself: (element: DiagramNode | DiagramSection | DiagramPort | DiagramField) => DiagramNode | DiagramSection | DiagramPort | DiagramField;
|
|
26
26
|
export declare const initializeLook: (selection: d3.Selection<SVGGElement, DiagramNode | DiagramSection | DiagramPort, d3.BaseType, unknown>) => void;
|
|
27
|
+
export declare const SHAPED_LOOK_DEFAULTS: {
|
|
28
|
+
fillColor: string;
|
|
29
|
+
borderColor: string;
|
|
30
|
+
borderThickness: number;
|
|
31
|
+
borderStyle: LineStyle;
|
|
32
|
+
};
|
|
27
33
|
export declare const updateLook: (selection: d3.Selection<SVGGElement, DiagramNode | DiagramSection | DiagramPort, d3.BaseType, unknown>) => void;
|
|
28
34
|
export declare const GRID_DEFAULTS: {
|
|
29
35
|
enabled: boolean;
|
|
@@ -99,8 +99,10 @@ export declare class DiagramCanvas implements Canvas {
|
|
|
99
99
|
getPriorityThreshold(): number | undefined;
|
|
100
100
|
setPriorityThreshold(priority: number): void;
|
|
101
101
|
initView(appendTo: HTMLElement): void;
|
|
102
|
+
getZoomLevel(): number;
|
|
102
103
|
zoomBy(factor: number): void;
|
|
103
104
|
zoomTo(level: number): void;
|
|
105
|
+
getViewCoordinates(): Point;
|
|
104
106
|
translateBy(x: number, y: number): void;
|
|
105
107
|
translateTo(x: number, y: number): void;
|
|
106
108
|
center(): void;
|
|
@@ -111,6 +111,11 @@ export interface PaletteComponentConfig {
|
|
|
111
111
|
* @default 'bottom'
|
|
112
112
|
*/
|
|
113
113
|
direction?: Side;
|
|
114
|
+
/**
|
|
115
|
+
* Dimension of this component in the direction that it extends towards. If undefined, it stretches as needed.
|
|
116
|
+
* @default undefined
|
|
117
|
+
*/
|
|
118
|
+
height?: string;
|
|
114
119
|
/**
|
|
115
120
|
* Dimension of this component in the direction perpendicular to the direction that it extends towards.
|
|
116
121
|
* @default '12rem'
|
|
@@ -153,6 +158,11 @@ export interface PropertyEditorComponentConfig {
|
|
|
153
158
|
* @default '24rem'
|
|
154
159
|
*/
|
|
155
160
|
width?: string;
|
|
161
|
+
/**
|
|
162
|
+
* Dimension of this component in the direction that it extends towards. If undefined, it stretches as needed.
|
|
163
|
+
* @default undefined
|
|
164
|
+
*/
|
|
165
|
+
height?: string;
|
|
156
166
|
}
|
|
157
167
|
/**
|
|
158
168
|
* Configuration for a palette.
|
|
@@ -71,20 +71,29 @@ export interface ShapedLook extends Look {
|
|
|
71
71
|
lookType: 'shaped-look';
|
|
72
72
|
/**
|
|
73
73
|
* Shape of nodes using this look.
|
|
74
|
+
* @default 'rectangle'
|
|
74
75
|
*/
|
|
75
|
-
shape
|
|
76
|
+
shape?: ClosedShape | ShapeFunction;
|
|
76
77
|
/**
|
|
77
78
|
* Background color of this look.
|
|
79
|
+
* @default '#FFFFFF'
|
|
78
80
|
*/
|
|
79
|
-
fillColor
|
|
81
|
+
fillColor?: string;
|
|
80
82
|
/**
|
|
81
83
|
* Border color of this look.
|
|
84
|
+
* @default '#000000'
|
|
82
85
|
*/
|
|
83
|
-
borderColor
|
|
86
|
+
borderColor?: string;
|
|
84
87
|
/**
|
|
85
88
|
* Border thickness of this look in diagram units.
|
|
89
|
+
* @default 1
|
|
90
|
+
*/
|
|
91
|
+
borderThickness?: number;
|
|
92
|
+
/**
|
|
93
|
+
* Border style of this look.
|
|
94
|
+
* @default 'solid'
|
|
86
95
|
*/
|
|
87
|
-
|
|
96
|
+
borderStyle?: LineStyle;
|
|
88
97
|
}
|
|
89
98
|
/**
|
|
90
99
|
* Configuration for a look given by an image.
|
|
@@ -201,20 +210,20 @@ export interface ConnectionLook extends Look {
|
|
|
201
210
|
* Color of the line of connections of this type.
|
|
202
211
|
* @default '#000000'
|
|
203
212
|
*/
|
|
204
|
-
color
|
|
213
|
+
color?: string;
|
|
205
214
|
/**
|
|
206
215
|
* Thickness of the line of connections of this type in diagram units.
|
|
207
216
|
* @default 1
|
|
208
217
|
*/
|
|
209
|
-
thickness
|
|
218
|
+
thickness?: number;
|
|
210
219
|
/**
|
|
211
220
|
* Shape of the line of connections of this type.
|
|
212
221
|
* @default 'straight'
|
|
213
222
|
*/
|
|
214
|
-
shape
|
|
223
|
+
shape?: LineShape | LineFunction;
|
|
215
224
|
/**
|
|
216
225
|
* Style of the line of connections of this type.
|
|
217
226
|
* @default 'solid'
|
|
218
227
|
*/
|
|
219
|
-
style
|
|
228
|
+
style?: LineStyle;
|
|
220
229
|
}
|
|
@@ -6,9 +6,13 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export declare class Property {
|
|
8
8
|
/**
|
|
9
|
-
* The name of this property. Used to distinguish this property from others.
|
|
9
|
+
* The name of this property. Used to distinguish this property from others. Must be unique.
|
|
10
10
|
*/
|
|
11
11
|
name: string;
|
|
12
|
+
/**
|
|
13
|
+
* The label of this property. Used when displaying this property to the user.
|
|
14
|
+
*/
|
|
15
|
+
label?: string;
|
|
12
16
|
/**
|
|
13
17
|
* The type of this property, which indicates the possible values that this property can have.
|
|
14
18
|
*/
|
|
@@ -20,13 +24,15 @@ export declare class Property {
|
|
|
20
24
|
defaultValue?: unknown;
|
|
21
25
|
/**
|
|
22
26
|
* Whether this property should always appear in the property editor component.
|
|
27
|
+
* @default true
|
|
23
28
|
* @see PropertyEditorComponent
|
|
24
29
|
*/
|
|
25
|
-
basic
|
|
30
|
+
basic?: boolean;
|
|
26
31
|
/**
|
|
27
32
|
* Whether the value of this property can be edited.
|
|
33
|
+
* @default true
|
|
28
34
|
*/
|
|
29
|
-
editable
|
|
35
|
+
editable?: boolean;
|
|
30
36
|
/**
|
|
31
37
|
* Which attribute of the parent component the value of this property is linked to. By default, it is not linked to any.
|
|
32
38
|
* @default undefined
|
|
@@ -44,7 +50,7 @@ export declare class Property {
|
|
|
44
50
|
* @default undefined
|
|
45
51
|
*/
|
|
46
52
|
properties?: Property[];
|
|
47
|
-
constructor(name: string, type: Type, defaultValue: unknown, basic: boolean, editable: boolean, rootAttribute?: string[] | string);
|
|
53
|
+
constructor(name: string, label: string | undefined, type: Type, defaultValue: unknown, basic: boolean | undefined, editable: boolean | undefined, rootAttribute?: string[] | string);
|
|
48
54
|
}
|
|
49
55
|
/**
|
|
50
56
|
* Each of the possible values that a property of type option can have.
|
|
@@ -177,6 +177,11 @@ export interface Canvas {
|
|
|
177
177
|
* @private
|
|
178
178
|
*/
|
|
179
179
|
initView(appendTo: HTMLElement): void;
|
|
180
|
+
/**
|
|
181
|
+
* Gets the current zoom level.
|
|
182
|
+
* @public
|
|
183
|
+
*/
|
|
184
|
+
getZoomLevel(): number;
|
|
180
185
|
/**
|
|
181
186
|
* Increases the zoom level by the given factor.
|
|
182
187
|
* @public
|
|
@@ -189,6 +194,11 @@ export interface Canvas {
|
|
|
189
194
|
* @param level A level of zoom.
|
|
190
195
|
*/
|
|
191
196
|
zoomTo(level: number): void;
|
|
197
|
+
/**
|
|
198
|
+
* Gets the current coordinates of the view.
|
|
199
|
+
* @public
|
|
200
|
+
*/
|
|
201
|
+
getViewCoordinates(): Point;
|
|
192
202
|
/**
|
|
193
203
|
* Translates the view by the given amount.
|
|
194
204
|
* @public
|