diff --git a/src/components/line-app/states/RelayState.vue b/src/components/line-app/states/RelayState.vue
index 72ac55f..e640f91 100644
--- a/src/components/line-app/states/RelayState.vue
+++ b/src/components/line-app/states/RelayState.vue
@@ -17,10 +17,10 @@
-
-
+
+
-
+
diff --git a/src/graphics/platform/Platform.ts b/src/graphics/platform/Platform.ts
index 764e0d4..3de34b8 100644
--- a/src/graphics/platform/Platform.ts
+++ b/src/graphics/platform/Platform.ts
@@ -168,18 +168,23 @@ export class Platform extends JlGraphic {
}
});
if (minDistanceRefSections) {
- const refSection = minDistanceRefSections?.reduce((prev, cur) => {
+ const refSection = minDistanceRefSections.reduce((prev, cur) => {
return distance2(
- prev.localToCanvasPoint(prev.getStartPoint()),
+ prev.localToCanvasPoint(getRectangleCenter(prev.getLocalBounds())),
this.position
) >
- distance2(cur.localToCanvasPoint(prev.getStartPoint()), this.position)
+ distance2(
+ cur.localToCanvasPoint(getRectangleCenter(cur.getLocalBounds())),
+ this.position
+ )
? cur
: prev;
});
- if (refSection) {
- this.relationManage.addRelation(this, refSection);
- }
+ this.relationManage.deleteRelationOfGraphicAndOtherType(
+ this,
+ Section.Type
+ );
+ this.relationManage.addRelation(this, refSection);
}
}
saveRelations() {