@mx-sose-front/mx-sose-graph 1.2.8 → 1.2.9

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/index.esm.js CHANGED
@@ -8235,69 +8235,85 @@ class EdgeUtils {
8235
8235
  * @returns 处理后的连接数据和 pin 的 bounds
8236
8236
  */
8237
8237
  static handleServiceObjectFlowConnection(sourceShape, targetShape, connectionData) {
8238
- const outputPin = {
8239
- shapeKey: "OutputPin",
8240
- shapeType: "pin",
8241
- bounds: {
8242
- x: connectionData.sourcePoint.x,
8243
- y: connectionData.sourcePoint.y,
8244
- width: 22,
8245
- height: 22
8246
- }
8247
- };
8248
- const adjustedOutputPinPos = snapPinToParentEdge(
8249
- connectionData.sourcePoint,
8250
- sourceShape,
8251
- outputPin
8252
- );
8253
- outputPin.bounds = {
8254
- x: adjustedOutputPinPos.x,
8255
- y: adjustedOutputPinPos.y,
8256
- width: 22,
8257
- height: 22
8258
- };
8259
- const inputPin = {
8260
- shapeKey: "InputPin",
8261
- shapeType: "pin",
8262
- bounds: {
8263
- x: connectionData.targetPoint.x,
8264
- y: connectionData.targetPoint.y,
8238
+ const sourceIsPin = String(sourceShape.shapeType).trim().toLowerCase() === "pin";
8239
+ const targetIsPin = String(targetShape.shapeType).trim().toLowerCase() === "pin";
8240
+ let outputPin;
8241
+ let outputPinBounds = null;
8242
+ if (sourceIsPin) {
8243
+ outputPin = sourceShape;
8244
+ } else {
8245
+ outputPin = {
8246
+ shapeKey: "OutputPin",
8247
+ shapeType: "pin",
8248
+ bounds: {
8249
+ x: connectionData.sourcePoint.x,
8250
+ y: connectionData.sourcePoint.y,
8251
+ width: 22,
8252
+ height: 22
8253
+ }
8254
+ };
8255
+ const adjustedOutputPinPos = snapPinToParentEdge(
8256
+ connectionData.sourcePoint,
8257
+ sourceShape,
8258
+ outputPin
8259
+ );
8260
+ outputPin.bounds = {
8261
+ x: adjustedOutputPinPos.x,
8262
+ y: adjustedOutputPinPos.y,
8265
8263
  width: 22,
8266
8264
  height: 22
8267
- }
8268
- };
8269
- const adjustedInputPinPos = snapPinToParentEdge(
8270
- connectionData.targetPoint,
8271
- targetShape,
8272
- inputPin
8273
- );
8274
- inputPin.bounds = {
8275
- x: adjustedInputPinPos.x,
8276
- y: adjustedInputPinPos.y,
8277
- width: 22,
8278
- height: 22
8279
- };
8280
- const outputPinConnectionPoint = EdgeUtils.calculatePinConnectionPoint(outputPin);
8281
- const inputPinConnectionPoint = EdgeUtils.calculatePinConnectionPoint(inputPin);
8282
- connectionData.sourcePoint = outputPinConnectionPoint;
8283
- connectionData.targetPoint = inputPinConnectionPoint;
8284
- connectionData.waypoints = [outputPinConnectionPoint, inputPinConnectionPoint];
8285
- return {
8286
- connectionData,
8287
- outputPinBounds: {
8265
+ };
8266
+ outputPinBounds = {
8288
8267
  x: outputPin.bounds.x ?? 0,
8289
8268
  y: outputPin.bounds.y ?? 0,
8290
8269
  width: outputPin.bounds.width ?? 22,
8291
8270
  height: outputPin.bounds.height ?? 22,
8292
8271
  direction: outputPin.direction
8293
- },
8294
- inputPinBounds: {
8272
+ };
8273
+ }
8274
+ let inputPin;
8275
+ let inputPinBounds = null;
8276
+ if (targetIsPin) {
8277
+ inputPin = targetShape;
8278
+ } else {
8279
+ inputPin = {
8280
+ shapeKey: "InputPin",
8281
+ shapeType: "pin",
8282
+ bounds: {
8283
+ x: connectionData.targetPoint.x,
8284
+ y: connectionData.targetPoint.y,
8285
+ width: 22,
8286
+ height: 22
8287
+ }
8288
+ };
8289
+ const adjustedInputPinPos = snapPinToParentEdge(
8290
+ connectionData.targetPoint,
8291
+ targetShape,
8292
+ inputPin
8293
+ );
8294
+ inputPin.bounds = {
8295
+ x: adjustedInputPinPos.x,
8296
+ y: adjustedInputPinPos.y,
8297
+ width: 22,
8298
+ height: 22
8299
+ };
8300
+ inputPinBounds = {
8295
8301
  x: inputPin.bounds.x ?? 0,
8296
8302
  y: inputPin.bounds.y ?? 0,
8297
8303
  width: inputPin.bounds.width ?? 22,
8298
8304
  height: inputPin.bounds.height ?? 22,
8299
8305
  direction: inputPin.direction
8300
- }
8306
+ };
8307
+ }
8308
+ const outputPinConnectionPoint = EdgeUtils.calculatePinConnectionPoint(outputPin);
8309
+ const inputPinConnectionPoint = EdgeUtils.calculatePinConnectionPoint(inputPin);
8310
+ connectionData.sourcePoint = outputPinConnectionPoint;
8311
+ connectionData.targetPoint = inputPinConnectionPoint;
8312
+ connectionData.waypoints = [outputPinConnectionPoint, inputPinConnectionPoint];
8313
+ return {
8314
+ connectionData,
8315
+ outputPinBounds,
8316
+ inputPinBounds
8301
8317
  };
8302
8318
  }
8303
8319
  }
@@ -9664,11 +9680,9 @@ const useGraphStore = defineStore("graph", () => {
9664
9680
  }
9665
9681
  }
9666
9682
  }
