@flowgram.ai/free-auto-layout-plugin 1.0.8 → 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 +4 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +13 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/dist/esm/index.js
CHANGED
|
@@ -2167,7 +2167,7 @@ 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
|
|
2170
|
+
if (!from || !to) {
|
|
2171
2171
|
return;
|
|
2172
2172
|
}
|
|
2173
2173
|
const id = `virtual_${groupId}_from_${from}_to_${to}`;
|
|
@@ -2186,7 +2186,7 @@ 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
|
|
2189
|
+
if (!from || !to) {
|
|
2190
2190
|
return;
|
|
2191
2191
|
}
|
|
2192
2192
|
const id = `virtual_${groupId}_from_${from}_to_${to}`;
|
|
@@ -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
|
-
|
|
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;
|