@kineviz/gl 0.4.1 → 0.4.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.
- package/dist/index.js +17 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +17 -3
- package/dist/index.mjs.map +1 -1
- package/dist/kineviz-gl.umd.js +17 -3
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -46237,9 +46237,23 @@ var _MapApi = class _MapApi {
|
|
|
46237
46237
|
sz += posArray[gidx * 3 + 2];
|
|
46238
46238
|
}
|
|
46239
46239
|
const n = neighbors.length;
|
|
46240
|
-
|
|
46241
|
-
|
|
46242
|
-
|
|
46240
|
+
let cx = sx / n, cy = sy / n, cz = sz / n;
|
|
46241
|
+
if (!isPlanar) {
|
|
46242
|
+
const len = Math.hypot(cx, cy, cz);
|
|
46243
|
+
if (len > 1e-6) {
|
|
46244
|
+
const s = radius / len;
|
|
46245
|
+
cx *= s;
|
|
46246
|
+
cy *= s;
|
|
46247
|
+
cz *= s;
|
|
46248
|
+
} else {
|
|
46249
|
+
cx = 0;
|
|
46250
|
+
cy = 0;
|
|
46251
|
+
cz = radius;
|
|
46252
|
+
}
|
|
46253
|
+
}
|
|
46254
|
+
posArray[idx * 3] = cx + (Math.random() - 0.5) * 2 * jitter;
|
|
46255
|
+
posArray[idx * 3 + 1] = cy + (Math.random() - 0.5) * 2 * jitter;
|
|
46256
|
+
posArray[idx * 3 + 2] = isPlanar ? 0 : cz + (Math.random() - 0.5) * 2 * jitter;
|
|
46243
46257
|
} else if (isPlanar) {
|
|
46244
46258
|
posArray[idx * 3 + 2] = 0;
|
|
46245
46259
|
}
|