@vitessce/scatterplot 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-4c27e1be.js → deflate-d451b100.js} +1 -1
- package/dist/{index-dee2d8c8.js → index-a703efd5.js} +118 -28
- package/dist/index.js +1 -1
- package/dist/{jpeg-229281af.js → jpeg-61cd3c68.js} +1 -1
- package/dist/{lerc-9e647d79.js → lerc-bdc18460.js} +1 -1
- package/dist/{lzw-2e11138a.js → lzw-038a2f32.js} +1 -1
- package/dist/{packbits-34cdac05.js → packbits-f6194869.js} +1 -1
- package/dist/{raw-509b9ed8.js → raw-0c6dd216.js} +1 -1
- package/dist/{webimage-5aedafc5.js → webimage-a4c2e646.js} +1 -1
- package/package.json +7 -7
|
@@ -104715,16 +104715,16 @@ function addDecoder(cases, importFn) {
|
|
|
104715
104715
|
}
|
|
104716
104716
|
cases.forEach((c2) => registry$1.set(c2, importFn));
|
|
104717
104717
|
}
|
|
104718
|
-
addDecoder([void 0, 1], () => import("./raw-
|
|
104719
|
-
addDecoder(5, () => import("./lzw-
|
|
104718
|
+
addDecoder([void 0, 1], () => import("./raw-0c6dd216.js").then((m2) => m2.default));
|
|
104719
|
+
addDecoder(5, () => import("./lzw-038a2f32.js").then((m2) => m2.default));
|
|
104720
104720
|
addDecoder(6, () => {
|
|
104721
104721
|
throw new Error("old style JPEG compression is not supported.");
|
|
104722
104722
|
});
|
|
104723
|
-
addDecoder(7, () => import("./jpeg-
|
|
104724
|
-
addDecoder([8, 32946], () => import("./deflate-
|
|
104725
|
-
addDecoder(32773, () => import("./packbits-
|
|
104726
|
-
addDecoder(34887, () => import("./lerc-
|
|
104727
|
-
addDecoder(50001, () => import("./webimage-
|
|
104723
|
+
addDecoder(7, () => import("./jpeg-61cd3c68.js").then((m2) => m2.default));
|
|
104724
|
+
addDecoder([8, 32946], () => import("./deflate-d451b100.js").then((m2) => m2.default));
|
|
104725
|
+
addDecoder(32773, () => import("./packbits-f6194869.js").then((m2) => m2.default));
|
|
104726
|
+
addDecoder(34887, () => import("./lerc-bdc18460.js").then((m2) => m2.default));
|
|
104727
|
+
addDecoder(50001, () => import("./webimage-a4c2e646.js").then((m2) => m2.default));
|
|
104728
104728
|
function decodeRowAcc(row, stride) {
|
|
104729
104729
|
let length2 = row.length - stride;
|
|
104730
104730
|
let offset5 = 0;
|
|
@@ -113624,6 +113624,67 @@ function makeBoundingBox(viewState) {
|
|
|
113624
113624
|
viewport.unproject([0, viewport.height])
|
|
113625
113625
|
];
|
|
113626
113626
|
}
|
|
113627
|
+
const TARGETS = [1, 2, 3, 4, 5, 10, 20, 25, 50, 100, 200, 250, 500, 1e3];
|
|
113628
|
+
const MIN_TARGET = TARGETS[0];
|
|
113629
|
+
const MAX_TARGET = TARGETS[TARGETS.length - 1];
|
|
113630
|
+
const SI_PREFIXES = [
|
|
113631
|
+
{ symbol: "Y", exponent: 24 },
|
|
113632
|
+
{ symbol: "Z", exponent: 21 },
|
|
113633
|
+
{ symbol: "E", exponent: 18 },
|
|
113634
|
+
{ symbol: "P", exponent: 15 },
|
|
113635
|
+
{ symbol: "T", exponent: 12 },
|
|
113636
|
+
{ symbol: "G", exponent: 9 },
|
|
113637
|
+
{ symbol: "M", exponent: 6 },
|
|
113638
|
+
{ symbol: "k", exponent: 3 },
|
|
113639
|
+
{ symbol: "h", exponent: 2 },
|
|
113640
|
+
{ symbol: "da", exponent: 1 },
|
|
113641
|
+
{ symbol: "", exponent: 0 },
|
|
113642
|
+
{ symbol: "d", exponent: -1 },
|
|
113643
|
+
{ symbol: "c", exponent: -2 },
|
|
113644
|
+
{ symbol: "m", exponent: -3 },
|
|
113645
|
+
{ symbol: "µ", exponent: -6 },
|
|
113646
|
+
{ symbol: "n", exponent: -9 },
|
|
113647
|
+
{ symbol: "p", exponent: -12 },
|
|
113648
|
+
{ symbol: "f", exponent: -15 },
|
|
113649
|
+
{ symbol: "a", exponent: -18 },
|
|
113650
|
+
{ symbol: "z", exponent: -21 },
|
|
113651
|
+
{ symbol: "y", exponent: -24 }
|
|
113652
|
+
];
|
|
113653
|
+
function sizeToMeters(size, unit) {
|
|
113654
|
+
if (!unit || unit === "m") {
|
|
113655
|
+
return size;
|
|
113656
|
+
}
|
|
113657
|
+
if (unit.length > 1) {
|
|
113658
|
+
let unitPrefix = unit.substring(0, unit.length - 1);
|
|
113659
|
+
if (unitPrefix === "u") {
|
|
113660
|
+
unitPrefix = "µ";
|
|
113661
|
+
}
|
|
113662
|
+
const unitObj = SI_PREFIXES.find((p) => p.symbol === unitPrefix);
|
|
113663
|
+
if (unitObj) {
|
|
113664
|
+
return size * 10 ** unitObj.exponent;
|
|
113665
|
+
}
|
|
113666
|
+
}
|
|
113667
|
+
throw new Error("Received unknown unit");
|
|
113668
|
+
}
|
|
113669
|
+
function snapValue(value) {
|
|
113670
|
+
let magnitude = 0;
|
|
113671
|
+
if (value < MIN_TARGET || value > MAX_TARGET) {
|
|
113672
|
+
magnitude = Math.floor(Math.log10(value));
|
|
113673
|
+
}
|
|
113674
|
+
let snappedUnit = SI_PREFIXES.find(
|
|
113675
|
+
(p) => p.exponent % 3 === 0 && p.exponent <= magnitude
|
|
113676
|
+
);
|
|
113677
|
+
let adjustedValue = value / 10 ** snappedUnit.exponent;
|
|
113678
|
+
if (adjustedValue > 500 && adjustedValue <= 1e3) {
|
|
113679
|
+
snappedUnit = SI_PREFIXES.find(
|
|
113680
|
+
(p) => p.exponent % 3 === 0 && p.exponent <= magnitude + 3
|
|
113681
|
+
);
|
|
113682
|
+
adjustedValue = value / 10 ** snappedUnit.exponent;
|
|
113683
|
+
}
|
|
113684
|
+
const targetNewUnits = TARGETS.find((t2) => t2 > adjustedValue);
|
|
113685
|
+
const targetOrigUnits = targetNewUnits * 10 ** snappedUnit.exponent;
|
|
113686
|
+
return [targetOrigUnits, targetNewUnits, snappedUnit.symbol];
|
|
113687
|
+
}
|
|
113627
113688
|
const fs$1$1 = `#define SHADER_NAME xr-layer-fragment-shader
|
|
113628
113689
|
|
|
113629
113690
|
precision highp float;
|
|
@@ -114391,26 +114452,27 @@ const OverviewLayer = class extends CompositeLayer {
|
|
|
114391
114452
|
OverviewLayer.layerName = "OverviewLayer";
|
|
114392
114453
|
OverviewLayer.defaultProps = defaultProps$3;
|
|
114393
114454
|
function getPosition$1(boundingBox, position, length2) {
|
|
114394
|
-
const
|
|
114455
|
+
const viewWidth = boundingBox[2][0] - boundingBox[0][0];
|
|
114456
|
+
const viewHeight = boundingBox[2][1] - boundingBox[0][1];
|
|
114395
114457
|
switch (position) {
|
|
114396
114458
|
case "bottom-right": {
|
|
114397
|
-
const yCoord = boundingBox[2][1] -
|
|
114398
|
-
const xLeftCoord = boundingBox[2][0] -
|
|
114459
|
+
const yCoord = boundingBox[2][1] - viewHeight * length2;
|
|
114460
|
+
const xLeftCoord = boundingBox[2][0] - viewWidth * length2;
|
|
114399
114461
|
return [yCoord, xLeftCoord];
|
|
114400
114462
|
}
|
|
114401
114463
|
case "top-right": {
|
|
114402
|
-
const yCoord =
|
|
114403
|
-
const xLeftCoord = boundingBox[2][0] -
|
|
114464
|
+
const yCoord = boundingBox[0][1] + viewHeight * length2;
|
|
114465
|
+
const xLeftCoord = boundingBox[2][0] - viewWidth * length2;
|
|
114404
114466
|
return [yCoord, xLeftCoord];
|
|
114405
114467
|
}
|
|
114406
114468
|
case "top-left": {
|
|
114407
|
-
const yCoord =
|
|
114408
|
-
const xLeftCoord =
|
|
114469
|
+
const yCoord = boundingBox[0][1] + viewHeight * length2;
|
|
114470
|
+
const xLeftCoord = boundingBox[0][0] + viewWidth * length2;
|
|
114409
114471
|
return [yCoord, xLeftCoord];
|
|
114410
114472
|
}
|
|
114411
114473
|
case "bottom-left": {
|
|
114412
|
-
const yCoord = boundingBox[2][1] -
|
|
114413
|
-
const xLeftCoord =
|
|
114474
|
+
const yCoord = boundingBox[2][1] - viewHeight * length2;
|
|
114475
|
+
const xLeftCoord = boundingBox[0][0] + viewWidth * length2;
|
|
114414
114476
|
return [yCoord, xLeftCoord];
|
|
114415
114477
|
}
|
|
114416
114478
|
default: {
|
|
@@ -114428,11 +114490,12 @@ const defaultProps$2$1 = {
|
|
|
114428
114490
|
unit: { type: "string", value: "", compare: true },
|
|
114429
114491
|
size: { type: "number", value: 1, compare: true },
|
|
114430
114492
|
position: { type: "string", value: "bottom-right", compare: true },
|
|
114431
|
-
length: { type: "number", value: 0.085, compare: true }
|
|
114493
|
+
length: { type: "number", value: 0.085, compare: true },
|
|
114494
|
+
snap: { type: "boolean", value: false, compare: true }
|
|
114432
114495
|
};
|
|
114433
114496
|
const ScaleBarLayer = class extends CompositeLayer {
|
|
114434
114497
|
renderLayers() {
|
|
114435
|
-
const { id, unit, size, position, viewState, length: length2 } = this.props;
|
|
114498
|
+
const { id, unit, size, position, viewState, length: length2, snap } = this.props;
|
|
114436
114499
|
const boundingBox = makeBoundingBox(viewState);
|
|
114437
114500
|
const { zoom } = viewState;
|
|
114438
114501
|
const viewLength = boundingBox[2][0] - boundingBox[0][0];
|
|
@@ -114441,15 +114504,27 @@ const ScaleBarLayer = class extends CompositeLayer {
|
|
|
114441
114504
|
2 ** (-zoom + 1.5),
|
|
114442
114505
|
(boundingBox[2][1] - boundingBox[0][1]) * 7e-3
|
|
114443
114506
|
);
|
|
114444
|
-
|
|
114507
|
+
let adjustedBarLength = barLength;
|
|
114508
|
+
let displayNumber = (barLength * size).toPrecision(5);
|
|
114509
|
+
let displayUnit = unit;
|
|
114510
|
+
if (snap) {
|
|
114511
|
+
const meterSize = sizeToMeters(size, unit);
|
|
114512
|
+
const numUnits = barLength * meterSize;
|
|
114513
|
+
const [snappedOrigUnits, snappedNewUnits, snappedUnitPrefix] = snapValue(numUnits);
|
|
114514
|
+
adjustedBarLength = snappedOrigUnits / meterSize;
|
|
114515
|
+
displayNumber = snappedNewUnits;
|
|
114516
|
+
displayUnit = `${snappedUnitPrefix}m`;
|
|
114517
|
+
}
|
|
114445
114518
|
const [yCoord, xLeftCoord] = getPosition$1(boundingBox, position, length2);
|
|
114519
|
+
const xRightCoord = xLeftCoord + barLength;
|
|
114520
|
+
const isLeft = position.endsWith("-left");
|
|
114446
114521
|
const lengthBar = new LineLayer({
|
|
114447
114522
|
id: `scale-bar-length-${id}`,
|
|
114448
114523
|
coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,
|
|
114449
114524
|
data: [
|
|
114450
114525
|
[
|
|
114451
|
-
[xLeftCoord, yCoord],
|
|
114452
|
-
[xLeftCoord +
|
|
114526
|
+
[isLeft ? xLeftCoord : xRightCoord - adjustedBarLength, yCoord],
|
|
114527
|
+
[isLeft ? xLeftCoord + adjustedBarLength : xRightCoord, yCoord]
|
|
114453
114528
|
]
|
|
114454
114529
|
],
|
|
114455
114530
|
getSourcePosition: (d) => d[0],
|
|
@@ -114462,8 +114537,14 @@ const ScaleBarLayer = class extends CompositeLayer {
|
|
|
114462
114537
|
coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,
|
|
114463
114538
|
data: [
|
|
114464
114539
|
[
|
|
114465
|
-
[
|
|
114466
|
-
|
|
114540
|
+
[
|
|
114541
|
+
isLeft ? xLeftCoord : xRightCoord - adjustedBarLength,
|
|
114542
|
+
yCoord - barHeight
|
|
114543
|
+
],
|
|
114544
|
+
[
|
|
114545
|
+
isLeft ? xLeftCoord : xRightCoord - adjustedBarLength,
|
|
114546
|
+
yCoord + barHeight
|
|
114547
|
+
]
|
|
114467
114548
|
]
|
|
114468
114549
|
],
|
|
114469
114550
|
getSourcePosition: (d) => d[0],
|
|
@@ -114476,8 +114557,14 @@ const ScaleBarLayer = class extends CompositeLayer {
|
|
|
114476
114557
|
coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,
|
|
114477
114558
|
data: [
|
|
114478
114559
|
[
|
|
114479
|
-
[
|
|
114480
|
-
|
|
114560
|
+
[
|
|
114561
|
+
isLeft ? xLeftCoord + adjustedBarLength : xRightCoord,
|
|
114562
|
+
yCoord - barHeight
|
|
114563
|
+
],
|
|
114564
|
+
[
|
|
114565
|
+
isLeft ? xLeftCoord + adjustedBarLength : xRightCoord,
|
|
114566
|
+
yCoord + barHeight
|
|
114567
|
+
]
|
|
114481
114568
|
]
|
|
114482
114569
|
],
|
|
114483
114570
|
getSourcePosition: (d) => d[0],
|
|
@@ -114490,8 +114577,11 @@ const ScaleBarLayer = class extends CompositeLayer {
|
|
|
114490
114577
|
coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,
|
|
114491
114578
|
data: [
|
|
114492
114579
|
{
|
|
114493
|
-
text:
|
|
114494
|
-
position: [
|
|
114580
|
+
text: `${displayNumber}${displayUnit}`,
|
|
114581
|
+
position: [
|
|
114582
|
+
isLeft ? xLeftCoord + barLength * 0.5 : xRightCoord - barLength * 0.5,
|
|
114583
|
+
yCoord + barHeight * 4
|
|
114584
|
+
]
|
|
114495
114585
|
}
|
|
114496
114586
|
],
|
|
114497
114587
|
getColor: [220, 220, 220, 255],
|
|
@@ -114500,7 +114590,7 @@ const ScaleBarLayer = class extends CompositeLayer {
|
|
|
114500
114590
|
sizeUnits: "meters",
|
|
114501
114591
|
sizeScale: 2 ** -zoom,
|
|
114502
114592
|
characterSet: [
|
|
114503
|
-
...
|
|
114593
|
+
...displayUnit.split(""),
|
|
114504
114594
|
...range$3(10).map((i2) => String(i2)),
|
|
114505
114595
|
".",
|
|
114506
114596
|
"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-a703efd5.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/scatterplot",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.2",
|
|
4
4
|
"author": "Gehlenborg Lab",
|
|
5
5
|
"homepage": "http://vitessce.io",
|
|
6
6
|
"repository": {
|
|
@@ -23,12 +23,12 @@
|
|
|
23
23
|
"d3-quadtree": "^1.0.7",
|
|
24
24
|
"lodash-es": "^4.17.21",
|
|
25
25
|
"react-aria": "^3.28.0",
|
|
26
|
-
"@vitessce/constants-internal": "3.2.
|
|
27
|
-
"@vitessce/gl": "3.2.
|
|
28
|
-
"@vitessce/icons": "3.2.
|
|
29
|
-
"@vitessce/tooltip": "3.2.
|
|
30
|
-
"@vitessce/utils": "3.2.
|
|
31
|
-
"@vitessce/vit-s": "3.2.
|
|
26
|
+
"@vitessce/constants-internal": "3.2.2",
|
|
27
|
+
"@vitessce/gl": "3.2.2",
|
|
28
|
+
"@vitessce/icons": "3.2.2",
|
|
29
|
+
"@vitessce/tooltip": "3.2.2",
|
|
30
|
+
"@vitessce/utils": "3.2.2",
|
|
31
|
+
"@vitessce/vit-s": "3.2.2"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@testing-library/jest-dom": "^5.16.4",
|