@metadev/daga 4.2.4 → 4.2.6
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
CHANGED
|
@@ -6,6 +6,18 @@ List of releases and changes.
|
|
|
6
6
|
|
|
7
7
|
## Next release Joyeuse
|
|
8
8
|
|
|
9
|
+
## v. 4.2.6
|
|
10
|
+
|
|
11
|
+
- Fix bug where editing a property with a root attribute fails in React [#323](https://github.com/metadevpro/daga/pull/323)
|
|
12
|
+
- Fix bug where nodes dragged from the palette are off center in React [#324](https://github.com/metadevpro/daga/pull/324)
|
|
13
|
+
- Adjust connection label locations [#326](https://github.com/metadevpro/daga/pull/326)
|
|
14
|
+
|
|
15
|
+
## v. 4.2.5
|
|
16
|
+
|
|
17
|
+
- 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)
|
|
18
|
+
- Enable configuring the height of the palette and property editor [#319](https://github.com/metadevpro/daga/pull/319)
|
|
19
|
+
- Correctly update the connection point of ports when pasting [#321](https://github.com/metadevpro/daga/pull/321)
|
|
20
|
+
|
|
9
21
|
## v. 4.2.4
|
|
10
22
|
|
|
11
23
|
- Enable configuring line style in shaped looks [#313](https://github.com/metadevpro/daga/pull/313)
|
package/index.cjs.js
CHANGED
|
@@ -5,20 +5,20 @@ var rxjs = require('rxjs');
|
|
|
5
5
|
var uuid = require('uuid');
|
|
6
6
|
|
|
7
7
|
function _interopNamespaceDefault(e) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
var n = Object.create(null);
|
|
9
|
+
if (e) {
|
|
10
|
+
Object.keys(e).forEach(function (k) {
|
|
11
|
+
if (k !== 'default') {
|
|
12
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
13
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () { return e[k]; }
|
|
16
|
+
});
|
|
17
|
+
}
|
|
16
18
|
});
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
n.default = e;
|
|
21
|
-
return Object.freeze(n);
|
|
19
|
+
}
|
|
20
|
+
n.default = e;
|
|
21
|
+
return Object.freeze(n);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
var d3__namespace = /*#__PURE__*/_interopNamespaceDefault(d3);
|
|
@@ -1479,6 +1479,9 @@ class ValueSet {
|
|
|
1479
1479
|
* @returns The value if it could be found, `undefined` if nothing could be found.
|
|
1480
1480
|
*/
|
|
1481
1481
|
getRootElementValue(rootAttribute) {
|
|
1482
|
+
if (!this.rootElement) {
|
|
1483
|
+
return;
|
|
1484
|
+
}
|
|
1482
1485
|
if (typeof rootAttribute === 'string') {
|
|
1483
1486
|
return this.rootElement[rootAttribute];
|
|
1484
1487
|
}
|
|
@@ -1505,6 +1508,9 @@ class ValueSet {
|
|
|
1505
1508
|
* @param value The value to set the root element's attribute to.
|
|
1506
1509
|
*/
|
|
1507
1510
|
setRootElementValue(rootAttribute, value) {
|
|
1511
|
+
if (!this.rootElement) {
|
|
1512
|
+
return;
|
|
1513
|
+
}
|
|
1508
1514
|
if (typeof rootAttribute === 'string') {
|
|
1509
1515
|
this.rootElement[rootAttribute] = value;
|
|
1510
1516
|
}
|
|
@@ -4518,7 +4524,7 @@ class DagaImporter {
|
|
|
4518
4524
|
let portCounter = 0;
|
|
4519
4525
|
for (const port of section.ports || []) {
|
|
4520
4526
|
const newPortType = port.type !== undefined ? model.ports.types.get(port.type) : undefined;
|
|
4521
|
-
const newPort = new DiagramPort(model, newPortType, newSection, port.coords, port.connectionPoint, port.direction, port.id);
|
|
4527
|
+
const newPort = new DiagramPort(model, newPortType, newSection, port.coords, port.connectionPoint || port.coords, port.direction, port.id);
|
|
4522
4528
|
newSection.ports.push(newPort);
|
|
4523
4529
|
model.ports.add(newPort);
|
|
4524
4530
|
if (port.label) {
|
|
@@ -4565,7 +4571,7 @@ class DagaImporter {
|
|
|
4565
4571
|
let portCounter = 0;
|
|
4566
4572
|
for (const port of node.ports || []) {
|
|
4567
4573
|
const newPortType = port.type !== undefined ? model.ports.types.get(port.type) : undefined;
|
|
4568
|
-
const newPort = new DiagramPort(model, newPortType, newNode, port.coords, port.connectionPoint, port.direction, port.id);
|
|
4574
|
+
const newPort = new DiagramPort(model, newPortType, newNode, port.coords, port.connectionPoint || port.coords, port.direction, port.id);
|
|
4569
4575
|
newNode.ports.push(newPort);
|
|
4570
4576
|
model.ports.add(newPort);
|
|
4571
4577
|
if (port.label) {
|
|
@@ -5800,6 +5806,9 @@ class PasteAction {
|
|
|
5800
5806
|
idRefresh[oldPortId] = port.id;
|
|
5801
5807
|
if (coordsDiff) {
|
|
5802
5808
|
port.coords = [port.coords[0] + coordsDiff[0], port.coords[1] + coordsDiff[1]];
|
|
5809
|
+
if (port.connectionPoint) {
|
|
5810
|
+
port.connectionPoint = [port.connectionPoint[0] + coordsDiff[0], port.connectionPoint[1] + coordsDiff[1]];
|
|
5811
|
+
}
|
|
5803
5812
|
}
|
|
5804
5813
|
}
|
|
5805
5814
|
}
|
|
@@ -5816,6 +5825,9 @@ class PasteAction {
|
|
|
5816
5825
|
idRefresh[oldPortId] = port.id;
|
|
5817
5826
|
if (coordsDiff) {
|
|
5818
5827
|
port.coords = [port.coords[0] + coordsDiff[0], port.coords[1] + coordsDiff[1]];
|
|
5828
|
+
if (port.connectionPoint) {
|
|
5829
|
+
port.connectionPoint = [port.connectionPoint[0] + coordsDiff[0], port.connectionPoint[1] + coordsDiff[1]];
|
|
5830
|
+
}
|
|
5819
5831
|
}
|
|
5820
5832
|
}
|
|
5821
5833
|
}
|
|
@@ -6589,7 +6601,7 @@ class DagaExporter {
|
|
|
6589
6601
|
id: port.id,
|
|
6590
6602
|
type: (_a = port.type) === null || _a === void 0 ? void 0 : _a.id,
|
|
6591
6603
|
coords: roundPoint(port.coords),
|
|
6592
|
-
connectionPoint: roundPoint(port.connectionPoint),
|
|
6604
|
+
connectionPoint: roundPoint(port.connectionPoint || port.coords),
|
|
6593
6605
|
direction: port.direction,
|
|
6594
6606
|
label: ((_b = port.label) === null || _b === void 0 ? void 0 : _b.text) || ''
|
|
6595
6607
|
}, includeCollabMeta ? {
|
|
@@ -6623,7 +6635,7 @@ class DagaExporter {
|
|
|
6623
6635
|
id: port.id,
|
|
6624
6636
|
type: (_d = port.type) === null || _d === void 0 ? void 0 : _d.id,
|
|
6625
6637
|
coords: roundPoint(port.coords),
|
|
6626
|
-
connectionPoint: roundPoint(port.connectionPoint),
|
|
6638
|
+
connectionPoint: roundPoint(port.connectionPoint || port.coords),
|
|
6627
6639
|
direction: port.direction,
|
|
6628
6640
|
label: ((_e = port.label) === null || _e === void 0 ? void 0 : _e.text) || ''
|
|
6629
6641
|
}, includeCollabMeta ? {
|
|
@@ -7301,6 +7313,9 @@ class DiagramCanvas {
|
|
|
7301
7313
|
initializeGrid(this, canvasView, this.backgroundPatternId);
|
|
7302
7314
|
canvasView.append('g').attr('class', 'daga-canvas-elements');
|
|
7303
7315
|
}
|
|
7316
|
+
getZoomLevel() {
|
|
7317
|
+
return this.zoomTransform.k;
|
|
7318
|
+
}
|
|
7304
7319
|
zoomBy(factor) {
|
|
7305
7320
|
if (!isNaN(factor)) {
|
|
7306
7321
|
this.zoomBehavior.scaleBy(this.selectCanvasView(), factor);
|
|
@@ -7311,6 +7326,9 @@ class DiagramCanvas {
|
|
|
7311
7326
|
this.zoomBehavior.scaleTo(this.selectCanvasView(), level);
|
|
7312
7327
|
}
|
|
7313
7328
|
}
|
|
7329
|
+
getViewCoordinates() {
|
|
7330
|
+
return [this.zoomTransform.x, this.zoomTransform.y];
|
|
7331
|
+
}
|
|
7314
7332
|
translateBy(x, y) {
|
|
7315
7333
|
if (!isNaN(x) && !isNaN(y)) {
|
|
7316
7334
|
this.zoomBehavior.translateBy(this.selectCanvasView(), x, y);
|
|
@@ -8371,63 +8389,60 @@ class DiagramCanvas {
|
|
|
8371
8389
|
const deltaY = connection.endCoords[1] - connection.startCoords[1];
|
|
8372
8390
|
switch (connection.startDirection) {
|
|
8373
8391
|
case exports.Side.Top:
|
|
8374
|
-
startLabelShiftX = deltaX >= 0 ?
|
|
8375
|
-
middleLabelShiftX = startLabelShiftX;
|
|
8392
|
+
startLabelShiftX = deltaX >= 0 ? -0.5 : 0.5;
|
|
8376
8393
|
endLabelShiftX = startLabelShiftX;
|
|
8377
|
-
startLabelShiftY = -
|
|
8394
|
+
startLabelShiftY = -0.5;
|
|
8378
8395
|
break;
|
|
8379
8396
|
case exports.Side.Bottom:
|
|
8380
|
-
startLabelShiftX = deltaX >= 0 ?
|
|
8381
|
-
middleLabelShiftX = startLabelShiftX;
|
|
8397
|
+
startLabelShiftX = deltaX >= 0 ? -0.5 : 0.5;
|
|
8382
8398
|
endLabelShiftX = startLabelShiftX;
|
|
8383
|
-
startLabelShiftY =
|
|
8399
|
+
startLabelShiftY = 0.5;
|
|
8384
8400
|
break;
|
|
8385
8401
|
case exports.Side.Left:
|
|
8386
|
-
startLabelShiftX = -
|
|
8387
|
-
startLabelShiftY = deltaY > 0 ?
|
|
8388
|
-
middleLabelShiftY = startLabelShiftY;
|
|
8402
|
+
startLabelShiftX = -0.5;
|
|
8403
|
+
startLabelShiftY = deltaY > 0 ? -0.5 : 0.5;
|
|
8389
8404
|
endLabelShiftY = startLabelShiftY;
|
|
8390
8405
|
break;
|
|
8391
8406
|
case exports.Side.Right:
|
|
8392
|
-
startLabelShiftX =
|
|
8393
|
-
startLabelShiftY = deltaY > 0 ?
|
|
8394
|
-
middleLabelShiftY = startLabelShiftY;
|
|
8407
|
+
startLabelShiftX = 0.5;
|
|
8408
|
+
startLabelShiftY = deltaY > 0 ? -0.5 : 0.5;
|
|
8395
8409
|
endLabelShiftY = startLabelShiftY;
|
|
8396
8410
|
break;
|
|
8397
8411
|
default:
|
|
8398
|
-
startLabelShiftX =
|
|
8399
|
-
middleLabelShiftX = startLabelShiftX;
|
|
8412
|
+
startLabelShiftX = 0.5;
|
|
8400
8413
|
endLabelShiftX = startLabelShiftX;
|
|
8401
|
-
startLabelShiftY = -
|
|
8402
|
-
middleLabelShiftY = startLabelShiftY;
|
|
8414
|
+
startLabelShiftY = -0.5;
|
|
8403
8415
|
endLabelShiftY = startLabelShiftY;
|
|
8404
8416
|
}
|
|
8405
8417
|
switch (connection.endDirection) {
|
|
8406
8418
|
case exports.Side.Top:
|
|
8407
|
-
endLabelShiftX = deltaX >= 0 ?
|
|
8408
|
-
|
|
8409
|
-
endLabelShiftY = 1;
|
|
8419
|
+
endLabelShiftX = deltaX >= 0 ? 0.5 : -0.5;
|
|
8420
|
+
endLabelShiftY = 0.5;
|
|
8410
8421
|
break;
|
|
8411
8422
|
case exports.Side.Bottom:
|
|
8412
|
-
endLabelShiftX = deltaX >= 0 ?
|
|
8413
|
-
|
|
8414
|
-
endLabelShiftY = -1;
|
|
8423
|
+
endLabelShiftX = deltaX >= 0 ? 0.5 : -0.5;
|
|
8424
|
+
endLabelShiftY = -0.5;
|
|
8415
8425
|
break;
|
|
8416
8426
|
case exports.Side.Left:
|
|
8417
|
-
endLabelShiftX = -
|
|
8418
|
-
endLabelShiftY = deltaY > 0 ?
|
|
8419
|
-
middleLabelShiftY = endLabelShiftY;
|
|
8427
|
+
endLabelShiftX = -0.5;
|
|
8428
|
+
endLabelShiftY = deltaY > 0 ? 0.5 : -0.5;
|
|
8420
8429
|
break;
|
|
8421
8430
|
case exports.Side.Right:
|
|
8422
|
-
endLabelShiftX =
|
|
8423
|
-
endLabelShiftY = deltaY > 0 ?
|
|
8424
|
-
middleLabelShiftY = endLabelShiftY;
|
|
8431
|
+
endLabelShiftX = 0.5;
|
|
8432
|
+
endLabelShiftY = deltaY > 0 ? 0.5 : -0.5;
|
|
8425
8433
|
break;
|
|
8426
8434
|
default:
|
|
8427
|
-
endLabelShiftX =
|
|
8428
|
-
|
|
8429
|
-
|
|
8430
|
-
|
|
8435
|
+
endLabelShiftX = 0.5;
|
|
8436
|
+
endLabelShiftY = -0.5;
|
|
8437
|
+
}
|
|
8438
|
+
if (Math.abs(deltaX) >= Math.abs(deltaY)) {
|
|
8439
|
+
// horizontal quadrant
|
|
8440
|
+
middleLabelShiftX = deltaX > 0 ? -0.5 : 0.5;
|
|
8441
|
+
middleLabelShiftY = deltaY > 0 ? 0.5 : -0.5;
|
|
8442
|
+
} else {
|
|
8443
|
+
// vertical quadrant
|
|
8444
|
+
middleLabelShiftX = deltaX > 0 ? 0.5 : -0.5;
|
|
8445
|
+
middleLabelShiftY = deltaY > 0 ? -0.5 : 0.5;
|
|
8431
8446
|
}
|
|
8432
8447
|
}
|
|
8433
8448
|
// bind start labels
|
package/index.esm.js
CHANGED
|
@@ -1458,6 +1458,9 @@ class ValueSet {
|
|
|
1458
1458
|
* @returns The value if it could be found, `undefined` if nothing could be found.
|
|
1459
1459
|
*/
|
|
1460
1460
|
getRootElementValue(rootAttribute) {
|
|
1461
|
+
if (!this.rootElement) {
|
|
1462
|
+
return;
|
|
1463
|
+
}
|
|
1461
1464
|
if (typeof rootAttribute === 'string') {
|
|
1462
1465
|
return this.rootElement[rootAttribute];
|
|
1463
1466
|
}
|
|
@@ -1484,6 +1487,9 @@ class ValueSet {
|
|
|
1484
1487
|
* @param value The value to set the root element's attribute to.
|
|
1485
1488
|
*/
|
|
1486
1489
|
setRootElementValue(rootAttribute, value) {
|
|
1490
|
+
if (!this.rootElement) {
|
|
1491
|
+
return;
|
|
1492
|
+
}
|
|
1487
1493
|
if (typeof rootAttribute === 'string') {
|
|
1488
1494
|
this.rootElement[rootAttribute] = value;
|
|
1489
1495
|
}
|
|
@@ -4497,7 +4503,7 @@ class DagaImporter {
|
|
|
4497
4503
|
let portCounter = 0;
|
|
4498
4504
|
for (const port of section.ports || []) {
|
|
4499
4505
|
const newPortType = port.type !== undefined ? model.ports.types.get(port.type) : undefined;
|
|
4500
|
-
const newPort = new DiagramPort(model, newPortType, newSection, port.coords, port.connectionPoint, port.direction, port.id);
|
|
4506
|
+
const newPort = new DiagramPort(model, newPortType, newSection, port.coords, port.connectionPoint || port.coords, port.direction, port.id);
|
|
4501
4507
|
newSection.ports.push(newPort);
|
|
4502
4508
|
model.ports.add(newPort);
|
|
4503
4509
|
if (port.label) {
|
|
@@ -4544,7 +4550,7 @@ class DagaImporter {
|
|
|
4544
4550
|
let portCounter = 0;
|
|
4545
4551
|
for (const port of node.ports || []) {
|
|
4546
4552
|
const newPortType = port.type !== undefined ? model.ports.types.get(port.type) : undefined;
|
|
4547
|
-
const newPort = new DiagramPort(model, newPortType, newNode, port.coords, port.connectionPoint, port.direction, port.id);
|
|
4553
|
+
const newPort = new DiagramPort(model, newPortType, newNode, port.coords, port.connectionPoint || port.coords, port.direction, port.id);
|
|
4548
4554
|
newNode.ports.push(newPort);
|
|
4549
4555
|
model.ports.add(newPort);
|
|
4550
4556
|
if (port.label) {
|
|
@@ -5779,6 +5785,9 @@ class PasteAction {
|
|
|
5779
5785
|
idRefresh[oldPortId] = port.id;
|
|
5780
5786
|
if (coordsDiff) {
|
|
5781
5787
|
port.coords = [port.coords[0] + coordsDiff[0], port.coords[1] + coordsDiff[1]];
|
|
5788
|
+
if (port.connectionPoint) {
|
|
5789
|
+
port.connectionPoint = [port.connectionPoint[0] + coordsDiff[0], port.connectionPoint[1] + coordsDiff[1]];
|
|
5790
|
+
}
|
|
5782
5791
|
}
|
|
5783
5792
|
}
|
|
5784
5793
|
}
|
|
@@ -5795,6 +5804,9 @@ class PasteAction {
|
|
|
5795
5804
|
idRefresh[oldPortId] = port.id;
|
|
5796
5805
|
if (coordsDiff) {
|
|
5797
5806
|
port.coords = [port.coords[0] + coordsDiff[0], port.coords[1] + coordsDiff[1]];
|
|
5807
|
+
if (port.connectionPoint) {
|
|
5808
|
+
port.connectionPoint = [port.connectionPoint[0] + coordsDiff[0], port.connectionPoint[1] + coordsDiff[1]];
|
|
5809
|
+
}
|
|
5798
5810
|
}
|
|
5799
5811
|
}
|
|
5800
5812
|
}
|
|
@@ -6568,7 +6580,7 @@ class DagaExporter {
|
|
|
6568
6580
|
id: port.id,
|
|
6569
6581
|
type: (_a = port.type) === null || _a === void 0 ? void 0 : _a.id,
|
|
6570
6582
|
coords: roundPoint(port.coords),
|
|
6571
|
-
connectionPoint: roundPoint(port.connectionPoint),
|
|
6583
|
+
connectionPoint: roundPoint(port.connectionPoint || port.coords),
|
|
6572
6584
|
direction: port.direction,
|
|
6573
6585
|
label: ((_b = port.label) === null || _b === void 0 ? void 0 : _b.text) || ''
|
|
6574
6586
|
}, includeCollabMeta ? {
|
|
@@ -6602,7 +6614,7 @@ class DagaExporter {
|
|
|
6602
6614
|
id: port.id,
|
|
6603
6615
|
type: (_d = port.type) === null || _d === void 0 ? void 0 : _d.id,
|
|
6604
6616
|
coords: roundPoint(port.coords),
|
|
6605
|
-
connectionPoint: roundPoint(port.connectionPoint),
|
|
6617
|
+
connectionPoint: roundPoint(port.connectionPoint || port.coords),
|
|
6606
6618
|
direction: port.direction,
|
|
6607
6619
|
label: ((_e = port.label) === null || _e === void 0 ? void 0 : _e.text) || ''
|
|
6608
6620
|
}, includeCollabMeta ? {
|
|
@@ -7280,6 +7292,9 @@ class DiagramCanvas {
|
|
|
7280
7292
|
initializeGrid(this, canvasView, this.backgroundPatternId);
|
|
7281
7293
|
canvasView.append('g').attr('class', 'daga-canvas-elements');
|
|
7282
7294
|
}
|
|
7295
|
+
getZoomLevel() {
|
|
7296
|
+
return this.zoomTransform.k;
|
|
7297
|
+
}
|
|
7283
7298
|
zoomBy(factor) {
|
|
7284
7299
|
if (!isNaN(factor)) {
|
|
7285
7300
|
this.zoomBehavior.scaleBy(this.selectCanvasView(), factor);
|
|
@@ -7290,6 +7305,9 @@ class DiagramCanvas {
|
|
|
7290
7305
|
this.zoomBehavior.scaleTo(this.selectCanvasView(), level);
|
|
7291
7306
|
}
|
|
7292
7307
|
}
|
|
7308
|
+
getViewCoordinates() {
|
|
7309
|
+
return [this.zoomTransform.x, this.zoomTransform.y];
|
|
7310
|
+
}
|
|
7293
7311
|
translateBy(x, y) {
|
|
7294
7312
|
if (!isNaN(x) && !isNaN(y)) {
|
|
7295
7313
|
this.zoomBehavior.translateBy(this.selectCanvasView(), x, y);
|
|
@@ -8350,63 +8368,60 @@ class DiagramCanvas {
|
|
|
8350
8368
|
const deltaY = connection.endCoords[1] - connection.startCoords[1];
|
|
8351
8369
|
switch (connection.startDirection) {
|
|
8352
8370
|
case Side.Top:
|
|
8353
|
-
startLabelShiftX = deltaX >= 0 ?
|
|
8354
|
-
middleLabelShiftX = startLabelShiftX;
|
|
8371
|
+
startLabelShiftX = deltaX >= 0 ? -0.5 : 0.5;
|
|
8355
8372
|
endLabelShiftX = startLabelShiftX;
|
|
8356
|
-
startLabelShiftY = -
|
|
8373
|
+
startLabelShiftY = -0.5;
|
|
8357
8374
|
break;
|
|
8358
8375
|
case Side.Bottom:
|
|
8359
|
-
startLabelShiftX = deltaX >= 0 ?
|
|
8360
|
-
middleLabelShiftX = startLabelShiftX;
|
|
8376
|
+
startLabelShiftX = deltaX >= 0 ? -0.5 : 0.5;
|
|
8361
8377
|
endLabelShiftX = startLabelShiftX;
|
|
8362
|
-
startLabelShiftY =
|
|
8378
|
+
startLabelShiftY = 0.5;
|
|
8363
8379
|
break;
|
|
8364
8380
|
case Side.Left:
|
|
8365
|
-
startLabelShiftX = -
|
|
8366
|
-
startLabelShiftY = deltaY > 0 ?
|
|
8367
|
-
middleLabelShiftY = startLabelShiftY;
|
|
8381
|
+
startLabelShiftX = -0.5;
|
|
8382
|
+
startLabelShiftY = deltaY > 0 ? -0.5 : 0.5;
|
|
8368
8383
|
endLabelShiftY = startLabelShiftY;
|
|
8369
8384
|
break;
|
|
8370
8385
|
case Side.Right:
|
|
8371
|
-
startLabelShiftX =
|
|
8372
|
-
startLabelShiftY = deltaY > 0 ?
|
|
8373
|
-
middleLabelShiftY = startLabelShiftY;
|
|
8386
|
+
startLabelShiftX = 0.5;
|
|
8387
|
+
startLabelShiftY = deltaY > 0 ? -0.5 : 0.5;
|
|
8374
8388
|
endLabelShiftY = startLabelShiftY;
|
|
8375
8389
|
break;
|
|
8376
8390
|
default:
|
|
8377
|
-
startLabelShiftX =
|
|
8378
|
-
middleLabelShiftX = startLabelShiftX;
|
|
8391
|
+
startLabelShiftX = 0.5;
|
|
8379
8392
|
endLabelShiftX = startLabelShiftX;
|
|
8380
|
-
startLabelShiftY = -
|
|
8381
|
-
middleLabelShiftY = startLabelShiftY;
|
|
8393
|
+
startLabelShiftY = -0.5;
|
|
8382
8394
|
endLabelShiftY = startLabelShiftY;
|
|
8383
8395
|
}
|
|
8384
8396
|
switch (connection.endDirection) {
|
|
8385
8397
|
case Side.Top:
|
|
8386
|
-
endLabelShiftX = deltaX >= 0 ?
|
|
8387
|
-
|
|
8388
|
-
endLabelShiftY = 1;
|
|
8398
|
+
endLabelShiftX = deltaX >= 0 ? 0.5 : -0.5;
|
|
8399
|
+
endLabelShiftY = 0.5;
|
|
8389
8400
|
break;
|
|
8390
8401
|
case Side.Bottom:
|
|
8391
|
-
endLabelShiftX = deltaX >= 0 ?
|
|
8392
|
-
|
|
8393
|
-
endLabelShiftY = -1;
|
|
8402
|
+
endLabelShiftX = deltaX >= 0 ? 0.5 : -0.5;
|
|
8403
|
+
endLabelShiftY = -0.5;
|
|
8394
8404
|
break;
|
|
8395
8405
|
case Side.Left:
|
|
8396
|
-
endLabelShiftX = -
|
|
8397
|
-
endLabelShiftY = deltaY > 0 ?
|
|
8398
|
-
middleLabelShiftY = endLabelShiftY;
|
|
8406
|
+
endLabelShiftX = -0.5;
|
|
8407
|
+
endLabelShiftY = deltaY > 0 ? 0.5 : -0.5;
|
|
8399
8408
|
break;
|
|
8400
8409
|
case Side.Right:
|
|
8401
|
-
endLabelShiftX =
|
|
8402
|
-
endLabelShiftY = deltaY > 0 ?
|
|
8403
|
-
middleLabelShiftY = endLabelShiftY;
|
|
8410
|
+
endLabelShiftX = 0.5;
|
|
8411
|
+
endLabelShiftY = deltaY > 0 ? 0.5 : -0.5;
|
|
8404
8412
|
break;
|
|
8405
8413
|
default:
|
|
8406
|
-
endLabelShiftX =
|
|
8407
|
-
|
|
8408
|
-
|
|
8409
|
-
|
|
8414
|
+
endLabelShiftX = 0.5;
|
|
8415
|
+
endLabelShiftY = -0.5;
|
|
8416
|
+
}
|
|
8417
|
+
if (Math.abs(deltaX) >= Math.abs(deltaY)) {
|
|
8418
|
+
// horizontal quadrant
|
|
8419
|
+
middleLabelShiftX = deltaX > 0 ? -0.5 : 0.5;
|
|
8420
|
+
middleLabelShiftY = deltaY > 0 ? 0.5 : -0.5;
|
|
8421
|
+
} else {
|
|
8422
|
+
// vertical quadrant
|
|
8423
|
+
middleLabelShiftX = deltaX > 0 ? 0.5 : -0.5;
|
|
8424
|
+
middleLabelShiftY = deltaY > 0 ? -0.5 : 0.5;
|
|
8410
8425
|
}
|
|
8411
8426
|
}
|
|
8412
8427
|
// bind start labels
|
package/package.json
CHANGED
|
@@ -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.
|
|
@@ -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
|