@flowgram.ai/free-auto-layout-plugin 1.0.7 → 1.0.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/esm/index.js CHANGED
@@ -2167,10 +2167,10 @@ var LayoutStore = class {
2167
2167
  const blockIdSet = new Set(blocks.map((b) => b.id));
2168
2168
  const groupFromEdges = edges.filter((edge) => blockIdSet.has(edge.to?.id ?? "")).map((edge) => {
2169
2169
  const { from, to } = edge.info;
2170
- if (!from || !to || edge.vertical) {
2170
+ if (!from || !to) {
2171
2171
  return;
2172
2172
  }
2173
- const id = `virtual_${groupId}_${to}`;
2173
+ const id = `virtual_${groupId}_from_${from}_to_${to}`;
2174
2174
  const layoutEdge = {
2175
2175
  id,
2176
2176
  entity: edge,
@@ -2186,10 +2186,10 @@ var LayoutStore = class {
2186
2186
  }).filter(Boolean);
2187
2187
  const groupToEdges = edges.filter((edge) => blockIdSet.has(edge.from?.id ?? "")).map((edge) => {
2188
2188
  const { from, to } = edge.info;
2189
- if (!from || !to || edge.vertical) {
2189
+ if (!from || !to) {
2190
2190
  return;
2191
2191
  }
2192
- const id = `virtual_${groupId}_${from}`;
2192
+ const id = `virtual_${groupId}_from_${from}_to_${to}`;
2193
2193
  const layoutEdge = {
2194
2194
  id,
2195
2195
  entity: edge,
@@ -2346,10 +2346,10 @@ var LayoutPosition = class {
2346
2346
  updateNodePosition(params) {
2347
2347
  const { layoutNode, step } = params;
2348
2348
  const { transform } = layoutNode.entity.transform;
2349
+ const centerToTopEdgeOffset = this.store.options.alignTopEdge ? 0 : (layoutNode.size.height - layoutNode.padding.top - layoutNode.padding.bottom) / 2;
2349
2350
  const layoutPosition = {
2350
2351
  x: layoutNode.position.x + layoutNode.offset.x,
2351
- // layoutNode.position.y 是中心点,但画布节点原点在上边沿的中间,所以 y 坐标需要转化后一下
2352
- y: layoutNode.position.y + layoutNode.offset.y - (layoutNode.size.height - layoutNode.padding.top - layoutNode.padding.bottom) / 2
2352
+ y: layoutNode.position.y + layoutNode.offset.y - centerToTopEdgeOffset
2353
2353
  };
2354
2354
  const deltaX = (layoutPosition.x - transform.position.x) * step / 100;
2355
2355
  const deltaY = (layoutPosition.y - transform.position.y) * step / 100;