@vitessce/heatmap 3.2.1 → 3.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.
- package/dist/{deflate-7ab0abb4.js → deflate-54e8a983.js} +1 -1
- package/dist/{index-c1121c91.js → index-99684608.js} +118 -28
- package/dist/index.js +1 -1
- package/dist/{jpeg-71ae1b4c.js → jpeg-91201fe5.js} +1 -1
- package/dist/{lerc-2f30a422.js → lerc-ede29ce8.js} +1 -1
- package/dist/{lzw-c78ce1c8.js → lzw-dcec678f.js} +1 -1
- package/dist/{packbits-5b39eff5.js → packbits-1f0b4f8a.js} +1 -1
- package/dist/{raw-f53bb94a.js → raw-ed466def.js} +1 -1
- package/dist/{webimage-33f727db.js → webimage-892fe81d.js} +1 -1
- package/package.json +9 -9
|
@@ -132521,16 +132521,16 @@ function addDecoder(cases, importFn) {
|
|
|
132521
132521
|
}
|
|
132522
132522
|
cases.forEach((c) => registry$1.set(c, importFn));
|
|
132523
132523
|
}
|
|
132524
|
-
addDecoder([void 0, 1], () => import("./raw-
|
|
132525
|
-
addDecoder(5, () => import("./lzw-
|
|
132524
|
+
addDecoder([void 0, 1], () => import("./raw-ed466def.js").then((m) => m.default));
|
|
132525
|
+
addDecoder(5, () => import("./lzw-dcec678f.js").then((m) => m.default));
|
|
132526
132526
|
addDecoder(6, () => {
|
|
132527
132527
|
throw new Error("old style JPEG compression is not supported.");
|
|
132528
132528
|
});
|
|
132529
|
-
addDecoder(7, () => import("./jpeg-
|
|
132530
|
-
addDecoder([8, 32946], () => import("./deflate-
|
|
132531
|
-
addDecoder(32773, () => import("./packbits-
|
|
132532
|
-
addDecoder(34887, () => import("./lerc-
|
|
132533
|
-
addDecoder(50001, () => import("./webimage-
|
|
132529
|
+
addDecoder(7, () => import("./jpeg-91201fe5.js").then((m) => m.default));
|
|
132530
|
+
addDecoder([8, 32946], () => import("./deflate-54e8a983.js").then((m) => m.default));
|
|
132531
|
+
addDecoder(32773, () => import("./packbits-1f0b4f8a.js").then((m) => m.default));
|
|
132532
|
+
addDecoder(34887, () => import("./lerc-ede29ce8.js").then((m) => m.default));
|
|
132533
|
+
addDecoder(50001, () => import("./webimage-892fe81d.js").then((m) => m.default));
|
|
132534
132534
|
function decodeRowAcc(row, stride) {
|
|
132535
132535
|
let length2 = row.length - stride;
|
|
132536
132536
|
let offset5 = 0;
|
|
@@ -141430,6 +141430,67 @@ function makeBoundingBox(viewState) {
|
|
|
141430
141430
|
viewport.unproject([0, viewport.height])
|
|
141431
141431
|
];
|
|
141432
141432
|
}
|
|
141433
|
+
const TARGETS = [1, 2, 3, 4, 5, 10, 20, 25, 50, 100, 200, 250, 500, 1e3];
|
|
141434
|
+
const MIN_TARGET = TARGETS[0];
|
|
141435
|
+
const MAX_TARGET = TARGETS[TARGETS.length - 1];
|
|
141436
|
+
const SI_PREFIXES = [
|
|
141437
|
+
{ symbol: "Y", exponent: 24 },
|
|
141438
|
+
{ symbol: "Z", exponent: 21 },
|
|
141439
|
+
{ symbol: "E", exponent: 18 },
|
|
141440
|
+
{ symbol: "P", exponent: 15 },
|
|
141441
|
+
{ symbol: "T", exponent: 12 },
|
|
141442
|
+
{ symbol: "G", exponent: 9 },
|
|
141443
|
+
{ symbol: "M", exponent: 6 },
|
|
141444
|
+
{ symbol: "k", exponent: 3 },
|
|
141445
|
+
{ symbol: "h", exponent: 2 },
|
|
141446
|
+
{ symbol: "da", exponent: 1 },
|
|
141447
|
+
{ symbol: "", exponent: 0 },
|
|
141448
|
+
{ symbol: "d", exponent: -1 },
|
|
141449
|
+
{ symbol: "c", exponent: -2 },
|
|
141450
|
+
{ symbol: "m", exponent: -3 },
|
|
141451
|
+
{ symbol: "µ", exponent: -6 },
|
|
141452
|
+
{ symbol: "n", exponent: -9 },
|
|
141453
|
+
{ symbol: "p", exponent: -12 },
|
|
141454
|
+
{ symbol: "f", exponent: -15 },
|
|
141455
|
+
{ symbol: "a", exponent: -18 },
|
|
141456
|
+
{ symbol: "z", exponent: -21 },
|
|
141457
|
+
{ symbol: "y", exponent: -24 }
|
|
141458
|
+
];
|
|
141459
|
+
function sizeToMeters(size, unit2) {
|
|
141460
|
+
if (!unit2 || unit2 === "m") {
|
|
141461
|
+
return size;
|
|
141462
|
+
}
|
|
141463
|
+
if (unit2.length > 1) {
|
|
141464
|
+
let unitPrefix = unit2.substring(0, unit2.length - 1);
|
|
141465
|
+
if (unitPrefix === "u") {
|
|
141466
|
+
unitPrefix = "µ";
|
|
141467
|
+
}
|
|
141468
|
+
const unitObj = SI_PREFIXES.find((p) => p.symbol === unitPrefix);
|
|
141469
|
+
if (unitObj) {
|
|
141470
|
+
return size * 10 ** unitObj.exponent;
|
|
141471
|
+
}
|
|
141472
|
+
}
|
|
141473
|
+
throw new Error("Received unknown unit");
|
|
141474
|
+
}
|
|
141475
|
+
function snapValue(value) {
|
|
141476
|
+
let magnitude = 0;
|
|
141477
|
+
if (value < MIN_TARGET || value > MAX_TARGET) {
|
|
141478
|
+
magnitude = Math.floor(Math.log10(value));
|
|
141479
|
+
}
|
|
141480
|
+
let snappedUnit = SI_PREFIXES.find(
|
|
141481
|
+
(p) => p.exponent % 3 === 0 && p.exponent <= magnitude
|
|
141482
|
+
);
|
|
141483
|
+
let adjustedValue = value / 10 ** snappedUnit.exponent;
|
|
141484
|
+
if (adjustedValue > 500 && adjustedValue <= 1e3) {
|
|
141485
|
+
snappedUnit = SI_PREFIXES.find(
|
|
141486
|
+
(p) => p.exponent % 3 === 0 && p.exponent <= magnitude + 3
|
|
141487
|
+
);
|
|
141488
|
+
adjustedValue = value / 10 ** snappedUnit.exponent;
|
|
141489
|
+
}
|
|
141490
|
+
const targetNewUnits = TARGETS.find((t2) => t2 > adjustedValue);
|
|
141491
|
+
const targetOrigUnits = targetNewUnits * 10 ** snappedUnit.exponent;
|
|
141492
|
+
return [targetOrigUnits, targetNewUnits, snappedUnit.symbol];
|
|
141493
|
+
}
|
|
141433
141494
|
const fs$1$1 = `#define SHADER_NAME xr-layer-fragment-shader
|
|
141434
141495
|
|
|
141435
141496
|
precision highp float;
|
|
@@ -142197,26 +142258,27 @@ const OverviewLayer = class extends CompositeLayer {
|
|
|
142197
142258
|
OverviewLayer.layerName = "OverviewLayer";
|
|
142198
142259
|
OverviewLayer.defaultProps = defaultProps$3;
|
|
142199
142260
|
function getPosition(boundingBox, position, length2) {
|
|
142200
|
-
const
|
|
142261
|
+
const viewWidth = boundingBox[2][0] - boundingBox[0][0];
|
|
142262
|
+
const viewHeight = boundingBox[2][1] - boundingBox[0][1];
|
|
142201
142263
|
switch (position) {
|
|
142202
142264
|
case "bottom-right": {
|
|
142203
|
-
const yCoord = boundingBox[2][1] -
|
|
142204
|
-
const xLeftCoord = boundingBox[2][0] -
|
|
142265
|
+
const yCoord = boundingBox[2][1] - viewHeight * length2;
|
|
142266
|
+
const xLeftCoord = boundingBox[2][0] - viewWidth * length2;
|
|
142205
142267
|
return [yCoord, xLeftCoord];
|
|
142206
142268
|
}
|
|
142207
142269
|
case "top-right": {
|
|
142208
|
-
const yCoord =
|
|
142209
|
-
const xLeftCoord = boundingBox[2][0] -
|
|
142270
|
+
const yCoord = boundingBox[0][1] + viewHeight * length2;
|
|
142271
|
+
const xLeftCoord = boundingBox[2][0] - viewWidth * length2;
|
|
142210
142272
|
return [yCoord, xLeftCoord];
|
|
142211
142273
|
}
|
|
142212
142274
|
case "top-left": {
|
|
142213
|
-
const yCoord =
|
|
142214
|
-
const xLeftCoord =
|
|
142275
|
+
const yCoord = boundingBox[0][1] + viewHeight * length2;
|
|
142276
|
+
const xLeftCoord = boundingBox[0][0] + viewWidth * length2;
|
|
142215
142277
|
return [yCoord, xLeftCoord];
|
|
142216
142278
|
}
|
|
142217
142279
|
case "bottom-left": {
|
|
142218
|
-
const yCoord = boundingBox[2][1] -
|
|
142219
|
-
const xLeftCoord =
|
|
142280
|
+
const yCoord = boundingBox[2][1] - viewHeight * length2;
|
|
142281
|
+
const xLeftCoord = boundingBox[0][0] + viewWidth * length2;
|
|
142220
142282
|
return [yCoord, xLeftCoord];
|
|
142221
142283
|
}
|
|
142222
142284
|
default: {
|
|
@@ -142234,11 +142296,12 @@ const defaultProps$2 = {
|
|
|
142234
142296
|
unit: { type: "string", value: "", compare: true },
|
|
142235
142297
|
size: { type: "number", value: 1, compare: true },
|
|
142236
142298
|
position: { type: "string", value: "bottom-right", compare: true },
|
|
142237
|
-
length: { type: "number", value: 0.085, compare: true }
|
|
142299
|
+
length: { type: "number", value: 0.085, compare: true },
|
|
142300
|
+
snap: { type: "boolean", value: false, compare: true }
|
|
142238
142301
|
};
|
|
142239
142302
|
const ScaleBarLayer = class extends CompositeLayer {
|
|
142240
142303
|
renderLayers() {
|
|
142241
|
-
const { id, unit: unit2, size, position, viewState, length: length2 } = this.props;
|
|
142304
|
+
const { id, unit: unit2, size, position, viewState, length: length2, snap } = this.props;
|
|
142242
142305
|
const boundingBox = makeBoundingBox(viewState);
|
|
142243
142306
|
const { zoom } = viewState;
|
|
142244
142307
|
const viewLength = boundingBox[2][0] - boundingBox[0][0];
|
|
@@ -142247,15 +142310,27 @@ const ScaleBarLayer = class extends CompositeLayer {
|
|
|
142247
142310
|
2 ** (-zoom + 1.5),
|
|
142248
142311
|
(boundingBox[2][1] - boundingBox[0][1]) * 7e-3
|
|
142249
142312
|
);
|
|
142250
|
-
|
|
142313
|
+
let adjustedBarLength = barLength;
|
|
142314
|
+
let displayNumber = (barLength * size).toPrecision(5);
|
|
142315
|
+
let displayUnit = unit2;
|
|
142316
|
+
if (snap) {
|
|
142317
|
+
const meterSize = sizeToMeters(size, unit2);
|
|
142318
|
+
const numUnits = barLength * meterSize;
|
|
142319
|
+
const [snappedOrigUnits, snappedNewUnits, snappedUnitPrefix] = snapValue(numUnits);
|
|
142320
|
+
adjustedBarLength = snappedOrigUnits / meterSize;
|
|
142321
|
+
displayNumber = snappedNewUnits;
|
|
142322
|
+
displayUnit = `${snappedUnitPrefix}m`;
|
|
142323
|
+
}
|
|
142251
142324
|
const [yCoord, xLeftCoord] = getPosition(boundingBox, position, length2);
|
|
142325
|
+
const xRightCoord = xLeftCoord + barLength;
|
|
142326
|
+
const isLeft = position.endsWith("-left");
|
|
142252
142327
|
const lengthBar = new LineLayer({
|
|
142253
142328
|
id: `scale-bar-length-${id}`,
|
|
142254
142329
|
coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,
|
|
142255
142330
|
data: [
|
|
142256
142331
|
[
|
|
142257
|
-
[xLeftCoord, yCoord],
|
|
142258
|
-
[xLeftCoord +
|
|
142332
|
+
[isLeft ? xLeftCoord : xRightCoord - adjustedBarLength, yCoord],
|
|
142333
|
+
[isLeft ? xLeftCoord + adjustedBarLength : xRightCoord, yCoord]
|
|
142259
142334
|
]
|
|
142260
142335
|
],
|
|
142261
142336
|
getSourcePosition: (d) => d[0],
|
|
@@ -142268,8 +142343,14 @@ const ScaleBarLayer = class extends CompositeLayer {
|
|
|
142268
142343
|
coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,
|
|
142269
142344
|
data: [
|
|
142270
142345
|
[
|
|
142271
|
-
[
|
|
142272
|
-
|
|
142346
|
+
[
|
|
142347
|
+
isLeft ? xLeftCoord : xRightCoord - adjustedBarLength,
|
|
142348
|
+
yCoord - barHeight
|
|
142349
|
+
],
|
|
142350
|
+
[
|
|
142351
|
+
isLeft ? xLeftCoord : xRightCoord - adjustedBarLength,
|
|
142352
|
+
yCoord + barHeight
|
|
142353
|
+
]
|
|
142273
142354
|
]
|
|
142274
142355
|
],
|
|
142275
142356
|
getSourcePosition: (d) => d[0],
|
|
@@ -142282,8 +142363,14 @@ const ScaleBarLayer = class extends CompositeLayer {
|
|
|
142282
142363
|
coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,
|
|
142283
142364
|
data: [
|
|
142284
142365
|
[
|
|
142285
|
-
[
|
|
142286
|
-
|
|
142366
|
+
[
|
|
142367
|
+
isLeft ? xLeftCoord + adjustedBarLength : xRightCoord,
|
|
142368
|
+
yCoord - barHeight
|
|
142369
|
+
],
|
|
142370
|
+
[
|
|
142371
|
+
isLeft ? xLeftCoord + adjustedBarLength : xRightCoord,
|
|
142372
|
+
yCoord + barHeight
|
|
142373
|
+
]
|
|
142287
142374
|
]
|
|
142288
142375
|
],
|
|
142289
142376
|
getSourcePosition: (d) => d[0],
|
|
@@ -142296,8 +142383,11 @@ const ScaleBarLayer = class extends CompositeLayer {
|
|
|
142296
142383
|
coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,
|
|
142297
142384
|
data: [
|
|
142298
142385
|
{
|
|
142299
|
-
text:
|
|
142300
|
-
position: [
|
|
142386
|
+
text: `${displayNumber}${displayUnit}`,
|
|
142387
|
+
position: [
|
|
142388
|
+
isLeft ? xLeftCoord + barLength * 0.5 : xRightCoord - barLength * 0.5,
|
|
142389
|
+
yCoord + barHeight * 4
|
|
142390
|
+
]
|
|
142301
142391
|
}
|
|
142302
142392
|
],
|
|
142303
142393
|
getColor: [220, 220, 220, 255],
|
|
@@ -142306,7 +142396,7 @@ const ScaleBarLayer = class extends CompositeLayer {
|
|
|
142306
142396
|
sizeUnits: "meters",
|
|
142307
142397
|
sizeScale: 2 ** -zoom,
|
|
142308
142398
|
characterSet: [
|
|
142309
|
-
...
|
|
142399
|
+
...displayUnit.split(""),
|
|
142310
142400
|
...range(10).map((i2) => String(i2)),
|
|
142311
142401
|
".",
|
|
142312
142402
|
"e",
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as inflate_1 } from "./pako.esm-68f84e2a.js";
|
|
2
|
-
import { g as getDefaultExportFromCjs, B as BaseDecoder } from "./index-
|
|
2
|
+
import { g as getDefaultExportFromCjs, B as BaseDecoder } from "./index-99684608.js";
|
|
3
3
|
import "react";
|
|
4
4
|
import "@vitessce/vit-s";
|
|
5
5
|
import "react-dom";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitessce/heatmap",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.2",
|
|
4
4
|
"author": "Gehlenborg Lab",
|
|
5
5
|
"homepage": "http://vitessce.io",
|
|
6
6
|
"repository": {
|
|
@@ -20,14 +20,14 @@
|
|
|
20
20
|
"lodash-es": "^4.17.21",
|
|
21
21
|
"uuid": "^9.0.0",
|
|
22
22
|
"react-aria": "^3.28.0",
|
|
23
|
-
"@vitessce/constants-internal": "3.2.
|
|
24
|
-
"@vitessce/gl": "3.2.
|
|
25
|
-
"@vitessce/legend": "3.2.
|
|
26
|
-
"@vitessce/sets-utils": "3.2.
|
|
27
|
-
"@vitessce/tooltip": "3.2.
|
|
28
|
-
"@vitessce/utils": "3.2.
|
|
29
|
-
"@vitessce/vit-s": "3.2.
|
|
30
|
-
"@vitessce/workers": "3.2.
|
|
23
|
+
"@vitessce/constants-internal": "3.2.2",
|
|
24
|
+
"@vitessce/gl": "3.2.2",
|
|
25
|
+
"@vitessce/legend": "3.2.2",
|
|
26
|
+
"@vitessce/sets-utils": "3.2.2",
|
|
27
|
+
"@vitessce/tooltip": "3.2.2",
|
|
28
|
+
"@vitessce/utils": "3.2.2",
|
|
29
|
+
"@vitessce/vit-s": "3.2.2",
|
|
30
|
+
"@vitessce/workers": "3.2.2"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@testing-library/jest-dom": "^5.16.4",
|