devexpress-diagram 2.2.2 → 2.2.3
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/dist/dx-diagram.css +2 -2
- package/dist/dx-diagram.js +199 -174
- package/dist/dx-diagram.min.css +2 -2
- package/dist/dx-diagram.min.js +1 -1
- package/dist/dx-diagram.min.js.LICENSE.txt +2 -2
- package/dist/lib/package.json +1 -1
- package/dist/lib/src/Commands/Keyboard/MoveCommands.ts +6 -32
- package/dist/lib/src/Events/MouseHandler.ts +1 -1
- package/dist/lib/src/Events/MouseStates/MouseHandlerDragDiagramItemStateBase.ts +16 -145
- package/dist/lib/src/Events/MouseStates/MouseHandlerMoveConnectorState.ts +5 -5
- package/dist/lib/src/Events/MouseStates/MouseHandlerMoveShapeState.ts +1 -1
- package/dist/lib/src/Model/Helpers/DragHelper.ts +169 -0
- package/package.json +1 -1
package/dist/dx-diagram.css
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* DevExpress Diagram (dx-diagram)
|
|
3
|
-
* Version: 2.2.
|
|
4
|
-
* Build date: Wed
|
|
3
|
+
* Version: 2.2.3
|
|
4
|
+
* Build date: Wed Dec 06 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
|
package/dist/dx-diagram.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* DevExpress Diagram (dx-diagram)
|
|
3
|
-
* Version: 2.2.
|
|
4
|
-
* Build date: Wed
|
|
3
|
+
* Version: 2.2.3
|
|
4
|
+
* Build date: Wed Dec 06 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
|
|
@@ -6319,7 +6319,7 @@ var point_1 = __webpack_require__(8900);
|
|
|
6319
6319
|
var ModelUtils_1 = __webpack_require__(4867);
|
|
6320
6320
|
var unit_converter_1 = __webpack_require__(9291);
|
|
6321
6321
|
var SimpleCommandBase_1 = __webpack_require__(9741);
|
|
6322
|
-
var
|
|
6322
|
+
var DragHelper_1 = __webpack_require__(4742);
|
|
6323
6323
|
var MoveCommand = (function (_super) {
|
|
6324
6324
|
__extends(MoveCommand, _super);
|
|
6325
6325
|
function MoveCommand() {
|
|
@@ -6332,34 +6332,11 @@ var MoveCommand = (function (_super) {
|
|
|
6332
6332
|
var _this = this;
|
|
6333
6333
|
this.control.history.beginTransaction();
|
|
6334
6334
|
var selection = this.control.selection;
|
|
6335
|
-
var
|
|
6336
|
-
|
|
6337
|
-
|
|
6338
|
-
|
|
6339
|
-
|
|
6340
|
-
shape = shape.container;
|
|
6341
|
-
}
|
|
6342
|
-
return true;
|
|
6343
|
-
});
|
|
6344
|
-
selectedShapesWithoutDuplicates.forEach(function (shape) {
|
|
6345
|
-
_this.permissionsProvider.addInteractingItem(shape, __1.DiagramModelOperation.MoveShape);
|
|
6346
|
-
var pos = _this.getPosition(shape.position);
|
|
6347
|
-
ModelUtils_1.ModelUtils.setShapePosition(_this.control.history, _this.control.model, shape, pos);
|
|
6348
|
-
ModelUtils_1.ModelUtils.updateShapeAttachedConnectors(_this.control.history, _this.control.model, shape);
|
|
6349
|
-
_this.permissionsProvider.clearInteractingItems();
|
|
6350
|
-
});
|
|
6351
|
-
var selectedItems = ModelUtils_1.ModelUtils.createSelectedItems(selection);
|
|
6352
|
-
selection.getSelectedConnectors().forEach(function (connector) {
|
|
6353
|
-
if (ModelUtils_1.ModelUtils.canMoveConnector(selectedItems, connector)) {
|
|
6354
|
-
var startPtIndex = connector.beginItem ? 1 : 0;
|
|
6355
|
-
var endPtIndex = connector.endItem ? (connector.points.length - 2) : (connector.points.length - 1);
|
|
6356
|
-
for (var i = startPtIndex; i <= endPtIndex; i++) {
|
|
6357
|
-
var pos = _this.getPosition(connector.points[i]);
|
|
6358
|
-
ModelUtils_1.ModelUtils.moveConnectorPoint(_this.control.history, connector, i, pos);
|
|
6359
|
-
}
|
|
6360
|
-
}
|
|
6361
|
-
});
|
|
6362
|
-
ModelUtils_1.ModelUtils.tryUpdateModelRectangle(this.control.history);
|
|
6335
|
+
var helper = new DragHelper_1.SelectionDragHelper(this.control.history, this.control.model, this.permissionsProvider, new point_1.Point(0, 0), selection.getSelectedItems(true));
|
|
6336
|
+
helper.initDraggingShapes(selection.getSelectedShapes(false, true), false);
|
|
6337
|
+
helper.initDraggingConnectors(selection.getSelectedConnectors(false, true), false);
|
|
6338
|
+
helper.move(false, function (p) { return _this.getPosition(p); }, function () { }, function () { });
|
|
6339
|
+
ModelUtils_1.ModelUtils.tryUpdateModelRectangle(this.control.history, function (offsetLeft, offsetTop) { return helper.onTryUpdateModelSize(offsetLeft, offsetTop); });
|
|
6363
6340
|
this.control.history.endTransaction();
|
|
6364
6341
|
return true;
|
|
6365
6342
|
};
|
|
@@ -12876,14 +12853,11 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
12876
12853
|
})();
|
|
12877
12854
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
12878
12855
|
exports.MouseHandlerDragDiagramItemStateBase = exports.DraggingConnector = void 0;
|
|
12879
|
-
var vector_1 = __webpack_require__(9716);
|
|
12880
|
-
var ChangeConnectorPointsHistoryItem_1 = __webpack_require__(58);
|
|
12881
|
-
var ConnectorRenderPoint_1 = __webpack_require__(4717);
|
|
12882
|
-
var ConnectorRenderPointsContext_1 = __webpack_require__(1510);
|
|
12883
12856
|
var ModelUtils_1 = __webpack_require__(4867);
|
|
12884
12857
|
var ModelOperationSettings_1 = __webpack_require__(6879);
|
|
12885
12858
|
var Event_1 = __webpack_require__(6031);
|
|
12886
12859
|
var MouseHandlerDraggingState_1 = __webpack_require__(8816);
|
|
12860
|
+
var DragHelper_1 = __webpack_require__(4742);
|
|
12887
12861
|
var DraggingConnector = (function () {
|
|
12888
12862
|
function DraggingConnector(connector) {
|
|
12889
12863
|
this.connector = connector;
|
|
@@ -12893,13 +12867,6 @@ var DraggingConnector = (function () {
|
|
|
12893
12867
|
return DraggingConnector;
|
|
12894
12868
|
}());
|
|
12895
12869
|
exports.DraggingConnector = DraggingConnector;
|
|
12896
|
-
var DraggingShape = (function () {
|
|
12897
|
-
function DraggingShape(shape) {
|
|
12898
|
-
this.shape = shape;
|
|
12899
|
-
this.startPosition = shape.position.clone();
|
|
12900
|
-
}
|
|
12901
|
-
return DraggingShape;
|
|
12902
|
-
}());
|
|
12903
12870
|
var MouseHandlerDragDiagramItemStateBase = (function (_super) {
|
|
12904
12871
|
__extends(MouseHandlerDragDiagramItemStateBase, _super);
|
|
12905
12872
|
function MouseHandlerDragDiagramItemStateBase(handler, history, model, selection, visualizerManager) {
|
|
@@ -12919,14 +12886,11 @@ var MouseHandlerDragDiagramItemStateBase = (function (_super) {
|
|
|
12919
12886
|
_super.prototype.finish.call(this);
|
|
12920
12887
|
};
|
|
12921
12888
|
MouseHandlerDragDiagramItemStateBase.prototype.onMouseDown = function (evt) {
|
|
12922
|
-
var _this = this;
|
|
12923
12889
|
this.handler.addDiagramItemToSelection(evt);
|
|
12924
12890
|
this.shouldClone = this.handler.canCopySelectedItems(evt);
|
|
12925
12891
|
this.startPoint = evt.modelPoint;
|
|
12926
12892
|
this.initDrag();
|
|
12927
12893
|
this.lockInitDrag = false;
|
|
12928
|
-
if (!this.shouldClone)
|
|
12929
|
-
this.draggingShapes.forEach(function (draggingShape) { return _this.handler.addInteractingItem(draggingShape.shape, ModelOperationSettings_1.DiagramModelOperation.MoveShape); });
|
|
12930
12894
|
_super.prototype.onMouseDown.call(this, evt);
|
|
12931
12895
|
};
|
|
12932
12896
|
MouseHandlerDragDiagramItemStateBase.prototype.onMouseMove = function (evt) {
|
|
@@ -12966,48 +12930,28 @@ var MouseHandlerDragDiagramItemStateBase = (function (_super) {
|
|
|
12966
12930
|
MouseHandlerDragDiagramItemStateBase.prototype.onApplyChanges = function (evt) {
|
|
12967
12931
|
var _this = this;
|
|
12968
12932
|
this.calculateFixedPosition(evt);
|
|
12969
|
-
|
|
12970
|
-
|
|
12971
|
-
|
|
12972
|
-
|
|
12973
|
-
|
|
12974
|
-
|
|
12975
|
-
|
|
12976
|
-
shape = shape.container;
|
|
12977
|
-
}
|
|
12978
|
-
_this.moveShape(ds, evt);
|
|
12979
|
-
});
|
|
12980
|
-
var firstDraggingShape = this.draggingShapes[0];
|
|
12981
|
-
var offset_1 = vector_1.Vector.fromPoints(firstDraggingShape.startPosition.clone(), firstDraggingShape.shape.position.clone());
|
|
12982
|
-
if (offset_1.x || offset_1.y)
|
|
12983
|
-
this.draggingConnectors.forEach(function (dc) { return _this.moveConnectorCore(dc.connector, dc.startPoints, dc.startRenderContext, offset_1); });
|
|
12984
|
-
}
|
|
12985
|
-
else
|
|
12986
|
-
this.draggingConnectors.forEach(function (x) { return _this.moveConnector(x, evt); });
|
|
12933
|
+
this.dragHelper.move(this.shouldClone, function (pt) { return _this.getSnappedPoint(evt, pt); }, function () {
|
|
12934
|
+
_this.visualizerManager.resetConnectionTarget();
|
|
12935
|
+
_this.visualizerManager.resetConnectionPoints();
|
|
12936
|
+
}, function (shape, connectionPointIndex) {
|
|
12937
|
+
_this.visualizerManager.setConnectionTarget(shape, Event_1.MouseEventElementType.Shape);
|
|
12938
|
+
_this.visualizerManager.setConnectionPoints(shape, Event_1.MouseEventElementType.Shape, connectionPointIndex, true);
|
|
12939
|
+
});
|
|
12987
12940
|
var container = ModelUtils_1.ModelUtils.findContainerByEventKey(this.model, this.selection, evt.source.key);
|
|
12988
12941
|
if (container && this.allowInsertToContainer(evt, container))
|
|
12989
12942
|
ModelUtils_1.ModelUtils.insertSelectionToContainer(this.history, this.model, this.selection, container);
|
|
12990
12943
|
else
|
|
12991
12944
|
ModelUtils_1.ModelUtils.removeSelectionFromContainer(this.history, this.model, this.selection);
|
|
12992
|
-
this.handler.tryUpdateModelSize(function (offsetLeft, offsetTop) {
|
|
12993
|
-
_this.modelConnectorsWithoutBeginItemInfo.forEach(function (pi) {
|
|
12994
|
-
pi.point.x += offsetLeft;
|
|
12995
|
-
pi.point.y += offsetTop;
|
|
12996
|
-
});
|
|
12997
|
-
_this.modelConnectorsWithoutEndItemInfo.forEach(function (pi) {
|
|
12998
|
-
pi.point.x += offsetLeft;
|
|
12999
|
-
pi.point.y += offsetTop;
|
|
13000
|
-
});
|
|
13001
|
-
});
|
|
12945
|
+
this.handler.tryUpdateModelSize(function (offsetLeft, offsetTop) { return _this.dragHelper.onTryUpdateModelSize(offsetLeft, offsetTop); });
|
|
13002
12946
|
};
|
|
13003
12947
|
MouseHandlerDragDiagramItemStateBase.prototype.getDraggingElementKeys = function () {
|
|
13004
|
-
return this.draggingShapes.map(function (x) { return x.shape.key; }).concat(this.draggingConnectors.map(function (x) { return x.connector.key; }));
|
|
12948
|
+
return this.dragHelper.draggingShapes.map(function (x) { return x.shape.key; }).concat(this.dragHelper.draggingConnectors.map(function (x) { return x.connector.key; }));
|
|
13005
12949
|
};
|
|
13006
12950
|
MouseHandlerDragDiagramItemStateBase.prototype.getSnappedPoint = function (evt, point) {
|
|
13007
12951
|
return this.handler.getSnappedPointOnDragDiagramItem(evt, point, this.fixedX, this.fixedY, this.startPoint);
|
|
13008
12952
|
};
|
|
13009
12953
|
MouseHandlerDragDiagramItemStateBase.prototype.initDrag = function () {
|
|
13010
|
-
this.
|
|
12954
|
+
this.dragHelper = new DragHelper_1.SelectionDragHelper(this.history, this.model, this.handler.permissionsProvider, this.startPoint, this.selection.getSelectedItems(true));
|
|
13011
12955
|
this.initDraggingShapes();
|
|
13012
12956
|
if (!this.areValidDraggingShapes) {
|
|
13013
12957
|
this.handler.switchToDefaultState();
|
|
@@ -13018,27 +12962,12 @@ var MouseHandlerDragDiagramItemStateBase = (function (_super) {
|
|
|
13018
12962
|
this.handler.switchToDefaultState();
|
|
13019
12963
|
return;
|
|
13020
12964
|
}
|
|
13021
|
-
this.modelConnectorsWithoutBeginItemInfo = this.createModelConnectorsWithoutBeginItemInfo();
|
|
13022
|
-
this.modelConnectorsWithoutEndItemInfo = this.createModelConnectorsWithoutEndItemInfo();
|
|
13023
12965
|
};
|
|
13024
12966
|
MouseHandlerDragDiagramItemStateBase.prototype.initDraggingShapes = function () {
|
|
13025
|
-
this.
|
|
12967
|
+
this.dragHelper.initDraggingShapes(this.selection.getSelectedShapes(false, true), this.shouldClone);
|
|
13026
12968
|
};
|
|
13027
12969
|
MouseHandlerDragDiagramItemStateBase.prototype.initDraggingConnectors = function () {
|
|
13028
|
-
|
|
13029
|
-
this.draggingConnectors = [];
|
|
13030
|
-
this.draggingConnectorsIndexByKey = {};
|
|
13031
|
-
this.selection.getSelectedConnectors(false, true).forEach(function (c) { return _this.registerConnector(c); });
|
|
13032
|
-
if (this.shouldClone)
|
|
13033
|
-
return;
|
|
13034
|
-
this.draggingShapes.forEach(function (x) {
|
|
13035
|
-
var attachedConnectors = x.shape.attachedConnectors;
|
|
13036
|
-
if (attachedConnectors)
|
|
13037
|
-
attachedConnectors.forEach(function (c) {
|
|
13038
|
-
if (!_this.containsDraggingConnectorByKey(c.key))
|
|
13039
|
-
_this.registerConnector(c);
|
|
13040
|
-
});
|
|
13041
|
-
});
|
|
12970
|
+
this.dragHelper.initDraggingConnectors(this.selection.getSelectedConnectors(false, true), this.shouldClone);
|
|
13042
12971
|
};
|
|
13043
12972
|
MouseHandlerDragDiagramItemStateBase.prototype.copySelection = function () {
|
|
13044
12973
|
var _this = this;
|
|
@@ -13060,87 +12989,11 @@ var MouseHandlerDragDiagramItemStateBase = (function (_super) {
|
|
|
13060
12989
|
this.fixedY = true;
|
|
13061
12990
|
}
|
|
13062
12991
|
};
|
|
13063
|
-
MouseHandlerDragDiagramItemStateBase.prototype.containsDraggingConnectorByKey = function (key) {
|
|
13064
|
-
return this.draggingConnectorsIndexByKey[key] !== undefined;
|
|
13065
|
-
};
|
|
13066
12992
|
MouseHandlerDragDiagramItemStateBase.prototype.allowInsertToContainer = function (evt, container) {
|
|
13067
12993
|
if (this.handler.canMultipleSelection(evt))
|
|
13068
12994
|
return false;
|
|
13069
12995
|
return container && container.expanded && ModelUtils_1.ModelUtils.canInsertSelectionToContainer(this.model, this.selection, container);
|
|
13070
12996
|
};
|
|
13071
|
-
MouseHandlerDragDiagramItemStateBase.prototype.registerConnector = function (connector) {
|
|
13072
|
-
this.draggingConnectorsIndexByKey[connector.key] = this.draggingConnectors.push(new DraggingConnector(connector)) - 1;
|
|
13073
|
-
};
|
|
13074
|
-
MouseHandlerDragDiagramItemStateBase.prototype.createModelConnectorsWithoutBeginItemInfo = function () {
|
|
13075
|
-
var _this = this;
|
|
13076
|
-
var connectors = this.model.findConnectorsCore(function (c) { return !c.beginItem && !_this.containsDraggingConnectorByKey(c.key); });
|
|
13077
|
-
return connectors.map(function (c) {
|
|
13078
|
-
return {
|
|
13079
|
-
connector: c,
|
|
13080
|
-
point: c.points[0].clone()
|
|
13081
|
-
};
|
|
13082
|
-
});
|
|
13083
|
-
};
|
|
13084
|
-
MouseHandlerDragDiagramItemStateBase.prototype.createModelConnectorsWithoutEndItemInfo = function () {
|
|
13085
|
-
var _this = this;
|
|
13086
|
-
var connectors = this.model.findConnectorsCore(function (c) { return !c.endItem && !_this.containsDraggingConnectorByKey(c.key); });
|
|
13087
|
-
return connectors.map(function (c) {
|
|
13088
|
-
return {
|
|
13089
|
-
connector: c,
|
|
13090
|
-
point: c.points[c.points.length - 1].clone()
|
|
13091
|
-
};
|
|
13092
|
-
});
|
|
13093
|
-
};
|
|
13094
|
-
MouseHandlerDragDiagramItemStateBase.prototype.moveConnector = function (dc, evt) {
|
|
13095
|
-
var startPoints = dc.startPoints;
|
|
13096
|
-
var offset = vector_1.Vector.fromPoints(startPoints[0].clone(), this.getSnappedPoint(evt, startPoints[0]).clone());
|
|
13097
|
-
if (offset.x || offset.y)
|
|
13098
|
-
this.moveConnectorCore(dc.connector, startPoints, dc.startRenderContext, offset);
|
|
13099
|
-
};
|
|
13100
|
-
MouseHandlerDragDiagramItemStateBase.prototype.moveConnectorCore = function (connector, startPoints, startRenderContext, offset) {
|
|
13101
|
-
if (this.shouldClone || ModelUtils_1.ModelUtils.canMoveConnector(this.selectedItems, connector))
|
|
13102
|
-
this.offsetConnector(connector, startPoints, startRenderContext, offset);
|
|
13103
|
-
else
|
|
13104
|
-
this.changeConnector(connector);
|
|
13105
|
-
};
|
|
13106
|
-
MouseHandlerDragDiagramItemStateBase.prototype.moveShape = function (ds, evt) {
|
|
13107
|
-
var _this = this;
|
|
13108
|
-
var shape = ds.shape;
|
|
13109
|
-
var position = this.getSnappedPoint(evt, ds.startPosition);
|
|
13110
|
-
ModelUtils_1.ModelUtils.setShapePosition(this.history, this.model, shape, position);
|
|
13111
|
-
ModelUtils_1.ModelUtils.updateMovingShapeConnections(this.history, shape, this.modelConnectorsWithoutBeginItemInfo, this.modelConnectorsWithoutEndItemInfo, function () {
|
|
13112
|
-
_this.visualizerManager.resetConnectionTarget();
|
|
13113
|
-
_this.visualizerManager.resetConnectionPoints();
|
|
13114
|
-
}, function (shape, connectionPointIndex) {
|
|
13115
|
-
_this.visualizerManager.setConnectionTarget(shape, Event_1.MouseEventElementType.Shape);
|
|
13116
|
-
_this.visualizerManager.setConnectionPoints(shape, Event_1.MouseEventElementType.Shape, connectionPointIndex, true);
|
|
13117
|
-
}, function (connector) { return _this.handler.addInteractingItem(connector); });
|
|
13118
|
-
if (!this.draggingConnectors.filter(function (dc) { return !!_this.selectedItems[dc.connector.key]; }).length)
|
|
13119
|
-
ModelUtils_1.ModelUtils.updateShapeAttachedConnectors(this.history, this.model, shape);
|
|
13120
|
-
};
|
|
13121
|
-
MouseHandlerDragDiagramItemStateBase.prototype.offsetConnector = function (connector, startPoints, startRenderContext, offset) {
|
|
13122
|
-
var _this = this;
|
|
13123
|
-
var newPoints = startPoints.map(function (p) { return _this.offsetPoint(p, offset); });
|
|
13124
|
-
if (!newPoints[0].equals(connector.points[0]))
|
|
13125
|
-
this.history.addAndRedo(new ChangeConnectorPointsHistoryItem_1.ChangeConnectorPointsHistoryItem(connector.key, newPoints, this.offsetRenderContext(startRenderContext, offset)));
|
|
13126
|
-
};
|
|
13127
|
-
MouseHandlerDragDiagramItemStateBase.prototype.offsetRenderContext = function (context, offset) {
|
|
13128
|
-
var _this = this;
|
|
13129
|
-
if (context === undefined)
|
|
13130
|
-
return undefined;
|
|
13131
|
-
return new ConnectorRenderPointsContext_1.ConnectorRenderPointsContext(context.renderPoints.map(function (p) {
|
|
13132
|
-
var newPoint = _this.offsetPoint(p, offset);
|
|
13133
|
-
return new ConnectorRenderPoint_1.ConnectorRenderPoint(newPoint.x, newPoint.y, p.pointIndex, p.skipped);
|
|
13134
|
-
}), true, context.actualRoutingMode);
|
|
13135
|
-
};
|
|
13136
|
-
MouseHandlerDragDiagramItemStateBase.prototype.offsetPoint = function (point, offset) {
|
|
13137
|
-
var pointOffset = vector_1.Vector.fromPoints(point, this.startPoint);
|
|
13138
|
-
return this.startPoint.clone().offset(offset.x - pointOffset.x, offset.y - pointOffset.y);
|
|
13139
|
-
};
|
|
13140
|
-
MouseHandlerDragDiagramItemStateBase.prototype.changeConnector = function (connector) {
|
|
13141
|
-
ModelUtils_1.ModelUtils.tryRemoveConnectorIntermediatePoints(this.history, connector);
|
|
13142
|
-
ModelUtils_1.ModelUtils.updateConnectorAttachedPoints(this.history, this.model, connector);
|
|
13143
|
-
};
|
|
13144
12997
|
return MouseHandlerDragDiagramItemStateBase;
|
|
13145
12998
|
}(MouseHandlerDraggingState_1.MouseHandlerDraggingState));
|
|
13146
12999
|
exports.MouseHandlerDragDiagramItemStateBase = MouseHandlerDragDiagramItemStateBase;
|
|
@@ -13802,12 +13655,12 @@ var MouseHandlerMoveConnectorState = (function (_super) {
|
|
|
13802
13655
|
get: function () {
|
|
13803
13656
|
var _this = this;
|
|
13804
13657
|
if (this.shouldClone)
|
|
13805
|
-
return this.draggingShapes.length > 0 || this.draggingConnectors.length > 0;
|
|
13806
|
-
if (!this.draggingConnectors.length)
|
|
13658
|
+
return this.dragHelper.draggingShapes.length > 0 || this.dragHelper.draggingConnectors.length > 0;
|
|
13659
|
+
if (!this.dragHelper.draggingConnectors.length)
|
|
13807
13660
|
return false;
|
|
13808
|
-
if (!this.draggingShapes.length)
|
|
13809
|
-
return !this.draggingConnectors.some(function (x) { return !ModelUtils_1.ModelUtils.canMoveConnector(_this.selectedItems, x.connector); });
|
|
13810
|
-
return ModelUtils_1.ModelUtils.canMoveConnector(this.selectedItems, this.draggingConnectors[this.draggingConnectorsIndexByKey[this.handler.mouseDownEvent.source.key]].connector);
|
|
13661
|
+
if (!this.dragHelper.draggingShapes.length)
|
|
13662
|
+
return !this.dragHelper.draggingConnectors.some(function (x) { return !ModelUtils_1.ModelUtils.canMoveConnector(_this.dragHelper.selectedItems, x.connector); });
|
|
13663
|
+
return ModelUtils_1.ModelUtils.canMoveConnector(this.dragHelper.selectedItems, this.dragHelper.draggingConnectors[this.dragHelper.draggingConnectorsIndexByKey[this.handler.mouseDownEvent.source.key]].connector);
|
|
13811
13664
|
},
|
|
13812
13665
|
enumerable: false,
|
|
13813
13666
|
configurable: true
|
|
@@ -13912,7 +13765,7 @@ var MouseHandlerMoveShapeState = (function (_super) {
|
|
|
13912
13765
|
}
|
|
13913
13766
|
Object.defineProperty(MouseHandlerMoveShapeState.prototype, "areValidDraggingShapes", {
|
|
13914
13767
|
get: function () {
|
|
13915
|
-
return this.shouldClone || this.draggingShapes.length > 0;
|
|
13768
|
+
return this.shouldClone || this.dragHelper.draggingShapes.length > 0;
|
|
13916
13769
|
},
|
|
13917
13770
|
enumerable: false,
|
|
13918
13771
|
configurable: true
|
|
@@ -24443,6 +24296,178 @@ var DiagramItem = (function () {
|
|
|
24443
24296
|
exports.DiagramItem = DiagramItem;
|
|
24444
24297
|
|
|
24445
24298
|
|
|
24299
|
+
/***/ }),
|
|
24300
|
+
|
|
24301
|
+
/***/ 4742:
|
|
24302
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
24303
|
+
|
|
24304
|
+
|
|
24305
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
24306
|
+
exports.DraggingConnector = exports.SelectionDragHelper = void 0;
|
|
24307
|
+
var vector_1 = __webpack_require__(9716);
|
|
24308
|
+
var ChangeConnectorPointsHistoryItem_1 = __webpack_require__(58);
|
|
24309
|
+
var ConnectorRenderPointsContext_1 = __webpack_require__(1510);
|
|
24310
|
+
var ModelUtils_1 = __webpack_require__(4867);
|
|
24311
|
+
var ConnectorRenderPoint_1 = __webpack_require__(4717);
|
|
24312
|
+
var ModelOperationSettings_1 = __webpack_require__(6879);
|
|
24313
|
+
var SelectionDragHelper = (function () {
|
|
24314
|
+
function SelectionDragHelper(history, model, permissionsProvider, startPoint, selectedItems) {
|
|
24315
|
+
var _this = this;
|
|
24316
|
+
this.history = history;
|
|
24317
|
+
this.model = model;
|
|
24318
|
+
this.permissionsProvider = permissionsProvider;
|
|
24319
|
+
this.startPoint = startPoint;
|
|
24320
|
+
this.draggingShapes = [];
|
|
24321
|
+
this.draggingConnectors = [];
|
|
24322
|
+
this.selectedItems = {};
|
|
24323
|
+
this.draggingConnectorsIndexByKey = {};
|
|
24324
|
+
selectedItems.forEach(function (i) { return _this.selectedItems[i.key] = i; });
|
|
24325
|
+
}
|
|
24326
|
+
SelectionDragHelper.prototype.initDraggingShapes = function (shapes, shouldClone) {
|
|
24327
|
+
var _this = this;
|
|
24328
|
+
this.draggingShapes = shapes.map(function (s) { return new DraggingShape(s); });
|
|
24329
|
+
if (!shouldClone)
|
|
24330
|
+
this.draggingShapes.forEach(function (draggingShape) { return _this.permissionsProvider.addInteractingItem(draggingShape.shape, ModelOperationSettings_1.DiagramModelOperation.MoveShape); });
|
|
24331
|
+
};
|
|
24332
|
+
SelectionDragHelper.prototype.initDraggingConnectors = function (connectors, shouldClone) {
|
|
24333
|
+
var _this = this;
|
|
24334
|
+
this.draggingConnectors = [];
|
|
24335
|
+
this.draggingConnectorsIndexByKey = {};
|
|
24336
|
+
connectors.forEach(function (c) { return _this.registerConnector(c); });
|
|
24337
|
+
if (!shouldClone)
|
|
24338
|
+
this.draggingShapes.forEach(function (x) {
|
|
24339
|
+
var attachedConnectors = x.shape.attachedConnectors;
|
|
24340
|
+
if (attachedConnectors)
|
|
24341
|
+
attachedConnectors.forEach(function (c) {
|
|
24342
|
+
if (!_this.containsDraggingConnectorByKey(c.key))
|
|
24343
|
+
_this.registerConnector(c);
|
|
24344
|
+
});
|
|
24345
|
+
});
|
|
24346
|
+
this.modelConnectorsWithoutBeginItemInfo = this.createModelConnectorsWithoutBeginItemInfo();
|
|
24347
|
+
this.modelConnectorsWithoutEndItemInfo = this.createModelConnectorsWithoutEndItemInfo();
|
|
24348
|
+
};
|
|
24349
|
+
SelectionDragHelper.prototype.move = function (shouldClone, getMovePoint, resetTargetCallback, updateTargetCallback) {
|
|
24350
|
+
var _this = this;
|
|
24351
|
+
if (this.draggingShapes.length) {
|
|
24352
|
+
var selectedShapes_1 = this.draggingShapes.map(function (ds) { return ds.shape; });
|
|
24353
|
+
this.draggingShapes.forEach(function (ds) {
|
|
24354
|
+
var shape = ds.shape;
|
|
24355
|
+
while (shape.container) {
|
|
24356
|
+
if (selectedShapes_1.indexOf(shape.container) !== -1)
|
|
24357
|
+
return false;
|
|
24358
|
+
shape = shape.container;
|
|
24359
|
+
}
|
|
24360
|
+
_this.moveShape(ds, getMovePoint, resetTargetCallback, updateTargetCallback);
|
|
24361
|
+
});
|
|
24362
|
+
var firstDraggingShape = this.draggingShapes[0];
|
|
24363
|
+
var offset_1 = vector_1.Vector.fromPoints(firstDraggingShape.startPosition.clone(), firstDraggingShape.shape.position.clone());
|
|
24364
|
+
if (offset_1.x || offset_1.y)
|
|
24365
|
+
this.draggingConnectors.forEach(function (dc) { return _this.moveConnectorCore(dc.connector, dc.startPoints, dc.startRenderContext, offset_1, shouldClone); });
|
|
24366
|
+
}
|
|
24367
|
+
else
|
|
24368
|
+
this.draggingConnectors.forEach(function (x) { return _this.moveConnector(x, shouldClone, getMovePoint); });
|
|
24369
|
+
};
|
|
24370
|
+
SelectionDragHelper.prototype.containsDraggingConnectorByKey = function (key) {
|
|
24371
|
+
return this.draggingConnectorsIndexByKey[key] !== undefined;
|
|
24372
|
+
};
|
|
24373
|
+
SelectionDragHelper.prototype.onTryUpdateModelSize = function (offsetLeft, offsetTop) {
|
|
24374
|
+
this.modelConnectorsWithoutBeginItemInfo.forEach(function (pi) {
|
|
24375
|
+
pi.point.x += offsetLeft;
|
|
24376
|
+
pi.point.y += offsetTop;
|
|
24377
|
+
});
|
|
24378
|
+
this.modelConnectorsWithoutEndItemInfo.forEach(function (pi) {
|
|
24379
|
+
pi.point.x += offsetLeft;
|
|
24380
|
+
pi.point.y += offsetTop;
|
|
24381
|
+
});
|
|
24382
|
+
};
|
|
24383
|
+
SelectionDragHelper.prototype.moveConnector = function (dc, shouldClone, getMovePoint) {
|
|
24384
|
+
var startPoints = dc.startPoints;
|
|
24385
|
+
var offset = vector_1.Vector.fromPoints(startPoints[0].clone(), getMovePoint(startPoints[0]).clone());
|
|
24386
|
+
if (offset.x || offset.y)
|
|
24387
|
+
this.moveConnectorCore(dc.connector, startPoints, dc.startRenderContext, offset, shouldClone);
|
|
24388
|
+
};
|
|
24389
|
+
SelectionDragHelper.prototype.moveConnectorCore = function (connector, startPoints, startRenderContext, offset, shouldClone) {
|
|
24390
|
+
if (shouldClone || ModelUtils_1.ModelUtils.canMoveConnector(this.selectedItems, connector))
|
|
24391
|
+
this.offsetConnector(connector, startPoints, startRenderContext, offset);
|
|
24392
|
+
else
|
|
24393
|
+
this.changeConnector(connector);
|
|
24394
|
+
};
|
|
24395
|
+
SelectionDragHelper.prototype.moveShape = function (ds, getMovePoint, resetTargetCallback, updateTargetCallback) {
|
|
24396
|
+
var _this = this;
|
|
24397
|
+
var shape = ds.shape;
|
|
24398
|
+
var position = getMovePoint(ds.startPosition);
|
|
24399
|
+
ModelUtils_1.ModelUtils.setShapePosition(this.history, this.model, shape, position);
|
|
24400
|
+
ModelUtils_1.ModelUtils.updateMovingShapeConnections(this.history, shape, this.modelConnectorsWithoutBeginItemInfo, this.modelConnectorsWithoutEndItemInfo, resetTargetCallback, updateTargetCallback, function (connector) { return _this.permissionsProvider.addInteractingItem(connector); });
|
|
24401
|
+
if (!this.draggingConnectors.filter(function (dc) { return !!_this.selectedItems[dc.connector.key]; }).length)
|
|
24402
|
+
ModelUtils_1.ModelUtils.updateShapeAttachedConnectors(this.history, this.model, shape);
|
|
24403
|
+
};
|
|
24404
|
+
SelectionDragHelper.prototype.offsetConnector = function (connector, startPoints, startRenderContext, offset) {
|
|
24405
|
+
var _this = this;
|
|
24406
|
+
var newPoints = startPoints.map(function (p) { return _this.offsetPoint(p, offset); });
|
|
24407
|
+
if (!newPoints[0].equals(connector.points[0]))
|
|
24408
|
+
this.history.addAndRedo(new ChangeConnectorPointsHistoryItem_1.ChangeConnectorPointsHistoryItem(connector.key, newPoints, this.offsetRenderContext(startRenderContext, offset)));
|
|
24409
|
+
};
|
|
24410
|
+
SelectionDragHelper.prototype.offsetRenderContext = function (context, offset) {
|
|
24411
|
+
var _this = this;
|
|
24412
|
+
if (context === undefined)
|
|
24413
|
+
return undefined;
|
|
24414
|
+
return new ConnectorRenderPointsContext_1.ConnectorRenderPointsContext(context.renderPoints.map(function (p) {
|
|
24415
|
+
var newPoint = _this.offsetPoint(p, offset);
|
|
24416
|
+
return new ConnectorRenderPoint_1.ConnectorRenderPoint(newPoint.x, newPoint.y, p.pointIndex, p.skipped);
|
|
24417
|
+
}), true, context.actualRoutingMode);
|
|
24418
|
+
};
|
|
24419
|
+
SelectionDragHelper.prototype.offsetPoint = function (point, offset) {
|
|
24420
|
+
var pointOffset = vector_1.Vector.fromPoints(point, this.startPoint);
|
|
24421
|
+
return this.startPoint.clone().offset(offset.x - pointOffset.x, offset.y - pointOffset.y);
|
|
24422
|
+
};
|
|
24423
|
+
SelectionDragHelper.prototype.changeConnector = function (connector) {
|
|
24424
|
+
ModelUtils_1.ModelUtils.tryRemoveConnectorIntermediatePoints(this.history, connector);
|
|
24425
|
+
ModelUtils_1.ModelUtils.updateConnectorAttachedPoints(this.history, this.model, connector);
|
|
24426
|
+
};
|
|
24427
|
+
SelectionDragHelper.prototype.registerConnector = function (connector) {
|
|
24428
|
+
this.draggingConnectorsIndexByKey[connector.key] = this.draggingConnectors.push(new DraggingConnector(connector)) - 1;
|
|
24429
|
+
};
|
|
24430
|
+
SelectionDragHelper.prototype.createModelConnectorsWithoutBeginItemInfo = function () {
|
|
24431
|
+
var _this = this;
|
|
24432
|
+
var connectors = this.model.findConnectorsCore(function (c) { return !c.beginItem && !_this.containsDraggingConnectorByKey(c.key); });
|
|
24433
|
+
return connectors.map(function (c) {
|
|
24434
|
+
return {
|
|
24435
|
+
connector: c,
|
|
24436
|
+
point: c.points[0].clone()
|
|
24437
|
+
};
|
|
24438
|
+
});
|
|
24439
|
+
};
|
|
24440
|
+
SelectionDragHelper.prototype.createModelConnectorsWithoutEndItemInfo = function () {
|
|
24441
|
+
var _this = this;
|
|
24442
|
+
var connectors = this.model.findConnectorsCore(function (c) { return !c.endItem && !_this.containsDraggingConnectorByKey(c.key); });
|
|
24443
|
+
return connectors.map(function (c) {
|
|
24444
|
+
return {
|
|
24445
|
+
connector: c,
|
|
24446
|
+
point: c.points[c.points.length - 1].clone()
|
|
24447
|
+
};
|
|
24448
|
+
});
|
|
24449
|
+
};
|
|
24450
|
+
return SelectionDragHelper;
|
|
24451
|
+
}());
|
|
24452
|
+
exports.SelectionDragHelper = SelectionDragHelper;
|
|
24453
|
+
var DraggingConnector = (function () {
|
|
24454
|
+
function DraggingConnector(connector) {
|
|
24455
|
+
this.connector = connector;
|
|
24456
|
+
this.startPoints = connector.points.map(function (x) { return x.clone(); });
|
|
24457
|
+
this.startRenderContext = connector.tryCreateRenderPointsContext();
|
|
24458
|
+
}
|
|
24459
|
+
return DraggingConnector;
|
|
24460
|
+
}());
|
|
24461
|
+
exports.DraggingConnector = DraggingConnector;
|
|
24462
|
+
var DraggingShape = (function () {
|
|
24463
|
+
function DraggingShape(shape) {
|
|
24464
|
+
this.shape = shape;
|
|
24465
|
+
this.startPosition = shape.position.clone();
|
|
24466
|
+
}
|
|
24467
|
+
return DraggingShape;
|
|
24468
|
+
}());
|
|
24469
|
+
|
|
24470
|
+
|
|
24446
24471
|
/***/ }),
|
|
24447
24472
|
|
|
24448
24473
|
/***/ 6613:
|
package/dist/dx-diagram.min.css
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* DevExpress Diagram (dx-diagram.min)
|
|
3
|
-
* Version: 2.2.
|
|
4
|
-
* Build date: Wed
|
|
3
|
+
* Version: 2.2.3
|
|
4
|
+
* Build date: Wed Dec 06 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
|