@fulate/ui 1.0.2 → 1.0.3

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.
Files changed (2) hide show
  1. package/dist/index.js +10 -17
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1165,16 +1165,15 @@ var ConnectionPortDecoration = class {
1165
1165
  const { slot, block } = entry;
1166
1166
  if (!block) return null;
1167
1167
  const definition = slot.definition;
1168
- const edgePosition = this.host.getEdgePosition(slot.edge, slot.ratio);
1169
1168
  const position = slot.localPosition;
1170
- const segment = this.host.getEdgeSegment(slot.edge);
1171
- const slotSpan = Math.hypot(segment.end.x - segment.start.x, segment.end.y - segment.start.y) / (slot.edgeCount + 1);
1169
+ const { nx, ny, edgeLength } = slot.geometry;
1170
+ const slotSpan = edgeLength / (slot.edgeCount + 1);
1172
1171
  const horizontalEdge = slot.edge === "top" || slot.edge === "bottom";
1173
1172
  const width = horizontalEdge ? Math.max(0, Math.min(definition.labelWidth ?? DEFAULT_LABEL_WIDTH, slotSpan - LABEL_GAP * 2)) : Math.max(0, definition.labelWidth ?? DEFAULT_LABEL_WIDTH);
1174
1173
  if (width === 0) return null;
1175
1174
  const localAlign = slot.edge === "left" ? "right" : slot.edge === "right" ? "left" : "center";
1176
1175
  const upright = definition.keepLabelUpright !== false;
1177
- const worldNormal = upright ? transformVector(this.host.transform.getWorldMatrixView(), edgePosition.nx, edgePosition.ny) : null;
1176
+ const worldNormal = upright ? transformVector(this.host.transform.getWorldMatrixView(), nx, ny) : null;
1178
1177
  const align = worldNormal ? Math.abs(worldNormal.x) >= Math.abs(worldNormal.y) ? worldNormal.x >= 0 ? "left" : "right" : "center" : localAlign;
1179
1178
  const style = this.getStyle(entry, align);
1180
1179
  const lineHeight = style.fontSize * style.lineHeight;
@@ -1215,7 +1214,7 @@ var ConnectionPortDecoration = class {
1215
1214
  width,
1216
1215
  height
1217
1216
  };
1218
- const uprightMatrix = upright ? this.buildUprightMatrix(position, edgePosition.nx, edgePosition.ny, width, height) : null;
1217
+ const uprightMatrix = upright ? this.buildUprightMatrix(position, nx, ny, width, height) : null;
1219
1218
  if (upright && !uprightMatrix) return null;
1220
1219
  return {
1221
1220
  entry,
@@ -1246,7 +1245,7 @@ var ConnectionPortDecoration = class {
1246
1245
  }
1247
1246
  buildUprightMatrix(position, nx, ny, width, height) {
1248
1247
  const matrix = this.host.transform.getWorldMatrixView();
1249
- const worldPosition = transformPoint$1(matrix, position);
1248
+ const worldPosition = transformPoint(matrix, position);
1250
1249
  const normal = transformVector(matrix, nx, ny);
1251
1250
  const normalLength = Math.hypot(normal.x, normal.y);
1252
1251
  const scaleX = Math.hypot(matrix.a, matrix.b);
@@ -1281,12 +1280,6 @@ var ConnectionPortDecoration = class {
1281
1280
  }
1282
1281
  }
1283
1282
  };
1284
- function transformPoint$1(matrix, point) {
1285
- return {
1286
- x: matrix.a * point.x + matrix.c * point.y + matrix.e,
1287
- y: matrix.b * point.x + matrix.d * point.y + matrix.f
1288
- };
1289
- }
1290
1283
  function transformVector(matrix, x, y) {
1291
1284
  return {
1292
1285
  x: matrix.a * x + matrix.c * y,
@@ -1297,19 +1290,19 @@ function projectRect(matrix, rect) {
1297
1290
  const right = rect.left + rect.width;
1298
1291
  const bottom = rect.top + rect.height;
1299
1292
  return Bound.fromPoints([
1300
- transformPoint$1(matrix, {
1293
+ transformPoint(matrix, {
1301
1294
  x: rect.left,
1302
1295
  y: rect.top
1303
1296
  }),
1304
- transformPoint$1(matrix, {
1297
+ transformPoint(matrix, {
1305
1298
  x: right,
1306
1299
  y: rect.top
1307
1300
  }),
1308
- transformPoint$1(matrix, {
1301
+ transformPoint(matrix, {
1309
1302
  x: right,
1310
1303
  y: bottom
1311
1304
  }),
1312
- transformPoint$1(matrix, {
1305
+ transformPoint(matrix, {
1313
1306
  x: rect.left,
1314
1307
  y: bottom
1315
1308
  })
@@ -2916,7 +2909,7 @@ var TextTransform = class extends RectangleTransform {
2916
2909
  }
2917
2910
  buildVisualOutline(snapshot) {
2918
2911
  if (this.element.overflow !== "visible") return super.buildVisualOutline(snapshot);
2919
- const bounds = this.buildVisualBounds(snapshot);
2912
+ const bounds = this.getLocalVisualBoundsView();
2920
2913
  if (!bounds) return [];
2921
2914
  return [
2922
2915
  createPointView(bounds.left, bounds.top),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fulate/ui",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",