9667
- console.log("1. endDragShape start");
9668
9683
  await EdgeUtils.updateRelatedEdgesAsync(shapes.value, changedIds, (shape) => {
9669
9684
  updateShape(shape.id, shape);
9670
9685
  }, edgesByNodeId.value, shapeMap.value);
9671
- console.log("2. updateRelatedEdgesAsync done");
9672
9686
  autoExpandMovedCompartmentsAfterDrag(shapes.value, changedIds, updateShape);
9673
9687
  const allReparentIds = [...changedIds, ...clonedIds];
9674
9688
  const prevMapForComparents = { ...prevParentById };
@@ -9713,9 +9727,7 @@ const useGraphStore = defineStore("graph", () => {
9713
9727
  }
9714
9728
  }
9715
9729
  eventBus.emit("shape-drag-end", payloads, ownerPayload, onNestDone);
9716
- console.log("3. emit done");
9717
9730
  cleanupAfterDrag();
9718
- console.log("4. cleanupAfterDrag done");
9719
9731
  } catch (e) {
9720
9732
  console.error("endDragShape 执行失败:", e);
9721
9733
  } finally {
@@ -21587,7 +21599,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
21587
21599
  emits: ["shapes-property", "shapes-edit-name", "connect-end", "object-flow-connect-end", "action-button-click", "diagramDoubleClick", "model-type-property-id-button-click", "action-button-add", "scale-changed"],
21588
21600
  setup(__props, { expose: __expose, emit: __emit }) {
21589
21601
  useCssVars((_ctx) => ({
21590
- "7cc4bada": currentScale.value
21602
+ "df80ced4": currentScale.value
21591
21603
  }));
21592
21604
  registerShapes({
21593
21605
  StrategicTaxonomyDiagram,
@@ -21973,8 +21985,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
21973
21985
  };
21974
21986
  }
21975
21987
  });
21976
- const graph_vue_vue_type_style_index_0_scoped_c87a4c75_lang = "";
21977
- const GraphView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-c87a4c75"]]);
21988
+ const graph_vue_vue_type_style_index_0_scoped_9074f03d_lang = "";
21989
+ const GraphView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-9074f03d"]]);
21978
21990
  const MxSoseGraphPlugin = {
21979
21991
  install(app, options) {
21980
21992
  const externalPinia = options?.pinia || // 优先使用显式传入的