devexpress-diagram 2.1.76 → 2.1.77

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.
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * DevExpress Diagram (dx-diagram)
3
- * Version: 2.1.76
4
- * Build date: Wed Jul 26 2023
3
+ * Version: 2.1.77
4
+ * Build date: Tue Aug 08 2023
5
5
  *
6
6
  * Copyright (c) 2012 - 2023 Developer Express Inc. ALL RIGHTS RESERVED
7
7
  * Read about DevExpress licensing here: https://www.devexpress.com/Support/EULAs
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * DevExpress Diagram (dx-diagram)
3
- * Version: 2.1.76
4
- * Build date: Wed Jul 26 2023
3
+ * Version: 2.1.77
4
+ * Build date: Tue Aug 08 2023
5
5
  *
6
6
  * Copyright (c) 2012 - 2023 Developer Express Inc. ALL RIGHTS RESERVED
7
7
  * Read about DevExpress licensing here: https://www.devexpress.com/Support/EULAs
@@ -505,6 +505,9 @@ exports.Utils = Utils;
505
505
  var GeometryUtils = (function () {
506
506
  function GeometryUtils() {
507
507
  }
508
+ GeometryUtils.arePointsOfOrthogonalLine = function (point1, point2, isHorizontal) {
509
+ return isHorizontal ? (point1.y === point2.y) : (point1.x === point2.x);
510
+ };
508
511
  GeometryUtils.getCommonRectangle = function (rects) {
509
512
  if (!rects.length)
510
513
  return new rectangle_1.Rectangle(0, 0, 0, 0);
@@ -779,9 +782,9 @@ var GeometryUtils = (function () {
779
782
  while ((point = points[index]) && points.length > 2) {
780
783
  var nextPoint = this.getNextPoint(points, index, 1, checkCallback);
781
784
  var prevPoint = this.getNextPoint(points, index, -1, checkCallback);
782
- if (!prevPoint || !nextPoint ||
783
- GeometryUtils.isCorner(prevPoint, point, nextPoint, accuracy) ||
784
- !removeCallback(point, index))
785
+ if (!prevPoint || !nextPoint || GeometryUtils.isCorner(prevPoint, point, nextPoint, accuracy))
786
+ index++;
787
+ else if (!removeCallback(point, index))
785
788
  index++;
786
789
  }
787
790
  };
@@ -1269,27 +1272,13 @@ var ModelUtils = (function () {
1269
1272
  history.addAndRedo(new AddConnectionHistoryItem_1.SetConnectionPointIndexHistoryItem(connector, endConnectionPointIndex, Connector_1.ConnectorPosition.End));
1270
1273
  }
1271
1274
  };
1272
- ModelUtils.skipUnnecessaryRenderPoints = function (points) {
1273
- var clonedPoints = points.map(function (p) { return p.clone(); });
1274
- ModelUtils.removeUnnecessaryRenderPoints(clonedPoints);
1275
- points.forEach(function (p) { return p.skipped = clonedPoints.some(function (cp) { return cp.skipped && cp.equals(p); }); });
1275
+ ModelUtils.skipUnnecessaryRenderPoints = function (points, removeExcessPoints) {
1276
+ Utils_1.GeometryUtils.removeUnnecessaryPoints(points, function (pt, index) { return ModelUtils.removeUnnecessaryPoint(points, pt, index, removeExcessPoints); }, function (pt) { return pt !== undefined && !pt.skipped; });
1276
1277
  points[0].skipped = false;
1277
1278
  points[points.length - 1].skipped = false;
1278
1279
  };
1279
- ModelUtils.skipUnnecessaryRightAngleRenderPoints = function (points) {
1280
- var clonedPoints = points.map(function (p) { return p.clone(); });
1281
- ModelUtils.removeUnnecessaryRightAngleRenderPoints(clonedPoints);
1282
- points.forEach(function (p) { return p.skipped = clonedPoints.some(function (cp) { return cp.skipped && cp.equals(p); }); });
1283
- points[0].skipped = false;
1284
- points[points.length - 1].skipped = false;
1285
- };
1286
- ModelUtils.removeUnnecessaryRenderPoints = function (points) {
1287
- Utils_1.GeometryUtils.removeUnnecessaryPoints(points, function (pt, index) { return ModelUtils.removeUnnecessaryPoint(points, pt, index); }, function (pt) { return pt !== undefined && !pt.skipped; });
1288
- points[0].skipped = false;
1289
- points[points.length - 1].skipped = false;
1290
- };
1291
- ModelUtils.removeUnnecessaryRightAngleRenderPoints = function (points) {
1292
- Utils_1.GeometryUtils.removeUnnecessaryRightAnglePoints(points, function (p, index) { return ModelUtils.removeUnnecessaryPoint(points, p, index); }, function (p) { return p !== undefined && !p.skipped; });
1280
+ ModelUtils.skipUnnecessaryRightAngleRenderPoints = function (points, removeExcessPoints) {
1281
+ Utils_1.GeometryUtils.removeUnnecessaryRightAnglePoints(points, function (p, index) { return ModelUtils.removeUnnecessaryPoint(points, p, index, removeExcessPoints); }, function (p) { return p !== undefined && !p.skipped; });
1293
1282
  points[0].skipped = false;
1294
1283
  points[points.length - 1].skipped = false;
1295
1284
  };
@@ -1349,8 +1338,8 @@ var ModelUtils = (function () {
1349
1338
  }
1350
1339
  return true;
1351
1340
  };
1352
- ModelUtils.removeUnnecessaryPoint = function (points, point, removedIndex) {
1353
- if (point.pointIndex === -1) {
1341
+ ModelUtils.removeUnnecessaryPoint = function (points, point, removedIndex, removeExcessPoints) {
1342
+ if (removeExcessPoints && point.pointIndex === -1) {
1354
1343
  points.splice(removedIndex, 1);
1355
1344
  return true;
1356
1345
  }
@@ -1372,10 +1361,10 @@ var ModelUtils = (function () {
1372
1361
  return i;
1373
1362
  return -1;
1374
1363
  };
1375
- ModelUtils.moveConnectorRightAnglePoints = function (history, connector, firstPoint, firstPointIndex, lastPoint, lastPointIndex) {
1376
- if (!Utils_1.GeometryUtils.areDuplicatedPoints(connector.points[firstPointIndex], firstPoint) ||
1377
- !Utils_1.GeometryUtils.areDuplicatedPoints(connector.points[lastPointIndex], lastPoint))
1378
- history.addAndRedo(new MoveConnectorPointHistoryItem_1.MoveConnectorRightAnglePointsHistoryItem(connector.key, firstPointIndex, firstPoint, lastPointIndex, lastPoint));
1364
+ ModelUtils.moveConnectorRightAnglePoints = function (history, connector, firstPointIndex, lastPointIndex, newX, newY) {
1365
+ if (!connector.points.slice(firstPointIndex, lastPointIndex + 1).some(function (p) { return !Utils_1.GeometryUtils.areDuplicatedPoints(p, new point_1.Point(newX === undefined ? p.x : newX, newY === undefined ? p.y : newY)); }))
1366
+ return;
1367
+ history.addAndRedo(new MoveConnectorPointHistoryItem_1.MoveConnectorRightAnglePointsHistoryItem(connector.key, firstPointIndex, lastPointIndex, newX, newY));
1379
1368
  };
1380
1369
  ModelUtils.moveConnectorPoint = function (history, connector, pointIndex, newPosition) {
1381
1370
  if (!connector.points[pointIndex].equals(newPosition)) {
@@ -2428,22 +2417,19 @@ var Connector = (function (_super) {
2428
2417
  if (keepSkipped === void 0) { keepSkipped = false; }
2429
2418
  if (this.shouldInvalidateRenderPoints === undefined || this.shouldInvalidateRenderPoints) {
2430
2419
  this.shouldInvalidateRenderPoints = false;
2431
- if (!this.routingStrategy)
2420
+ if (!this.routingStrategy || !this.lockCreateRenderPoints)
2432
2421
  this.changeRenderPoints(this.getCalculator().getPoints());
2433
- else if (!this.lockCreateRenderPoints) {
2434
- this.changeRenderPoints(new ConnectorPointsOrthogonalCalculator_1.ConnectorPointsOrthogonalCalculator(this).getPoints());
2435
- if (this.actualRoutingMode !== Settings_1.ConnectorRoutingMode.None && this.points && this.renderPoints) {
2436
- var beginPoint = this.points[0];
2437
- var endPoint = this.points[this.points.length - 1];
2438
- if (!beginPoint.equals(endPoint)) {
2439
- var newRenderPoints = this.routingStrategy.createRenderPoints(this.points, this.renderPoints, this.beginItem, this.endItem, this.beginConnectionPointIndex, this.endConnectionPointIndex, ModelUtils_1.ModelUtils.getConnectorContainer(this));
2440
- if (newRenderPoints) {
2441
- this.changeRenderPoints(newRenderPoints);
2442
- this.actualRoutingMode = Settings_1.ConnectorRoutingMode.AllShapesOnly;
2443
- }
2444
- else
2445
- this.actualRoutingMode = Settings_1.ConnectorRoutingMode.None;
2422
+ if (this.routingStrategy && !this.lockCreateRenderPoints && this.actualRoutingMode !== Settings_1.ConnectorRoutingMode.None && this.points && this.renderPoints) {
2423
+ var beginPoint = this.points[0];
2424
+ var endPoint = this.points[this.points.length - 1];
2425
+ if (!beginPoint.equals(endPoint)) {
2426
+ var newRenderPoints = this.routingStrategy.createRenderPoints(this.points, this.renderPoints, this.beginItem, this.endItem, this.beginConnectionPointIndex, this.endConnectionPointIndex, ModelUtils_1.ModelUtils.getConnectorContainer(this));
2427
+ if (newRenderPoints) {
2428
+ this.changeRenderPoints(newRenderPoints);
2429
+ this.actualRoutingMode = Settings_1.ConnectorRoutingMode.AllShapesOnly;
2446
2430
  }
2431
+ else
2432
+ this.actualRoutingMode = Settings_1.ConnectorRoutingMode.None;
2447
2433
  }
2448
2434
  }
2449
2435
  }
@@ -2492,11 +2478,11 @@ var Connector = (function (_super) {
2492
2478
  else
2493
2479
  this.invalidateRenderPoints();
2494
2480
  };
2495
- Connector.prototype.onMovePoints = function (beginPointIndex, beginPoint, lastPointIndex, lastPoint) {
2481
+ Connector.prototype.onMovePoints = function (beginPointIndex, lastPointIndex, points) {
2496
2482
  if (this.shouldChangeRenderPoints) {
2497
2483
  if (beginPointIndex === 0 || lastPointIndex === this.points.length - 1)
2498
2484
  this.lockCreateRenderPoints = false;
2499
- this.replaceRenderPointsCore(this.routingStrategy.onMovePoints(this.points, beginPointIndex, beginPoint, lastPointIndex, lastPoint, this.renderPoints), this.lockCreateRenderPoints, Settings_1.ConnectorRoutingMode.AllShapesOnly);
2485
+ this.replaceRenderPointsCore(this.routingStrategy.onMovePoints(this.points, beginPointIndex, lastPointIndex, points, this.renderPoints), this.lockCreateRenderPoints, Settings_1.ConnectorRoutingMode.AllShapesOnly);
2500
2486
  }
2501
2487
  else
2502
2488
  this.invalidateRenderPoints();
@@ -18957,10 +18943,11 @@ var CanvasSelectionManager = (function (_super) {
18957
18943
  };
18958
18944
  CanvasSelectionManager.prototype.getOrCreateConnectorSelection = function (connector, usedItems) {
18959
18945
  var element = this.selectionMap[connector.key];
18960
- var points = connector.getRenderPoints();
18946
+ var points = connector.getRenderPoints(true);
18947
+ var pointsNonSkipped = connector.getRenderPoints(false);
18961
18948
  if (!element) {
18962
18949
  element = new ConnectorSelectionElement(this.itemSelectionContainer, this.selectionMarksContainer, this.actualZoom, this.readOnly, this.dom, connector.key, connector.isLocked, connector.rectangle, points, connector.style, connector.styleText, connector.enableText, connector.texts.map(function (t) {
18963
- var textInfo = Utils_2.GeometryUtils.getPathPointByPosition(points, t.position);
18950
+ var textInfo = Utils_2.GeometryUtils.getPathPointByPosition(pointsNonSkipped, t.position);
18964
18951
  return {
18965
18952
  text: connector.getText(t.position),
18966
18953
  point: textInfo[0],
@@ -18993,10 +18980,11 @@ var CanvasSelectionManager = (function (_super) {
18993
18980
  };
18994
18981
  CanvasSelectionManager.prototype.updateConnectorSelection = function (connector, multipleSelection) {
18995
18982
  if (connector.key in this.selectionMap) {
18996
- var renderPoints_1 = connector.getRenderPoints();
18983
+ var renderPoints = connector.getRenderPoints(true);
18984
+ var renderPointsNonSkipped_1 = connector.getRenderPoints(false);
18997
18985
  this.getOrCreateConnectorSelection(connector)
18998
- .onModelChanged(connector.isLocked, connector.rectangle, renderPoints_1, connector.style, connector.styleText, connector.enableText, connector.texts.map(function (t) {
18999
- var textPos = Utils_2.GeometryUtils.getPathPointByPosition(renderPoints_1, t.position);
18986
+ .onModelChanged(connector.isLocked, connector.rectangle, renderPoints, connector.style, connector.styleText, connector.enableText, connector.texts.map(function (t) {
18987
+ var textPos = Utils_2.GeometryUtils.getPathPointByPosition(renderPointsNonSkipped_1, t.position);
19000
18988
  return {
19001
18989
  text: connector.getText(t.position),
19002
18990
  pointIndex: textPos[1],
@@ -19529,11 +19517,10 @@ var ConnectorSelectionElement = (function (_super) {
19529
19517
  };
19530
19518
  ConnectorSelectionElement.prototype.createNotSkippedRenderPoints = function () {
19531
19519
  var clonedRenderPoints = this.renderPoints.map(function (p) { return p.clone(); });
19532
- if (this.lineType === ConnectorProperties_1.ConnectorLineOption.Straight) {
19533
- ModelUtils_1.ModelUtils.removeUnnecessaryRenderPoints(clonedRenderPoints);
19534
- return clonedRenderPoints.filter(function (p) { return !p.skipped; });
19535
- }
19536
- ModelUtils_1.ModelUtils.removeUnnecessaryRightAngleRenderPoints(clonedRenderPoints);
19520
+ if (this.lineType === ConnectorProperties_1.ConnectorLineOption.Straight)
19521
+ ModelUtils_1.ModelUtils.skipUnnecessaryRenderPoints(clonedRenderPoints);
19522
+ else
19523
+ ModelUtils_1.ModelUtils.skipUnnecessaryRightAngleRenderPoints(clonedRenderPoints);
19537
19524
  return clonedRenderPoints.filter(function (p) { return !p.skipped; });
19538
19525
  };
19539
19526
  ConnectorSelectionElement.prototype.getSelectionOffset = function (strokeWidthPx) {
@@ -21221,7 +21208,7 @@ var ConnectorPointsOrthogonalCalculator = (function (_super) {
21221
21208
  });
21222
21209
  ConnectorPointsOrthogonalCalculator.prototype.getPoints = function () {
21223
21210
  var points = this.connector.points.map(function (pt, index) { return new ConnectorRenderPoint_1.ConnectorRenderPoint(pt.x, pt.y, index); });
21224
- ModelUtils_1.ModelUtils.removeUnnecessaryRenderPoints(points);
21211
+ ModelUtils_1.ModelUtils.skipUnnecessaryRenderPoints(points, true);
21225
21212
  var beginIndex = 0;
21226
21213
  var endIndex = points.length - 1;
21227
21214
  var beginSide = this.getPointSide(points, 0);
@@ -21255,7 +21242,7 @@ var ConnectorPointsOrthogonalCalculator = (function (_super) {
21255
21242
  });
21256
21243
  this.addMiddlePoints(points, beginIndex, endIndex);
21257
21244
  }
21258
- ModelUtils_1.ModelUtils.removeUnnecessaryRenderPoints(points);
21245
+ ModelUtils_1.ModelUtils.skipUnnecessaryRenderPoints(points, true);
21259
21246
  return points;
21260
21247
  };
21261
21248
  ConnectorPointsOrthogonalCalculator.prototype.getSideCalculator = function (side) {
@@ -22561,6 +22548,7 @@ var __extends = (this && this.__extends) || (function () {
22561
22548
  })();
22562
22549
  Object.defineProperty(exports, "__esModule", { value: true });
22563
22550
  exports.MoveConnectorRightAnglePointsHistoryItem = exports.MoveConnectorPointHistoryItem = void 0;
22551
+ var point_1 = __webpack_require__(0);
22564
22552
  var HistoryItem_1 = __webpack_require__(8);
22565
22553
  var MoveConnectorPointHistoryItem = (function (_super) {
22566
22554
  __extends(MoveConnectorPointHistoryItem, _super);
@@ -22594,33 +22582,37 @@ var MoveConnectorPointHistoryItem = (function (_super) {
22594
22582
  exports.MoveConnectorPointHistoryItem = MoveConnectorPointHistoryItem;
22595
22583
  var MoveConnectorRightAnglePointsHistoryItem = (function (_super) {
22596
22584
  __extends(MoveConnectorRightAnglePointsHistoryItem, _super);
22597
- function MoveConnectorRightAnglePointsHistoryItem(connectorKey, beginPointIndex, newBeginPoint, lastPointIndex, newLastPoint) {
22585
+ function MoveConnectorRightAnglePointsHistoryItem(connectorKey, beginPointIndex, lastPointIndex, newX, newY) {
22598
22586
  var _this = _super.call(this) || this;
22599
22587
  _this.connectorKey = connectorKey;
22600
22588
  _this.beginPointIndex = beginPointIndex;
22601
- _this.newBeginPoint = newBeginPoint;
22602
22589
  _this.lastPointIndex = lastPointIndex;
22603
- _this.newLastPoint = newLastPoint;
22590
+ _this.newX = newX;
22591
+ _this.newY = newY;
22592
+ _this.oldPoints = [];
22604
22593
  return _this;
22605
22594
  }
22606
22595
  MoveConnectorRightAnglePointsHistoryItem.prototype.redo = function (manipulator) {
22607
22596
  var _this = this;
22608
22597
  var connector = manipulator.model.findConnector(this.connectorKey);
22609
- this.oldBeginPoint = connector.points[this.beginPointIndex].clone();
22610
- this.oldLastPoint = connector.points[this.lastPointIndex].clone();
22611
22598
  this.renderContext = connector.tryCreateRenderPointsContext();
22599
+ this.oldPoints = connector.points.slice(this.beginPointIndex, this.lastPointIndex + 1).map(function (p) { return p.clone(); });
22600
+ var points = [];
22612
22601
  manipulator.changeConnectorPoints(connector, function (connector) {
22613
- connector.movePoint(_this.beginPointIndex, _this.newBeginPoint);
22614
- connector.movePoint(_this.lastPointIndex, _this.newLastPoint);
22615
- connector.onMovePoints(_this.beginPointIndex, _this.newBeginPoint, _this.lastPointIndex, _this.newLastPoint);
22602
+ for (var i = _this.beginPointIndex; i <= _this.lastPointIndex; i++) {
22603
+ var newPoint = new point_1.Point(_this.newX === undefined ? connector.points[i].x : _this.newX, _this.newY === undefined ? connector.points[i].y : _this.newY);
22604
+ points.push(newPoint);
22605
+ connector.movePoint(i, newPoint);
22606
+ }
22607
+ connector.onMovePoints(_this.beginPointIndex, _this.lastPointIndex, points);
22616
22608
  });
22617
22609
  };
22618
22610
  MoveConnectorRightAnglePointsHistoryItem.prototype.undo = function (manipulator) {
22619
22611
  var _this = this;
22620
22612
  var connector = manipulator.model.findConnector(this.connectorKey);
22621
22613
  manipulator.changeConnectorPoints(connector, function (connector) {
22622
- connector.movePoint(_this.beginPointIndex, _this.oldBeginPoint);
22623
- connector.movePoint(_this.lastPointIndex, _this.oldLastPoint);
22614
+ for (var i = _this.beginPointIndex; i <= _this.lastPointIndex; i++)
22615
+ connector.movePoint(i, _this.oldPoints[i - _this.beginPointIndex]);
22624
22616
  connector.replaceRenderPoints(_this.renderContext);
22625
22617
  });
22626
22618
  };
@@ -32048,116 +32040,107 @@ var Connector_1 = __webpack_require__(6);
32048
32040
  var DiagramItem_1 = __webpack_require__(9);
32049
32041
  var ModelUtils_1 = __webpack_require__(4);
32050
32042
  var MouseHandlerDraggingState_1 = __webpack_require__(34);
32043
+ var Utils_1 = __webpack_require__(3);
32051
32044
  var MouseHandlerMoveConnectorOrthogonalSideState = (function (_super) {
32052
32045
  __extends(MouseHandlerMoveConnectorOrthogonalSideState, _super);
32053
32046
  function MouseHandlerMoveConnectorOrthogonalSideState(handler, history, model) {
32054
32047
  var _this = _super.call(this, handler, history) || this;
32055
32048
  _this.model = model;
32049
+ _this.canCreatePoints = true;
32056
32050
  return _this;
32057
32051
  }
32052
+ MouseHandlerMoveConnectorOrthogonalSideState.prototype.saveSidePoints = function (markLeftRenderPointIndex, markRightRenderPointIndex) {
32053
+ var _this = this;
32054
+ var renderPoints = this.connector.getRenderPoints(true);
32055
+ this.isHorizontal = renderPoints[markLeftRenderPointIndex].y === renderPoints[markRightRenderPointIndex].y;
32056
+ this.iterateRenderPoints(renderPoints, markLeftRenderPointIndex, false, function (pt, i) {
32057
+ if (pt.pointIndex !== -1)
32058
+ _this.leftPointIndex = pt.pointIndex;
32059
+ _this.leftRenderPointIndex = i;
32060
+ }, function (pt) { return !Utils_1.GeometryUtils.arePointsOfOrthogonalLine(renderPoints[markLeftRenderPointIndex], pt, _this.isHorizontal); });
32061
+ this.iterateRenderPoints(renderPoints, this.leftRenderPointIndex, true, function (pt, i) {
32062
+ if (pt.pointIndex !== -1)
32063
+ _this.rightPointIndex = pt.pointIndex;
32064
+ _this.rightRenderPointIndex = i;
32065
+ }, function (pt) { return !Utils_1.GeometryUtils.arePointsOfOrthogonalLine(renderPoints[markLeftRenderPointIndex], pt, _this.isHorizontal); });
32066
+ };
32067
+ MouseHandlerMoveConnectorOrthogonalSideState.prototype.iterateRenderPoints = function (renderPoints, startIndex, direction, callback, stopPredicate) {
32068
+ for (var i = startIndex; direction ? i < renderPoints.length : i >= 0; direction ? i++ : i--) {
32069
+ var point = renderPoints[i];
32070
+ if (stopPredicate && stopPredicate(point, i))
32071
+ break;
32072
+ callback(point, i);
32073
+ }
32074
+ };
32058
32075
  MouseHandlerMoveConnectorOrthogonalSideState.prototype.onMouseDown = function (evt) {
32059
32076
  this.startPoint = evt.modelPoint;
32060
32077
  this.connector = this.model.findConnector(evt.source.key);
32061
32078
  this.handler.addInteractingItem(this.connector);
32062
32079
  var renderPointIndexes = evt.source.value.split("_");
32063
- var renderPointIndex1 = parseInt(renderPointIndexes[0]);
32064
- var renderPointIndex2 = parseInt(renderPointIndexes[1]);
32065
- var points = this.connector.getRenderPoints(true);
32066
- this.renderPoint1 = points[renderPointIndex1].clone();
32067
- this.renderPoint2 = points[renderPointIndex2].clone();
32068
- this.isVerticalOrientation = this.renderPoint1.x === this.renderPoint2.x;
32069
- if (this.renderPoint1.pointIndex !== -1) {
32070
- this.pointIndex1 = this.renderPoint1.pointIndex;
32071
- if (this.pointIndex1 === 0) {
32072
- this.pointIndex1++;
32073
- this.correctEdgePoint(this.renderPoint1, this.renderPoint2, this.connector.beginItem, this.connector.beginConnectionPointIndex);
32074
- }
32075
- else
32076
- this.point1 = this.connector.points[this.pointIndex1].clone();
32077
- }
32078
- else
32079
- this.pointIndex1 = this.findPointIndex(points, renderPointIndex1, false) + 1;
32080
- if (this.renderPoint2.pointIndex !== -1) {
32081
- this.pointIndex2 = this.renderPoint2.pointIndex;
32082
- if (this.pointIndex2 === this.connector.points.length - 1)
32083
- this.correctEdgePoint(this.renderPoint2, this.renderPoint1, this.connector.endItem, this.connector.endConnectionPointIndex);
32084
- else
32085
- this.point2 = this.connector.points[this.pointIndex2].clone();
32086
- }
32087
- else
32088
- this.pointIndex2 = this.findPointIndex(points, renderPointIndex2, true);
32080
+ this.saveSidePoints(parseInt(renderPointIndexes[0]), parseInt(renderPointIndexes[1]));
32089
32081
  _super.prototype.onMouseDown.call(this, evt);
32090
32082
  };
32083
+ MouseHandlerMoveConnectorOrthogonalSideState.prototype.shouldCreatePoint = function (isLeft) {
32084
+ if (!this.canCreatePoints)
32085
+ return false;
32086
+ if (isLeft && (this.leftPointIndex === undefined || this.leftPointIndex === 0))
32087
+ return true;
32088
+ if (!isLeft && (this.rightPointIndex === undefined || this.rightPointIndex === this.connector.points.length - 1))
32089
+ return true;
32090
+ var renderPoints = this.connector.getRenderPoints(true);
32091
+ if (isLeft && !this.connector.points[this.leftPointIndex].equals(renderPoints[this.leftRenderPointIndex]))
32092
+ return true;
32093
+ if (!isLeft && !this.connector.points[this.rightPointIndex].equals(renderPoints[this.rightRenderPointIndex]))
32094
+ return true;
32095
+ return false;
32096
+ };
32091
32097
  MouseHandlerMoveConnectorOrthogonalSideState.prototype.onApplyChanges = function (evt) {
32092
32098
  var _this = this;
32093
- if (!this.pointCreated) {
32094
- var createdPoint1 = void 0;
32095
- var createdPoint2 = void 0;
32096
- if (this.point1 === undefined) {
32097
- this.point1 = new point_1.Point(this.renderPoint1.x, this.renderPoint1.y);
32098
- ModelUtils_1.ModelUtils.addConnectorPoint(this.history, this.connector.key, this.pointIndex1, this.point1.clone());
32099
- createdPoint1 = this.point1.clone();
32100
- this.pointIndex2++;
32101
- }
32102
- if (this.point2 === undefined) {
32103
- this.point2 = new point_1.Point(this.renderPoint2.x, this.renderPoint2.y);
32104
- ModelUtils_1.ModelUtils.addConnectorPoint(this.history, this.connector.key, this.pointIndex2, this.point2.clone());
32105
- createdPoint2 = this.point2.clone();
32106
- }
32107
- var excludePoints = [];
32108
- if (createdPoint1)
32109
- excludePoints.push(createdPoint1);
32110
- if (createdPoint2)
32111
- excludePoints.push(createdPoint2);
32112
- var unnecessaryPoints = this.createUnnecessaryPoints(this.connector, excludePoints);
32113
- Object.keys(unnecessaryPoints).forEach(function (key) {
32114
- var pointIndex = parseInt(key);
32115
- if (pointIndex < _this.pointIndex1)
32116
- _this.pointIndex1--;
32117
- if (pointIndex < _this.pointIndex2)
32118
- _this.pointIndex2--;
32119
- });
32120
- this.pointCreated = true;
32099
+ if (this.shouldCreatePoint(true) || this.shouldCreatePoint(false)) {
32100
+ var renderPoints = this.connector.getRenderPoints(true);
32101
+ var leftRenderPoint = renderPoints[this.leftRenderPointIndex];
32102
+ var rightRenderPoint = renderPoints[this.rightRenderPointIndex];
32103
+ if (this.shouldCreatePoint(true)) {
32104
+ var leftPoint = new point_1.Point(leftRenderPoint.x, leftRenderPoint.y);
32105
+ if (this.leftPointIndex === 0) {
32106
+ this.leftPointIndex = 1;
32107
+ this.correctEdgePoint(leftPoint, rightRenderPoint, this.connector.beginItem, this.connector.beginConnectionPointIndex);
32108
+ }
32109
+ else if (this.leftPointIndex === undefined)
32110
+ this.iterateRenderPoints(renderPoints, this.leftRenderPointIndex, true, function (pt) {
32111
+ if (pt.pointIndex !== -1)
32112
+ _this.leftPointIndex = pt.pointIndex;
32113
+ }, function () { return _this.leftPointIndex !== undefined; });
32114
+ ModelUtils_1.ModelUtils.addConnectorPoint(this.history, this.connector.key, this.leftPointIndex, leftPoint);
32115
+ if (this.rightPointIndex !== undefined)
32116
+ this.rightPointIndex++;
32117
+ }
32118
+ if (this.shouldCreatePoint(false)) {
32119
+ renderPoints = this.connector.getRenderPoints(true);
32120
+ var rightPoint = new point_1.Point(rightRenderPoint.x, rightRenderPoint.y);
32121
+ if (this.rightPointIndex === this.connector.points.length - 1) {
32122
+ this.correctEdgePoint(rightPoint, leftRenderPoint, this.connector.endItem, this.connector.endConnectionPointIndex);
32123
+ this.rightPointIndex--;
32124
+ }
32125
+ else if (this.rightPointIndex === undefined)
32126
+ this.iterateRenderPoints(renderPoints, this.rightRenderPointIndex, false, function (pt) {
32127
+ if (pt.pointIndex !== -1)
32128
+ _this.rightPointIndex = pt.pointIndex;
32129
+ }, function () { return _this.rightPointIndex === _this.leftPointIndex; });
32130
+ this.rightPointIndex++;
32131
+ ModelUtils_1.ModelUtils.addConnectorPoint(this.history, this.connector.key, this.rightPointIndex, rightPoint);
32132
+ }
32121
32133
  }
32134
+ this.canCreatePoints = false;
32122
32135
  var point = this.getSnappedPoint(evt, evt.modelPoint);
32123
- if (this.isVerticalOrientation) {
32124
- this.point1.x = point.x;
32125
- this.point2.x = point.x;
32126
- }
32127
- else {
32128
- this.point1.y = point.y;
32129
- this.point2.y = point.y;
32130
- }
32131
- ModelUtils_1.ModelUtils.moveConnectorRightAnglePoints(this.history, this.connector, this.point1.clone(), this.pointIndex1, this.point2.clone(), this.pointIndex2);
32136
+ ModelUtils_1.ModelUtils.moveConnectorRightAnglePoints(this.history, this.connector, this.leftPointIndex, this.rightPointIndex, this.isHorizontal ? undefined : point.x, this.isHorizontal ? point.y : undefined);
32132
32137
  this.handler.tryUpdateModelSize();
32133
32138
  };
32134
- MouseHandlerMoveConnectorOrthogonalSideState.prototype.createUnnecessaryPoints = function (connector, excludePoints) {
32135
- var oldRenderPoints = connector.getRenderPoints(true).map(function (p) { return p.clone(); });
32136
- var unnecessaryRenderPoints = ModelUtils_1.ModelUtils.createUnnecessaryRenderPoints(oldRenderPoints.filter(function (p) { return !p.skipped; }).map(function (p) { return p.clone(); }), connector.skippedRenderPoints, function (removedPoint) { return ModelUtils_1.ModelUtils.findFirstPointIndex(oldRenderPoints, function (p) { return p.equals(removedPoint); }); }, function (p) { return !excludePoints.some(function (ep) { return ep.equals(p); }); });
32137
- var result = {};
32138
- if (Object.keys(unnecessaryRenderPoints).length) {
32139
- var points = connector.points.map(function (p) { return p.clone(); });
32140
- var lastPointIndex_1 = points.length - 1;
32141
- points.forEach(function (p, index) {
32142
- if (index !== 0 && index !== lastPointIndex_1 && !ModelUtils_1.ModelUtils.isNecessaryPoint(p, index, unnecessaryRenderPoints))
32143
- result[index] = p;
32144
- });
32145
- }
32146
- return result;
32147
- };
32148
32139
  MouseHandlerMoveConnectorOrthogonalSideState.prototype.onFinishWithChanges = function () {
32149
32140
  ModelUtils_1.ModelUtils.deleteConnectorUnnecessaryPoints(this.history, this.connector);
32150
32141
  ModelUtils_1.ModelUtils.fixConnectorBeginEndConnectionIndex(this.history, this.connector);
32151
32142
  this.handler.tryUpdateModelSize();
32152
32143
  };
32153
- MouseHandlerMoveConnectorOrthogonalSideState.prototype.findPointIndex = function (points, index, direction) {
32154
- var point;
32155
- while (point = points[index]) {
32156
- if (point.pointIndex !== -1)
32157
- return point.pointIndex;
32158
- index += direction ? 1 : -1;
32159
- }
32160
- };
32161
32144
  MouseHandlerMoveConnectorOrthogonalSideState.prototype.correctEdgePoint = function (point, directionPoint, item, connectionPointIndex) {
32162
32145
  var offset = 0;
32163
32146
  if (item) {
@@ -32179,15 +32162,15 @@ var MouseHandlerMoveConnectorOrthogonalSideState = (function (_super) {
32179
32162
  break;
32180
32163
  }
32181
32164
  }
32182
- if (this.isVerticalOrientation)
32183
- if (point.y > directionPoint.y)
32184
- point.y -= Math.min(offset, point.y - directionPoint.y);
32165
+ if (this.isHorizontal)
32166
+ if (point.x > directionPoint.x)
32167
+ point.x -= Math.min(offset, point.x - directionPoint.x);
32185
32168
  else
32186
- point.y += Math.min(offset, directionPoint.y - point.y);
32187
- else if (point.x > directionPoint.x)
32188
- point.x -= Math.min(offset, point.x - directionPoint.x);
32169
+ point.x += Math.min(offset, directionPoint.x - point.x);
32170
+ else if (point.y > directionPoint.y)
32171
+ point.y -= Math.min(offset, point.y - directionPoint.y);
32189
32172
  else
32190
- point.x += Math.min(offset, directionPoint.x - point.x);
32173
+ point.y += Math.min(offset, directionPoint.y - point.y);
32191
32174
  };
32192
32175
  MouseHandlerMoveConnectorOrthogonalSideState.prototype.getDraggingElementKeys = function () {
32193
32176
  return [this.connector.key];
@@ -39719,12 +39702,12 @@ var RightAngleConnectorRoutingStrategy = (function () {
39719
39702
  ModelUtils_1.ModelUtils.skipUnnecessaryRightAngleRenderPoints(renderPoints);
39720
39703
  return renderPoints;
39721
39704
  };
39722
- RightAngleConnectorRoutingStrategy.prototype.onMovePoints = function (points, beginPointIndex, beginPoint, lastPointIndex, lastPoint, oldRenderPoints) {
39705
+ RightAngleConnectorRoutingStrategy.prototype.onMovePoints = function (points, beginPointIndex, lastPointIndex, newPoints, oldRenderPoints) {
39723
39706
  if (beginPointIndex === 0 || lastPointIndex === points.length - 1)
39724
39707
  return oldRenderPoints;
39725
39708
  var renderPoints = oldRenderPoints.map(function (p) { return new ConnectorRenderPoint_1.ConnectorRenderPoint(p.x, p.y, p.pointIndex); });
39726
- this.onMovePointCore(renderPoints, beginPointIndex, beginPoint);
39727
- this.onMovePointCore(renderPoints, lastPointIndex, lastPoint);
39709
+ for (var i = beginPointIndex; i <= lastPointIndex; i++)
39710
+ this.onMovePointCore(renderPoints, i, newPoints[i - beginPointIndex]);
39728
39711
  ModelUtils_1.ModelUtils.skipUnnecessaryRightAngleRenderPoints(renderPoints);
39729
39712
  return renderPoints;
39730
39713
  };
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * DevExpress Diagram (dx-diagram.min)
3
- * Version: 2.1.76
4
- * Build date: Wed Jul 26 2023
3
+ * Version: 2.1.77
4
+ * Build date: Tue Aug 08 2023
5
5
  *
6
6
  * Copyright (c) 2012 - 2023 Developer Express Inc. ALL RIGHTS RESERVED
7
7
  * Read about DevExpress licensing here: https://www.devexpress.com/Support/EULAs