@knowvah/dot-engine 1.2.0 → 1.2.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"edge-route-helpers.d.ts","sourceRoot":"","sources":["../../../src/layout/dot/edge-route-helpers.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAE7D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAOjE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAEpD,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEzF;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,KAAK,GAAG,MAAM,CAE/C;AAyBD,4DAA4D;AAC5D,wBAAgB,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,GAAG,OAAO,CAepD;AAMD;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,SAAS,GAAG,MAAM,CAEvD;AAED,qEAAqE;AACrE,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,SAAS,GAAG,MAAM,CAGrD;AAOD,wDAAwD;AACxD,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,KAAK,GAAG,MAAM,CAM5E;AAED,8DAA8D;AAC9D,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED,0FAA0F;AAC1F,wBAAgB,iBAAiB,CAAC,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C,EAAE,SAAS,GAAG,MAAM,CAGrD;AAOD,wDAAwD;AACxD,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,KAAK,GAAG,MAAM,CAM5E;AAED,8DAA8D;AAC9D,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED,0FAA0F;AAC1F,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,KAAK,GAAG,IAAI,CAYzF;AAaD,8EAA8E;AAC9E,wBAAgB,WAAW,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,GAAG,KAAK,EAAE,CAM3D;AAED,gFAAgF;AAChF,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,YAAY,GAAG,SAAS,EAClC,QAAQ,SAAM,EACd,IAAI,CAAC,EAAE,SAAS,GACf,gBAAgB,CAIlB"}
package/dist/render.js CHANGED
@@ -10025,11 +10025,22 @@ function generalPolyVertices(poly, w, h) {
10025
10025
  const sy = ymax !== 0 ? h / (2 * ymax) : 1;
10026
10026
  return verts.map((v) => ({ x: v.x * sx, y: v.y * sy }));
10027
10027
  }
10028
- function ellipseRings(w, h, peripheries) {
10028
+ function ellipseRings(w, h, peripheries, base) {
10029
+ if (base === void 0) {
10030
+ const out2 = [];
10031
+ for (let j = 0; j < peripheries; j++) {
10032
+ const inset = (peripheries - 1 - j) * GAP;
10033
+ out2.push(...ellipseVertices(w - 2 * inset, h - 2 * inset));
10034
+ }
10035
+ return out2;
10036
+ }
10029
10037
  const out = [];
10038
+ let px = base.w / 2;
10039
+ let py = base.h / 2;
10030
10040
  for (let j = 0; j < peripheries; j++) {
10031
- const inset = (peripheries - 1 - j) * GAP;
10032
- out.push(...ellipseVertices(w - 2 * inset, h - 2 * inset));
10041
+ out.push({ x: -px, y: -py }, { x: px, y: py });
10042
+ px += GAP;
10043
+ py += GAP;
10033
10044
  }
10034
10045
  return out;
10035
10046
  }
@@ -10093,10 +10104,16 @@ function starRings(box, peripheries) {
10093
10104
  }
10094
10105
  function computeVertices(poly, w, h, base) {
10095
10106
  const sides = poly.sides;
10107
+ if (poly.option.fixedshape && base !== void 0) {
10108
+ w = base.w;
10109
+ h = base.h;
10110
+ }
10096
10111
  if (poly.option.shape === CYLINDER) return cylinderVertices(w, h);
10097
10112
  const peripheries = Math.max(poly.peripheries, 1);
10098
10113
  if (poly.option.shape === STAR) return starRings({ w, h, base }, peripheries);
10099
- if (sides <= 2) return ellipseRings(w, h, peripheries);
10114
+ if (sides <= 2) {
10115
+ return ellipseRings(w, h, peripheries, poly.option.fixedshape ? base : void 0);
10116
+ }
10100
10117
  if (sides === 4 && Math.abs(poly.orientation % 90) < 0.5 && poly.distortion === 0 && poly.skew === 0) {
10101
10118
  return boxRings(w, h, peripheries, poly.orientation, base);
10102
10119
  }
@@ -10418,7 +10435,8 @@ function assembleResult(p, dimen, grown, fixedshape) {
10418
10435
  outlineW: Math.max(dimen.x, grown.outline.x),
10419
10436
  outlineH: Math.max(dimen.y, grown.outline.y),
10420
10437
  baseW: grown.base.x,
10421
- baseH: grown.base.y
10438
+ baseH: grown.base.y,
10439
+ fixedshape
10422
10440
  };
10423
10441
  }
10424
10442
  return {
@@ -10426,7 +10444,8 @@ function assembleResult(p, dimen, grown, fixedshape) {
10426
10444
  outlineW: grown.outline.x,
10427
10445
  outlineH: grown.outline.y,
10428
10446
  baseW: grown.base.x,
10429
- baseH: grown.base.y
10447
+ baseH: grown.base.y,
10448
+ fixedshape
10430
10449
  };
10431
10450
  }
10432
10451
 
@@ -14397,21 +14416,28 @@ function fixedShapeSize(poly) {
14397
14416
  }
14398
14417
  return { w: 2 * xmax, h: 2 * ymax };
14399
14418
  }
