@vitessce/layer-controller 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-22ea8fc3.js → deflate-822f733b.js} +1 -1
- package/dist/{index-f8a9f462.js → index-a79502da.js} +118 -28
- package/dist/index.js +1 -1
- package/dist/{jpeg-932c57f1.js → jpeg-f13e87d5.js} +1 -1
- package/dist/{lerc-0db1b156.js → lerc-e0b9e6f7.js} +1 -1
- package/dist/{lzw-3b2cc6cd.js → lzw-b6a080bc.js} +1 -1
- package/dist/{packbits-c8220e7f.js → packbits-fbb728f4.js} +1 -1
- package/dist/{raw-dd52cf7d.js → raw-af4639cb.js} +1 -1
- package/dist/{webimage-d7166a5a.js → webimage-cf240654.js} +1 -1
- package/package.json +6 -6
|
@@ -135596,16 +135596,16 @@ function addDecoder(cases, importFn) {
|
|
|
135596
135596
|
}
|
|
135597
135597
|
cases.forEach((c) => registry$1.set(c, importFn));
|
|
135598
135598
|
}
|
|
135599
|
-
addDecoder([void 0, 1], () => import("./raw-
|
|
135600
|
-
addDecoder(5, () => import("./lzw-
|
|
135599
|
+
addDecoder([void 0, 1], () => import("./raw-af4639cb.js").then((m) => m.default));
|
|
135600
|
+
addDecoder(5, () => import("./lzw-b6a080bc.js").then((m) => m.default));
|
|
135601
135601
|
addDecoder(6, () => {
|
|
135602
135602
|
throw new Error("old style JPEG compression is not supported.");
|
|
135603
135603
|
});
|
|
135604
|
-
addDecoder(7, () => import("./jpeg-
|
|
135605
|
-
addDecoder([8, 32946], () => import("./deflate-
|
|
135606
|
-
addDecoder(32773, () => import("./packbits-
|
|
135607
|
-
addDecoder(34887, () => import("./lerc-
|
|
135608
|
-
addDecoder(50001, () => import("./webimage-
|
|
135604
|
+
addDecoder(7, () => import("./jpeg-f13e87d5.js").then((m) => m.default));
|
|
135605
|
+
addDecoder([8, 32946], () => import("./deflate-822f733b.js").then((m) => m.default));
|
|
135606
|
+
addDecoder(32773, () => import("./packbits-fbb728f4.js").then((m) => m.default));
|
|
135607
|
+
addDecoder(34887, () => import("./lerc-e0b9e6f7.js").then((m) => m.default));
|
|
135608
|
+
addDecoder(50001, () => import("./webimage-cf240654.js").then((m) => m.default));
|
|
135609
135609
|
function decodeRowAcc(row, stride) {
|
|
135610
135610
|
let length2 = row.length - stride;
|
|
135611
135611
|
let offset4 = 0;
|
|
@@ -144613,6 +144613,67 @@ function makeBoundingBox(viewState) {
|
|
|
144613
144613
|
viewport.unproject([0, viewport.height])
|
|
144614
144614
|
];
|
|
144615
144615
|
}
|
|
144616
|
+
const TARGETS = [1, 2, 3, 4, 5, 10, 20, 25, 50, 100, 200, 250, 500, 1e3];
|
|
144617
|
+
const MIN_TARGET = TARGETS[0];
|
|
144618
|
+
const MAX_TARGET = TARGETS[TARGETS.length - 1];
|
|
144619
|
+
const SI_PREFIXES = [
|
|
144620
|
+
{ symbol: "Y", exponent: 24 },
|
|
144621
|
+
{ symbol: "Z", exponent: 21 },
|
|
144622
|
+
{ symbol: "E", exponent: 18 },
|
|
144623
|
+
{ symbol: "P", exponent: 15 },
|
|
144624
|
+
{ symbol: "T", exponent: 12 },
|
|
144625
|
+
{ symbol: "G", exponent: 9 },
|
|
144626
|
+
{ symbol: "M", exponent: 6 },
|
|
144627
|
+
{ symbol: "k", exponent: 3 },
|
|
144628
|
+
{ symbol: "h", exponent: 2 },
|
|
144629
|
+
{ symbol: "da", exponent: 1 },
|
|
144630
|
+
{ symbol: "", exponent: 0 },
|
|
144631
|
+
{ symbol: "d", exponent: -1 },
|
|
144632
|
+
{ symbol: "c", exponent: -2 },
|
|
144633
|
+
{ symbol: "m", exponent: -3 },
|
|
144634
|
+
{ symbol: "µ", exponent: -6 },
|
|
144635
|
+
{ symbol: "n", exponent: -9 },
|
|
144636
|
+
{ symbol: "p", exponent: -12 },
|
|
144637
|
+
{ symbol: "f", exponent: -15 },
|
|
144638
|
+
{ symbol: "a", exponent: -18 },
|
|
144639
|
+
{ symbol: "z", exponent: -21 },
|
|
144640
|
+
{ symbol: "y", exponent: -24 }
|
|
144641
|
+
];
|
|
144642
|
+
function sizeToMeters(size, unit) {
|
|
144643
|
+
if (!unit || unit === "m") {
|
|
144644
|
+
return size;
|
|
144645
|
+
}
|
|
144646
|
+
if (unit.length > 1) {
|
|
144647
|
+
let unitPrefix = unit.substring(0, unit.length - 1);
|
|
144648
|
+
if (unitPrefix === "u") {
|
|
144649
|
+
unitPrefix = "µ";
|
|
144650
|
+
}
|
|
144651
|
+
const unitObj = SI_PREFIXES.find((p) => p.symbol === unitPrefix);
|
|
144652
|
+
if (unitObj) {
|
|
144653
|
+
return size * 10 ** unitObj.exponent;
|
|
144654
|
+
}
|
|
144655
|
+
}
|
|
144656
|
+
throw new Error("Received unknown unit");
|
|
144657
|
+
}
|
|
144658
|
+
function snapValue(value) {
|
|
144659
|
+
let magnitude = 0;
|
|
144660
|
+
if (value < MIN_TARGET || value > MAX_TARGET) {
|
|
144661
|
+
magnitude = Math.floor(Math.log10(value));
|
|
144662
|
+
}
|
|
144663
|
+
let snappedUnit = SI_PREFIXES.find(
|
|
144664
|
+
(p) => p.exponent % 3 === 0 && p.exponent <= magnitude
|
|
144665
|
+
);
|
|
144666
|
+
let adjustedValue = value / 10 ** snappedUnit.exponent;
|
|
144667
|
+
if (adjustedValue > 500 && adjustedValue <= 1e3) {
|
|
144668
|
+
snappedUnit = SI_PREFIXES.find(
|
|
144669
|
+
(p) => p.exponent % 3 === 0 && p.exponent <= magnitude + 3
|
|
144670
|
+
);
|
|
144671
|
+
adjustedValue = value / 10 ** snappedUnit.exponent;
|
|
144672
|
+
}
|
|
144673
|
+
const targetNewUnits = TARGETS.find((t2) => t2 > adjustedValue);
|
|
144674
|
+
const targetOrigUnits = targetNewUnits * 10 ** snappedUnit.exponent;
|
|
144675
|
+
return [targetOrigUnits, targetNewUnits, snappedUnit.symbol];
|
|
144676
|
+
}
|
|
144616
144677
|
const fs$1$1 = `#define SHADER_NAME xr-layer-fragment-shader
|
|
144617
144678
|
|
|
144618
144679
|
precision highp float;
|
|
@@ -145380,26 +145441,27 @@ const OverviewLayer = class extends CompositeLayer {
|
|
|
145380
145441
|
OverviewLayer.layerName = "OverviewLayer";
|
|
145381
145442
|
OverviewLayer.defaultProps = defaultProps$3;
|
|
145382
145443
|
function getPosition(boundingBox, position, length2) {
|
|
145383
|
-
const
|
|
145444
|
+
const viewWidth = boundingBox[2][0] - boundingBox[0][0];
|
|
145445
|
+
const viewHeight = boundingBox[2][1] - boundingBox[0][1];
|
|
145384
145446
|
switch (position) {
|
|
145385
145447
|
case "bottom-right": {
|
|
145386
|
-
const yCoord = boundingBox[2][1] -
|
|
145387
|
-
const xLeftCoord = boundingBox[2][0] -
|
|
145448
|
+
const yCoord = boundingBox[2][1] - viewHeight * length2;
|
|
145449
|
+
const xLeftCoord = boundingBox[2][0] - viewWidth * length2;
|
|
145388
145450
|
return [yCoord, xLeftCoord];
|
|
145389
145451
|
}
|
|
145390
145452
|
case "top-right": {
|
|
145391
|
-
const yCoord =
|
|
145392
|
-
const xLeftCoord = boundingBox[2][0] -
|
|
145453
|
+
const yCoord = boundingBox[0][1] + viewHeight * length2;
|
|
145454
|
+
const xLeftCoord = boundingBox[2][0] - viewWidth * length2;
|
|
145393
145455
|
return [yCoord, xLeftCoord];
|
|
145394
145456
|
}
|
|
145395
145457
|
case "top-left": {
|
|
145396
|
-
const yCoord =
|
|
145397
|
-
const xLeftCoord =
|
|
145458
|
+
const yCoord = boundingBox[0][1] + viewHeight * length2;
|
|
145459
|
+
const xLeftCoord = boundingBox[0][0] + viewWidth * length2;
|
|
145398
145460
|
return [yCoord, xLeftCoord];
|
|
145399
145461
|
}
|
|
145400
145462
|
case "bottom-left": {
|
|
145401
|
-
const yCoord = boundingBox[2][1] -
|
|
145402
|
-
const xLeftCoord =
|
|
145463
|
+
const yCoord = boundingBox[2][1] - viewHeight * length2;
|
|
145464
|
+
const xLeftCoord = boundingBox[0][0] + viewWidth * length2;
|
|
145403
145465
|
return [yCoord, xLeftCoord];
|
|
145404
145466
|
}
|
|
145405
145467
|
default: {
|
|
@@ -145417,11 +145479,12 @@ const defaultProps$2 = {
|
|
|
145417
145479
|
unit: { type: "string", value: "", compare: true },
|
|
145418
145480
|
size: { type: "number", value: 1, compare: true },
|
|
145419
145481
|
position: { type: "string", value: "bottom-right", compare: true },
|
|
145420
|
-
length: { type: "number", value: 0.085, compare: true }
|
|
145482
|
+
length: { type: "number", value: 0.085, compare: true },
|
|
145483
|
+
snap: { type: "boolean", value: false, compare: true }
|
|
145421
145484
|
};
|
|
145422
145485
|
const ScaleBarLayer = class extends CompositeLayer {
|
|
145423
145486
|
renderLayers() {
|
|
145424
|
-
const { id, unit, size, position, viewState, length: length2 } = this.props;
|
|
145487
|
+
const { id, unit, size, position, viewState, length: length2, snap } = this.props;
|
|
145425
145488
|
const boundingBox = makeBoundingBox(viewState);
|
|
145426
145489
|
const { zoom } = viewState;
|
|
145427
145490
|
const viewLength = boundingBox[2][0] - boundingBox[0][0];
|
|
@@ -145430,15 +145493,27 @@ const ScaleBarLayer = class extends CompositeLayer {
|
|
|
145430
145493
|
2 ** (-zoom + 1.5),
|
|
145431
145494
|
(boundingBox[2][1] - boundingBox[0][1]) * 7e-3
|
|
145432
145495
|
);
|
|
145433
|
-
|
|
145496
|
+
let adjustedBarLength = barLength;
|
|
145497
|
+
let displayNumber = (barLength * size).toPrecision(5);
|
|
145498
|
+
let displayUnit = unit;
|
|
145499
|
+
if (snap) {
|
|
145500
|
+
const meterSize = sizeToMeters(size, unit);
|
|
145501
|
+
const numUnits = barLength * meterSize;
|
|
145502
|
+
const [snappedOrigUnits, snappedNewUnits, snappedUnitPrefix] = snapValue(numUnits);
|
|
145503
|
+
adjustedBarLength = snappedOrigUnits / meterSize;
|
|
145504
|
+
displayNumber = snappedNewUnits;
|
|
145505
|
+
displayUnit = `${snappedUnitPrefix}m`;
|
|
145506
|
+
}
|
|
145434
145507
|
const [yCoord, xLeftCoord] = getPosition(boundingBox, position, length2);
|
|
145508
|
+
const xRightCoord = xLeftCoord + barLength;
|
|
145509
|
+
const isLeft = position.endsWith("-left");
|
|
145435
145510
|
const lengthBar = new LineLayer({
|
|
145436
145511
|
id: `scale-bar-length-${id}`,
|
|
145437
145512
|
coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,
|
|
145438
145513
|
data: [
|
|
145439
145514
|
[
|
|
145440
|
-
[xLeftCoord, yCoord],
|
|
145441
|
-
[xLeftCoord +
|
|
145515
|
+
[isLeft ? xLeftCoord : xRightCoord - adjustedBarLength, yCoord],
|
|
145516
|
+
[isLeft ? xLeftCoord + adjustedBarLength : xRightCoord, yCoord]
|
|
145442
145517
|
]
|
|
145443
145518
|
],
|
|
145444
145519
|
getSourcePosition: (d) => d[0],
|
|
@@ -145451,8 +145526,14 @@ const ScaleBarLayer = class extends CompositeLayer {
|
|
|
145451
145526
|
coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,
|
|
145452
145527
|
data: [
|
|
145453
145528
|
[
|
|
145454
|
-
[
|
|
145455
|
-
|
|
145529
|
+
[
|
|
145530
|
+
isLeft ? xLeftCoord : xRightCoord - adjustedBarLength,
|
|
145531
|
+
yCoord - barHeight
|
|
145532
|
+
],
|
|
145533
|
+
[
|
|
145534
|
+
isLeft ? xLeftCoord : xRightCoord - adjustedBarLength,
|
|
145535
|
+
yCoord + barHeight
|
|
145536
|
+
]
|
|
145456
145537
|
]
|
|
145457
145538
|
],
|
|
145458
145539
|
getSourcePosition: (d) => d[0],
|
|
@@ -145465,8 +145546,14 @@ const ScaleBarLayer = class extends CompositeLayer {
|
|
|
145465
145546
|
coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,
|
|
145466
145547
|
data: [
|
|
145467
145548
|
[
|
|
145468
|
-
[
|
|
145469
|
-
|
|
145549
|
+
[
|
|
145550
|
+
isLeft ? xLeftCoord + adjustedBarLength : xRightCoord,
|
|
145551
|
+
yCoord - barHeight
|
|
145552
|
+
],
|
|
145553
|
+
[
|
|
145554
|
+
isLeft ? xLeftCoord + adjustedBarLength : xRightCoord,
|
|
145555
|
+
yCoord + barHeight
|
|
145556
|
+
]
|
|
145470
145557
|
]
|
|
145471
145558
|
],
|
|
145472
145559
|
getSourcePosition: (d) => d[0],
|
|
@@ -145479,8 +145566,11 @@ const ScaleBarLayer = class extends CompositeLayer {
|
|
|
145479
145566
|
coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,
|
|
145480
145567
|
data: [
|
|
145481
145568
|
{
|
|
145482
|
-
text:
|
|
145483
|
-
position: [
|
|
145569
|
+
text: `${displayNumber}${displayUnit}`,
|
|
145570
|
+
position: [
|
|
145571
|
+
isLeft ? xLeftCoord + barLength * 0.5 : xRightCoord - barLength * 0.5,
|
|
145572
|
+
yCoord + barHeight * 4
|
|
145573
|
+
]
|
|
145484
145574
|
}
|
|
145485
145575
|
],
|
|
145486
145576
|
getColor: [220, 220, 220, 255],
|
|
@@ -145489,7 +145579,7 @@ const ScaleBarLayer = class extends CompositeLayer {
|
|
|
145489
145579
|
sizeUnits: "meters",
|
|
145490
145580
|
sizeScale: 2 ** -zoom,
|
|
145491
145581
|
characterSet: [
|
|
145492
|
-
...
|
|
145582
|
+
...displayUnit.split(""),
|
|
145493
145583
|
...range(10).map((i2) => String(i2)),
|
|
145494
145584
|
".",
|
|
145495
145585
|
"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-a79502da.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/layer-controller",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.2",
|
|
4
4
|
"author": "Gehlenborg Lab",
|
|
5
5
|
"homepage": "http://vitessce.io",
|
|
6
6
|
"repository": {
|
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
"lodash-es": "^4.17.21",
|
|
22
22
|
"math.gl": "^3.5.6",
|
|
23
23
|
"react-aria": "^3.28.0",
|
|
24
|
-
"@vitessce/
|
|
25
|
-
"@vitessce/
|
|
26
|
-
"@vitessce/spatial-utils": "3.2.
|
|
27
|
-
"@vitessce/utils": "3.2.
|
|
28
|
-
"@vitessce/vit-s": "3.2.
|
|
24
|
+
"@vitessce/gl": "3.2.2",
|
|
25
|
+
"@vitessce/constants-internal": "3.2.2",
|
|
26
|
+
"@vitessce/spatial-utils": "3.2.2",
|
|
27
|
+
"@vitessce/utils": "3.2.2",
|
|
28
|
+
"@vitessce/vit-s": "3.2.2"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"react": "^18.0.0",
|