@onlyworlds/sdk 4.171.0 → 4.171.1
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/CHANGELOG.md +11 -0
- package/dist/index.d.ts +6 -2
- package/dist/index.js +11 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,17 @@ earlier history lives in git log only.
|
|
|
5
5
|
|
|
6
6
|
## [Unreleased]
|
|
7
7
|
|
|
8
|
+
## [4.171.1] - 2026-11-16
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- **`layoutByLinks3d` no longer throws on a Map whose width or height is under 0.** A Map's `width` and `height` are any whole number in the standard. One under 0 made the call throw from inside the method ("the square root of a negative area") when that Map held the most pinned elements, and with both under 0 the Map became a plate with every place mirrored. A width or height that is not over 0 is now no size: such a Map is no plate, no other Map is tried in its stead, and the world is laid out by its links alone; a Map over a place with such a size is no small plate. The method's fixture gains four cases for it (64).
|
|
13
|
+
- **Held points cost what they move.** The force steps worked out the push between every two fixed elements, 300 times, though neither can move and the push was never read. They no longer do; no number of any answer changes. Laying out a made world of 9,000 elements with every point handed back took 1,147 ms and takes 269 ms, the same answer to the bit, so a layout that keeps a picture still now costs less than one from nothing.
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
|
|
17
|
+
- **The `held` list's words say what false means.** A pinned element stands at its Pin and is never answered as held, so `held: false` does not mean new. What is new is every id that was not handed in.
|
|
18
|
+
|
|
8
19
|
## [4.171.0] - 2026-11-16
|
|
9
20
|
|
|
10
21
|
### Added
|
package/dist/index.d.ts
CHANGED
|
@@ -6848,7 +6848,10 @@ interface OwLayoutByLinks3d {
|
|
|
6848
6848
|
part: Array<OwLayout3dPart | null>;
|
|
6849
6849
|
/** The centres' ids, in rank order. */
|
|
6850
6850
|
centres: string[];
|
|
6851
|
-
/**
|
|
6851
|
+
/**
|
|
6852
|
+
* True where the point answered is the element's held point; false everywhere when nothing is held. A pinned element
|
|
6853
|
+
* stands at its Pin and is never held, so false does not mean new: what is new is every id that was not handed in.
|
|
6854
|
+
*/
|
|
6852
6855
|
held: boolean[];
|
|
6853
6856
|
}
|
|
6854
6857
|
/**
|
|
@@ -6861,7 +6864,8 @@ interface OwLayoutByLinks3d {
|
|
|
6861
6864
|
* main piece stands on a shelf under the picture. When the world has a Map that holds three or more elements of the
|
|
6862
6865
|
* graph by a Pin, the Map that holds the most (a tie to the greater id) is a flat plate, each of its pinned elements
|
|
6863
6866
|
* at its Pin, the groups whose centre is pinned standing over it; a Map over a place on that plate is a small plate
|
|
6864
|
-
* a little above it. A
|
|
6867
|
+
* a little above it. A Map whose width or height is not over 0 is no plate, and when it is the Map that holds the
|
|
6868
|
+
* most, the world is laid out by its links alone. A Pin's z is not read: the plate is flat. A layout map (a Map whose `x_layout` names a method,
|
|
6865
6869
|
* the map-space profile's mark) is never the plate: a saved layout never stands in for the world's own space.
|
|
6866
6870
|
*
|
|
6867
6871
|
* `graph` is `worldGraph`'s answer, or any graph of the same shape; `elements` the world's elements as served (only
|
package/dist/index.js
CHANGED
|
@@ -5770,6 +5770,7 @@ function truthy(v) {
|
|
|
5770
5770
|
if (typeof v === "object") return Object.keys(v).length > 0;
|
|
5771
5771
|
return true;
|
|
5772
5772
|
}
|
|
5773
|
+
var sized = (v) => truthy(v) && !(typeof v === "number" && !(v > 0));
|
|
5773
5774
|
function isLayoutMap(row) {
|
|
5774
5775
|
const v = row.x_layout;
|
|
5775
5776
|
return v !== null && typeof v === "object" && !Array.isArray(v) && typeof v.method === "string" && v.method.length > 0;
|
|
@@ -5821,7 +5822,7 @@ function plate(rows2, nodes, opts = {}) {
|
|
|
5821
5822
|
const W = map.width, H = map.height;
|
|
5822
5823
|
const mine0 = at.get(m);
|
|
5823
5824
|
const count2 = mine0.size;
|
|
5824
|
-
if (count2 < 3 || !
|
|
5825
|
+
if (count2 < 3 || !sized(W) || !sized(H)) return null;
|
|
5825
5826
|
const own4 = SPREAD * REST / root(W, H, count2, "the first map");
|
|
5826
5827
|
const scale = opts.scale === void 0 ? own4 : opts.scale;
|
|
5827
5828
|
const out = /* @__PURE__ */ new Map(), onFirst = /* @__PURE__ */ new Map();
|
|
@@ -5843,7 +5844,7 @@ function plate(rows2, nodes, opts = {}) {
|
|
|
5843
5844
|
const mine = at.get(c);
|
|
5844
5845
|
const fresh = [];
|
|
5845
5846
|
for (const [el, xy] of mine) if (!out.has(el)) fresh.push([el, xy]);
|
|
5846
|
-
if (out.has(key(loc, "a map's location")) &&
|
|
5847
|
+
if (out.has(key(loc, "a map's location")) && sized(cw) && sized(ch) && mine.size >= 3 && fresh.length) {
|
|
5847
5848
|
const sc = TILE * REST / root(cw, ch, mine.size, `the map ${c}`);
|
|
5848
5849
|
const [lx, ly, lz] = out.get(loc);
|
|
5849
5850
|
const rise = REST * (mine.size >= 20 ? 4 : 2);
|
|
@@ -6311,6 +6312,8 @@ function relax(feed, opts = {}) {
|
|
|
6311
6312
|
}
|
|
6312
6313
|
const fixed = new Uint8Array(n);
|
|
6313
6314
|
if (feed.fixed) for (let i = 0; i < n; i++) fixed[i] = feed.fixed[i] ? 1 : 0;
|
|
6315
|
+
let free = 0;
|
|
6316
|
+
for (let i = 0; i < n; i++) if (!fixed[i]) free++;
|
|
6314
6317
|
const ea = new Int32Array(m), eb = new Int32Array(m);
|
|
6315
6318
|
const ew = new Float64Array(m);
|
|
6316
6319
|
const scale = new Float64Array(n);
|
|
@@ -6327,7 +6330,8 @@ function relax(feed, opts = {}) {
|
|
|
6327
6330
|
const cellOf = new Int32Array(n);
|
|
6328
6331
|
const order = new Int32Array(n);
|
|
6329
6332
|
const cut2 = CUT * CUT;
|
|
6330
|
-
|
|
6333
|
+
const RUN = free === 0 ? Math.min(STEPS3, 1) : STEPS3;
|
|
6334
|
+
for (let step = 0; step < RUN; step++) {
|
|
6331
6335
|
let x0 = Infinity, y0 = Infinity, z0 = Infinity, x1 = -Infinity, y1 = -Infinity, z1 = -Infinity;
|
|
6332
6336
|
for (let i = 0; i < n; i++) {
|
|
6333
6337
|
if (px[i] < x0) x0 = px[i];
|
|
@@ -6348,6 +6352,8 @@ function relax(feed, opts = {}) {
|
|
|
6348
6352
|
for (let c = 0; c < cells; c++) startOf2[c + 1] += startOf2[c];
|
|
6349
6353
|
const fill = startOf2.slice(0, cells);
|
|
6350
6354
|
for (let i = 0; i < n; i++) order[fill[cellOf[i]]++] = i;
|
|
6355
|
+
const freeIn = new Int32Array(cells);
|
|
6356
|
+
for (let i = 0; i < n; i++) if (!fixed[i]) freeIn[cellOf[i]]++;
|
|
6351
6357
|
dx.fill(0);
|
|
6352
6358
|
dy.fill(0);
|
|
6353
6359
|
dz.fill(0);
|
|
@@ -6362,11 +6368,13 @@ function relax(feed, opts = {}) {
|
|
|
6362
6368
|
const same = q === c;
|
|
6363
6369
|
const t0 = startOf2[q], t1 = startOf2[q + 1];
|
|
6364
6370
|
if (t0 === t1) continue;
|
|
6371
|
+
if (freeIn[c] === 0 && freeIn[q] === 0) continue;
|
|
6365
6372
|
for (let u = s0; u < s1; u++) {
|
|
6366
6373
|
const i = order[u];
|
|
6367
6374
|
const xi = px[i], yi = py[i], zi = pz[i];
|
|
6368
6375
|
for (let v = same ? u + 1 : t0; v < t1; v++) {
|
|
6369
6376
|
const j = order[v];
|
|
6377
|
+
if (fixed[i] && fixed[j]) continue;
|
|
6370
6378
|
const ux = xi - px[j], uy = yi - py[j], uz = zi - pz[j];
|
|
6371
6379
|
const d2 = ux * ux + uy * uy + uz * uz;
|
|
6372
6380
|
if (d2 > cut2) continue;
|