Skip to content

Commit 35a1f41

Browse files
committed
Test
1 parent 667c161 commit 35a1f41

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

src/ElementEditor.js

+22
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ export default class ElementEditor {
4141
};
4242
this.connectorSnapping = {
4343
canSnap: false,
44+
snapShapeId: null,
4445
snapTo: null
4546
};
4647
this.lineHandleManipulate = 0;
@@ -295,6 +296,12 @@ export default class ElementEditor {
295296
enteredText.remove();
296297
}
297298

299+
/**
300+
* Get attibutes of shape and its container in an array
301+
* where first element is name and second is value
302+
* @param {*} shape
303+
* @returns
304+
*/
298305
getElementAttributes(shape) {
299306
const selshape = shape.getCorropspondingShape();
300307
const shapeParams = selshape.attributes;
@@ -311,6 +318,9 @@ export default class ElementEditor {
311318
return shapeArray;
312319
}
313320

321+
/**
322+
* Get all bounds of shape along with parsed translation
323+
*/
314324
getAllElementBounds(shape) {
315325
const shapeToResize = shape
316326
.getCorropspondingShape();
@@ -385,7 +395,13 @@ export default class ElementEditor {
385395
if (ev.target.classList.contains('connector')) {
386396
const connector = ev.target;
387397
const connectorPos = connector.getBoundingClientRect();
398+
const oldSelShape = this.listOfElements[this.elementLookup.get(
399+
this.selectedElement.corrospondingShapeID)];
388400
this.selectcreate('connectionline');
401+
oldSelShape.allConnections.push({
402+
id: this.selectedElement.corrospondingShapeID,
403+
point: 0
404+
});
389405
const connectorline = this.selectedElement.getCorropspondingShape();
390406
const connectorlineContainer = connectorline.parentNode;
391407

@@ -626,6 +642,12 @@ export default class ElementEditor {
626642
if (!this.selectedElement) {
627643
return;
628644
}
645+
646+
// Special case for connection lines
647+
if (this.editor.getCurrentCommand() == 'connect' && this.connectorSnapping.snapTo) {
648+
649+
}
650+
629651
// Save the history
630652
const attrs = this.getElementAttributes(this.selectedElement);
631653

src/Shapes/BaseShape.js

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ export default class BaseShape {
1313
oldContainerAttributes;
1414

1515
constructor() {
16-
this.recomendedConnections = [];
1716
this.allConnections = [];
1817
}
1918

0 commit comments

Comments
 (0)