14400
- function insideDims(n, poly, xsize, ysize) {
14401
- if (poly.option.fixedshape) {
14402
- const { w: w2, h: h2 } = fixedShapeSize(poly);
14403
- return { w: w2, h: h2, ow: w2, oh: h2 };
14404
- }
14419
+ function insideDims(n, xsize, ysize) {
14405
14420
  const w = 72 * (n.info.width || xsize / 72);
14406
14421
  const h = 72 * (n.info.height || ysize / 72);
14407
14422
  return { w, h, ow: 72 * n.info.outline_width || w, oh: 72 * n.info.outline_height || h };
14408
14423
  }
14409
14424
  function insideScale(n, poly) {
14410
14425
  const flip = n.root.info.flip === true;
14426
+ if (poly.option.fixedshape) {
14427
+ const { w: w2, h: h2 } = fixedShapeSize(poly);
14428
+ const xsize2 = flip ? h2 : w2;
14429
+ const ysize2 = flip ? w2 : h2;
14430
+ return {
14431
+ scalex: xsize2 !== 0 ? w2 / xsize2 : w2,
14432
+ scaley: ysize2 !== 0 ? h2 / ysize2 : h2,
14433
+ boxURx: w2 / 2,
14434
+ boxURy: h2 / 2
14435
+ };
14436
+ }
14411
14437
  const lwrw = n.info.lw + n.info.rw;
14412
14438
  const xsize = flip ? n.info.ht : lwrw;
14413
14439
  const ysize = flip ? lwrw : n.info.ht;
14414
- const { w, h, ow, oh } = insideDims(n, poly, xsize, ysize);
14440
+ const { w, h, ow, oh } = insideDims(n, xsize, ysize);
14415
14441
  return {
14416
14442
  scalex: xsize !== 0 ? w / xsize : w,
14417
14443
  scaley: ysize !== 0 ? h / ysize : h,
@@ -17168,7 +17194,9 @@ function pointSizeResult(sz0, peripheries, penwidth) {
17168
17194
  outlineW: szOutline,
17169
17195
  outlineH: szOutline,
17170
17196
  baseW: sz0,
17171
- baseH: sz0
17197
+ baseH: sz0,
17198
+ fixedshape: false
17199
+ // C point_init never sets option.fixedshape
17172
17200
  };
17173
17201
  }
17174
17202
  function initPointSize(n, g, shape) {
@@ -17203,14 +17231,17 @@ function initNodeFromLabel(n, g, measurer) {
17203
17231
  label.space = sz.space;
17204
17232
  label.valign = sz.valign.charCodeAt(0);
17205
17233
  storeNodeSize(n, sz, flip);
17206
- assignShapeInfo(n, effectivePolygon(poly, params));
17234
+ assignShapeInfo(n, effectivePolygon(poly, params, sz.fixedshape));
17207
17235
  return true;
17208
17236
  }
17209
- function effectivePolygon(poly, p) {
17237
+ function effectivePolygon(poly, p, fixedshape) {
17210
17238
  let sides = p.sides;
17211
17239
  if (sides <= 2 && (p.distortion !== 0 || p.skew !== 0)) sides = 120;
17212
17240
  return {
17213
17241
  ...poly,
17242
+ // C: poly->option.fixedshape = true inside the fixedsize="shape" branch;
17243
+ // poly-inside and computeVertices key the shape-box/width split on it.
17244
+ option: { ...poly.option, fixedshape },
17214
17245
  regular: p.regular,
17215
17246
  peripheries: p.peripheries,
17216
17247
  sides,
@@ -25327,6 +25358,21 @@ function nodeBoxOf(n, g) {
25327
25358
  const rb = recordClipBox(n);
25328
25359
  if (rb) return { center: n.info.coord, ...rb, isEllipse: false, penwidth };
25329
25360
  }
25361
+ const si = n.info.shape_info;
25362
+ if (si?.option?.fixedshape === true && si.vertices) {
25363
+ const ext = fixedShapeSize(si);
25364
+ const flip = g.root.info.flip === true;
25365
+ const w = flip ? ext.h : ext.w;
25366
+ const h = flip ? ext.w : ext.h;
25367
+ return {
25368
+ center: n.info.coord,
25369
+ lw: w / 2,
25370
+ rw: w / 2,
25371
+ ht: h,
25372
+ isEllipse: ELLIPSE_SHAPES.has(shapeName),
25373
+ penwidth: 0
25374
+ };
25375
+ }
25330
25376
  return {
25331
25377
  center: n.info.coord,
25332
25378
  lw: n.info.lw > 0 ? n.info.lw : 27,