@vitessce/all 3.7.0 → 3.7.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/dist/{ReactNeuroglancer-BpcoB8DB.js → ReactNeuroglancer-CNzkD33k.js} +685 -1253
- package/dist/{deflate-BBMKTz2g.js → deflate-D7qntYPm.js} +1 -1
- package/dist/{higlass-B_AWXOCq.js → higlass-B5Yf-THY.js} +1 -1
- package/dist/{index-BA75p4LU.js → index-Ci947y1K.js} +95822 -95643
- package/dist/{index-DACGBjAj.js → index-DqDDC59y.js} +2 -2
- package/dist/index.js +8 -8
- package/dist/{jpeg-Cwjje9qZ.js → jpeg-23ExE8ad.js} +1 -1
- package/dist/{lerc-DFFWU0hB.js → lerc-BPNFjya5.js} +1 -1
- package/dist/{lzw-BGHh3Z1W.js → lzw-CR9bmrUA.js} +1 -1
- package/dist/{packbits-DHm2eZzf.js → packbits-yEwcRYhH.js} +1 -1
- package/dist/{raw-DkfPWf-5.js → raw-Day99mnL.js} +1 -1
- package/dist/{troika-three-text.esm-D4iV8K4b.js → troika-three-text.esm-orFZa6y_.js} +1 -1
- package/dist/{webimage-CrPoveU-.js → webimage-CmvCEz7r.js} +1 -1
- package/package.json +32 -32
@@ -1,6 +1,5 @@
|
|
1
|
-
import { g as getDefaultExportFromCjs, aV as requireAssign, aW as require_export, aX as require_core, aY as require_fails, aZ as require_toObject, a_ as require_objectKeys, a$ as require_cof, b0 as require_wks, b1 as require_iterators, b2 as requireWeb_dom_iterable, b3 as requireEs6_string_iterator, b4 as require_anObject, b5 as require_hide, b6 as require_ctx, b7 as require_toLength, b8 as require_global, b9 as require_objectDp, ba as require_descriptors, bb as require_isObject, bc as require_objectCreate, bd as require_iterDefine, be as require_iterStep, bf as require_meta, bg as require_isArray, bh as require_iobject, bi as require_setToStringTag, bj as require_aFunction, bk as requireIterator, bl as require_propertyDesc, aS as commonjsGlobal, bm as requireEs6_symbol, bn as requireDefineProperty, bo as require_toIobject, bp as require_objectGopd, bq as require_html, br as require_domCreate, bs as require_library, bt as requireSymbol, bu as require_objectPie, bv as require_has, bw as require_redefine, bx as require_objectAssign, by as
|
1
|
+
import { g as getDefaultExportFromCjs, aV as requireAssign, aW as require_export, aX as require_core, aY as require_fails, aZ as require_toObject, a_ as require_objectKeys, a$ as require_cof, b0 as require_wks, b1 as require_iterators, b2 as requireWeb_dom_iterable, b3 as requireEs6_string_iterator, b4 as require_anObject, b5 as require_hide, b6 as require_ctx, b7 as require_toLength, b8 as require_global, b9 as require_objectDp, ba as require_descriptors, bb as require_isObject, bc as require_objectCreate, bd as require_iterDefine, be as require_iterStep, bf as require_meta, bg as require_isArray, bh as require_iobject, bi as require_setToStringTag, bj as require_aFunction, bk as requireIterator, bl as require_propertyDesc, aS as commonjsGlobal, bm as requireEs6_symbol, bn as requireDefineProperty, bo as require_toIobject, bp as require_objectGopd, bq as require_html, br as require_domCreate, bs as require_library, bt as requireSymbol, bu as require_objectPie, bv as require_has, bw as require_redefine, bx as require_objectAssign, by as diffCameraState, aI as jsxRuntimeExports } from "./index-Ci947y1K.js";
|
2
2
|
import React__default from "react";
|
3
|
-
var lib = {};
|
4
3
|
var assignExports = requireAssign();
|
5
4
|
const _Object$assign = /* @__PURE__ */ getDefaultExportFromCjs(assignExports);
|
6
5
|
var es6_object_keys = {};
|
@@ -887,7 +886,7 @@ function requireEs6_set() {
|
|
887
886
|
var validate = require_validateCollection();
|
888
887
|
var SET = "Set";
|
889
888
|
es6_set = require_collection()(SET, function(get) {
|
890
|
-
return function
|
889
|
+
return function Set2() {
|
891
890
|
return get(this, arguments.length > 0 ? arguments[0] : void 0);
|
892
891
|
};
|
893
892
|
}, {
|
@@ -1291,8 +1290,8 @@ function require_Symbol() {
|
|
1291
1290
|
if (hasRequired_Symbol) return _Symbol$1;
|
1292
1291
|
hasRequired_Symbol = 1;
|
1293
1292
|
var root = require_root();
|
1294
|
-
var
|
1295
|
-
_Symbol$1 =
|
1293
|
+
var Symbol = root.Symbol;
|
1294
|
+
_Symbol$1 = Symbol;
|
1296
1295
|
return _Symbol$1;
|
1297
1296
|
}
|
1298
1297
|
var _getRawTag;
|
@@ -1300,11 +1299,11 @@ var hasRequired_getRawTag;
|
|
1300
1299
|
function require_getRawTag() {
|
1301
1300
|
if (hasRequired_getRawTag) return _getRawTag;
|
1302
1301
|
hasRequired_getRawTag = 1;
|
1303
|
-
var
|
1302
|
+
var Symbol = require_Symbol();
|
1304
1303
|
var objectProto = Object.prototype;
|
1305
1304
|
var hasOwnProperty = objectProto.hasOwnProperty;
|
1306
1305
|
var nativeObjectToString = objectProto.toString;
|
1307
|
-
var symToStringTag =
|
1306
|
+
var symToStringTag = Symbol ? Symbol.toStringTag : void 0;
|
1308
1307
|
function getRawTag(value) {
|
1309
1308
|
var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag];
|
1310
1309
|
try {
|
@@ -1343,9 +1342,9 @@ var hasRequired_baseGetTag;
|
|
1343
1342
|
function require_baseGetTag() {
|
1344
1343
|
if (hasRequired_baseGetTag) return _baseGetTag;
|
1345
1344
|
hasRequired_baseGetTag = 1;
|
1346
|
-
var
|
1345
|
+
var Symbol = require_Symbol(), getRawTag = require_getRawTag(), objectToString = require_objectToString();
|
1347
1346
|
var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
|
1348
|
-
var symToStringTag =
|
1347
|
+
var symToStringTag = Symbol ? Symbol.toStringTag : void 0;
|
1349
1348
|
function baseGetTag(value) {
|
1350
1349
|
if (value == null) {
|
1351
1350
|
return value === void 0 ? undefinedTag : nullTag;
|
@@ -3217,8 +3216,8 @@ function serializeColor(x) {
|
|
3217
3216
|
function srgbGammaExpand(value) {
|
3218
3217
|
return value <= 0.03928 ? value / 12.92 : ((value + 0.055) / 1.055) ** 2.4;
|
3219
3218
|
}
|
3220
|
-
function getRelativeLuminance(
|
3221
|
-
var _color = _slicedToArray(
|
3219
|
+
function getRelativeLuminance(color) {
|
3220
|
+
var _color = _slicedToArray(color, 3);
|
3222
3221
|
const r = _color[0], g = _color[1], b = _color[2];
|
3223
3222
|
return 0.2126 * srgbGammaExpand(r) + 0.7152 * srgbGammaExpand(g) + 0.0722 * srgbGammaExpand(b);
|
3224
3223
|
}
|
@@ -3279,21 +3278,6 @@ class TrackableOptionalRGB extends WatchableValue {
|
|
3279
3278
|
}
|
3280
3279
|
}
|
3281
3280
|
}
|
3282
|
-
const color = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
3283
|
-
__proto__: null,
|
3284
|
-
TrackableOptionalRGB,
|
3285
|
-
TrackableRGB,
|
3286
|
-
getRelativeLuminance,
|
3287
|
-
packColor,
|
3288
|
-
parseColorSerialization,
|
3289
|
-
parseRGBAColorSpecification,
|
3290
|
-
parseRGBColorSpecification,
|
3291
|
-
serializeColor,
|
3292
|
-
srgbGammaExpand,
|
3293
|
-
unpackRGB,
|
3294
|
-
unpackRGBA,
|
3295
|
-
useWhiteBackground
|
3296
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
3297
3281
|
/**
|
3298
3282
|
* @license
|
3299
3283
|
* Copyright 2016 Google Inc.
|
@@ -3614,73 +3598,10 @@ function stableStringify(x) {
|
|
3614
3598
|
}
|
3615
3599
|
return _JSON$stringify(x);
|
3616
3600
|
}
|
3617
|
-
function swapQuotes(x) {
|
3618
|
-
return x.replace(/['"]/g, (s) => {
|
3619
|
-
return s === '"' ? "'" : '"';
|
3620
|
-
});
|
3621
|
-
}
|
3622
|
-
function urlSafeStringifyString(x) {
|
3623
|
-
return swapQuotes(_JSON$stringify(swapQuotes(x)));
|
3624
|
-
}
|
3625
|
-
const URL_SAFE_COMMA = "_";
|
3626
|
-
function urlSafeStringify(x) {
|
3627
|
-
if (typeof x === "object") {
|
3628
|
-
if (x === null) {
|
3629
|
-
return "null";
|
3630
|
-
}
|
3631
|
-
let toJSON = x["toJSON"];
|
3632
|
-
if (typeof toJSON === "function") {
|
3633
|
-
return urlSafeStringify(toJSON.call(x));
|
3634
|
-
}
|
3635
|
-
if (Array.isArray(x)) {
|
3636
|
-
let s2 = "[";
|
3637
|
-
let size = x.length;
|
3638
|
-
let i = 0;
|
3639
|
-
if (i < size) {
|
3640
|
-
s2 += urlSafeStringify(x[i]);
|
3641
|
-
while (++i < size) {
|
3642
|
-
s2 += URL_SAFE_COMMA;
|
3643
|
-
s2 += urlSafeStringify(x[i]);
|
3644
|
-
}
|
3645
|
-
}
|
3646
|
-
s2 += "]";
|
3647
|
-
return s2;
|
3648
|
-
}
|
3649
|
-
let s = "{";
|
3650
|
-
let keys2 = _Object$keys(x);
|
3651
|
-
let first = true;
|
3652
|
-
for (let key of keys2) {
|
3653
|
-
let value = x[key];
|
3654
|
-
if (value === void 0) {
|
3655
|
-
continue;
|
3656
|
-
}
|
3657
|
-
let valueString = urlSafeStringify(value);
|
3658
|
-
if (!valueString) {
|
3659
|
-
continue;
|
3660
|
-
}
|
3661
|
-
if (!first) {
|
3662
|
-
s += URL_SAFE_COMMA;
|
3663
|
-
} else {
|
3664
|
-
first = false;
|
3665
|
-
}
|
3666
|
-
s += urlSafeStringifyString(key);
|
3667
|
-
s += ":";
|
3668
|
-
s += valueString;
|
3669
|
-
}
|
3670
|
-
s += "}";
|
3671
|
-
return s;
|
3672
|
-
}
|
3673
|
-
if (typeof x === "string") {
|
3674
|
-
return urlSafeStringifyString(x);
|
3675
|
-
}
|
3676
|
-
return _JSON$stringify(x);
|
3677
|
-
}
|
3678
3601
|
const SINGLE_QUOTE_STRING_PATTERN = /('(?:[^'\\]|(?:\\.))*')/;
|
3679
3602
|
const DOUBLE_QUOTE_STRING_PATTERN = /("(?:[^"\\]|(?:\\.))*")/;
|
3680
3603
|
const SINGLE_OR_DOUBLE_QUOTE_STRING_PATTERN = new RegExp(`${SINGLE_QUOTE_STRING_PATTERN.source}|${DOUBLE_QUOTE_STRING_PATTERN.source}`);
|
3681
|
-
const DOUBLE_OR_SINGLE_QUOTE_STRING_PATTERN = new RegExp(`${DOUBLE_QUOTE_STRING_PATTERN.source}|${SINGLE_QUOTE_STRING_PATTERN.source}`);
|
3682
3604
|
const DOUBLE_QUOTE_PATTERN = /^((?:[^"'\\]|(?:\\[^']))*)("|\\')/;
|
3683
|
-
const SINGLE_QUOTE_PATTERN = /^((?:[^"'\\]|(?:\\.))*)'/;
|
3684
3605
|
function convertStringLiteral(x, quoteInitial, quoteReplace, quoteSearch) {
|
3685
3606
|
if (x.length >= 2 && x.charAt(0) === quoteInitial && x.charAt(x.length - 1) === quoteInitial) {
|
3686
3607
|
let inner = x.substr(1, x.length - 2);
|
@@ -3705,22 +3626,15 @@ function convertStringLiteral(x, quoteInitial, quoteReplace, quoteSearch) {
|
|
3705
3626
|
}
|
3706
3627
|
return x;
|
3707
3628
|
}
|
3708
|
-
function normalizeStringLiteral(x) {
|
3709
|
-
return convertStringLiteral(x, "'", '"', DOUBLE_QUOTE_PATTERN);
|
3710
|
-
}
|
3711
3629
|
function convertJsonHelper(x, desiredCommaChar, desiredQuoteChar) {
|
3712
3630
|
const commaSearch = /[&_,]/g;
|
3713
3631
|
let quoteInitial;
|
3714
3632
|
let quoteSearch;
|
3715
3633
|
let stringLiteralPattern;
|
3716
|
-
|
3634
|
+
{
|
3717
3635
|
quoteInitial = "'";
|
3718
3636
|
quoteSearch = DOUBLE_QUOTE_PATTERN;
|
3719
3637
|
stringLiteralPattern = SINGLE_OR_DOUBLE_QUOTE_STRING_PATTERN;
|
3720
|
-
} else {
|
3721
|
-
quoteInitial = '"';
|
3722
|
-
quoteSearch = SINGLE_QUOTE_PATTERN;
|
3723
|
-
stringLiteralPattern = DOUBLE_OR_SINGLE_QUOTE_STRING_PATTERN;
|
3724
3638
|
}
|
3725
3639
|
let s = "";
|
3726
3640
|
while (x.length > 0) {
|
@@ -3749,40 +3663,9 @@ function convertJsonHelper(x, desiredCommaChar, desiredQuoteChar) {
|
|
3749
3663
|
function urlSafeToJSON(x) {
|
3750
3664
|
return convertJsonHelper(x, ",", '"');
|
3751
3665
|
}
|
3752
|
-
function jsonToUrlSafe(x) {
|
3753
|
-
return convertJsonHelper(x, "_", "'");
|
3754
|
-
}
|
3755
3666
|
function urlSafeParse(x) {
|
3756
3667
|
return JSON.parse(urlSafeToJSON(x));
|
3757
3668
|
}
|
3758
|
-
function pythonLiteralToJSON(x) {
|
3759
|
-
let s = "";
|
3760
|
-
while (x.length > 0) {
|
3761
|
-
let m = x.match(SINGLE_OR_DOUBLE_QUOTE_STRING_PATTERN);
|
3762
|
-
let before;
|
3763
|
-
let replacement;
|
3764
|
-
if (m === null) {
|
3765
|
-
before = x;
|
3766
|
-
x = "";
|
3767
|
-
replacement = "";
|
3768
|
-
} else {
|
3769
|
-
before = x.substr(0, m.index);
|
3770
|
-
x = x.substr(m.index + m[0].length);
|
3771
|
-
let singleQuoteString = m[1];
|
3772
|
-
if (singleQuoteString !== void 0) {
|
3773
|
-
replacement = normalizeStringLiteral(singleQuoteString);
|
3774
|
-
} else {
|
3775
|
-
replacement = m[2];
|
3776
|
-
}
|
3777
|
-
}
|
3778
|
-
s += before.replace(/\(/g, "[").replace(/\)/g, "]").replace("True", "true").replace("False", "false").replace(/,\s*([\}\]])/g, "$1");
|
3779
|
-
s += replacement;
|
3780
|
-
}
|
3781
|
-
return s;
|
3782
|
-
}
|
3783
|
-
function pythonLiteralParse(x) {
|
3784
|
-
return JSON.parse(pythonLiteralToJSON(x));
|
3785
|
-
}
|
3786
3669
|
function expectArray(x, length2) {
|
3787
3670
|
if (!Array.isArray(x)) {
|
3788
3671
|
throw new Error(`Expected array, but received: ${_JSON$stringify(x)}.`);
|
@@ -3854,29 +3737,6 @@ function verifyOptionalString(obj) {
|
|
3854
3737
|
}
|
3855
3738
|
return verifyString(obj);
|
3856
3739
|
}
|
3857
|
-
function verifyOptionalInt(obj) {
|
3858
|
-
if (obj === void 0) {
|
3859
|
-
return void 0;
|
3860
|
-
}
|
3861
|
-
return verifyInt(obj);
|
3862
|
-
}
|
3863
|
-
function verifyOptionalBoolean(obj) {
|
3864
|
-
if (obj === void 0) {
|
3865
|
-
return void 0;
|
3866
|
-
}
|
3867
|
-
if (typeof obj === "boolean") {
|
3868
|
-
return obj;
|
3869
|
-
} else if (obj === "true") {
|
3870
|
-
return true;
|
3871
|
-
} else if (obj === "false") {
|
3872
|
-
return false;
|
3873
|
-
} else {
|
3874
|
-
throw new Error(`Expected string or boolean but received: ${_JSON$stringify(obj)}`);
|
3875
|
-
}
|
3876
|
-
}
|
3877
|
-
function valueOr(value, defaultValue) {
|
3878
|
-
return value === void 0 ? defaultValue : value;
|
3879
|
-
}
|
3880
3740
|
function verifyObjectProperty(obj, propertyName, validator) {
|
3881
3741
|
let value = Object.prototype.hasOwnProperty.call(obj, propertyName) ? obj[propertyName] : void 0;
|
3882
3742
|
try {
|
@@ -3946,12 +3806,6 @@ function verifyEnumString(obj, enumType) {
|
|
3946
3806
|
function verify3dVec(obj) {
|
3947
3807
|
return parseFixedLengthArray(create$3(), obj, verifyFiniteFloat);
|
3948
3808
|
}
|
3949
|
-
function verify3dScale(obj) {
|
3950
|
-
return parseFixedLengthArray(create$3(), obj, verifyFinitePositiveFloat);
|
3951
|
-
}
|
3952
|
-
function verify3dDimensions(obj) {
|
3953
|
-
return parseFixedLengthArray(create$3(), obj, verifyPositiveInt);
|
3954
|
-
}
|
3955
3809
|
function verifyStringArray(a) {
|
3956
3810
|
if (!Array.isArray(a)) {
|
3957
3811
|
throw new Error(`Expected array, received: ${_JSON$stringify(a)}.`);
|
@@ -3986,52 +3840,6 @@ function emptyToUndefined(x) {
|
|
3986
3840
|
}
|
3987
3841
|
return void 0;
|
3988
3842
|
}
|
3989
|
-
const json = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
3990
|
-
__proto__: null,
|
3991
|
-
emptyToUndefined,
|
3992
|
-
expectArray,
|
3993
|
-
jsonToUrlSafe,
|
3994
|
-
normalizeStringLiteral,
|
3995
|
-
parseArray,
|
3996
|
-
parseFiniteVec,
|
3997
|
-
parseFixedLengthArray,
|
3998
|
-
parseIntVec,
|
3999
|
-
parseQueryStringParameters,
|
4000
|
-
parseXYZ,
|
4001
|
-
pythonLiteralParse,
|
4002
|
-
pythonLiteralToJSON,
|
4003
|
-
stableStringify,
|
4004
|
-
unparseQueryStringParameters,
|
4005
|
-
urlSafeParse,
|
4006
|
-
urlSafeStringify,
|
4007
|
-
urlSafeStringifyString,
|
4008
|
-
urlSafeToJSON,
|
4009
|
-
valueOr,
|
4010
|
-
verify3dDimensions,
|
4011
|
-
verify3dScale,
|
4012
|
-
verify3dVec,
|
4013
|
-
verifyBoolean,
|
4014
|
-
verifyEnumString,
|
4015
|
-
verifyFiniteFloat,
|
4016
|
-
verifyFiniteNonNegativeFloat,
|
4017
|
-
verifyFinitePositiveFloat,
|
4018
|
-
verifyFloat,
|
4019
|
-
verifyFloat01,
|
4020
|
-
verifyInt,
|
4021
|
-
verifyIntegerArray,
|
4022
|
-
verifyMapKey,
|
4023
|
-
verifyNonnegativeInt,
|
4024
|
-
verifyObject,
|
4025
|
-
verifyObjectAsMap,
|
4026
|
-
verifyObjectProperty,
|
4027
|
-
verifyOptionalBoolean,
|
4028
|
-
verifyOptionalInt,
|
4029
|
-
verifyOptionalObjectProperty,
|
4030
|
-
verifyOptionalString,
|
4031
|
-
verifyPositiveInt,
|
4032
|
-
verifyString,
|
4033
|
-
verifyStringArray
|
4034
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
4035
3843
|
/**
|
4036
3844
|
* @license
|
4037
3845
|
* Copyright 2021 Google Inc.
|
@@ -4423,10 +4231,6 @@ class Uint64 {
|
|
4423
4231
|
}
|
4424
4232
|
Uint64.ZERO = new Uint64(0, 0);
|
4425
4233
|
Uint64.ONE = new Uint64(1, 0);
|
4426
|
-
const uint64 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
4427
|
-
__proto__: null,
|
4428
|
-
Uint64
|
4429
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
4430
4234
|
const defaultDataTypeRange = {
|
4431
4235
|
[DataType.UINT8]: [0, 255],
|
4432
4236
|
[DataType.INT8]: [-128, 127],
|
@@ -6071,20 +5875,20 @@ function coordinateSpaceToJson(coordinateSpace) {
|
|
6071
5875
|
const rank = coordinateSpace.rank;
|
6072
5876
|
if (rank === 0) return void 0;
|
6073
5877
|
const names = coordinateSpace.names, units = coordinateSpace.units, scales = coordinateSpace.scales, coordinateArrays = coordinateSpace.coordinateArrays;
|
6074
|
-
const
|
5878
|
+
const json = {};
|
6075
5879
|
for (let i = 0; i < rank; ++i) {
|
6076
5880
|
const name2 = names[i];
|
6077
5881
|
const coordinateArray = coordinateArrays[i];
|
6078
5882
|
if (coordinateArray === null || coordinateArray === void 0 ? void 0 : coordinateArray.explicit) {
|
6079
|
-
|
5883
|
+
json[name2] = {
|
6080
5884
|
coordinates: _Array$from(coordinateArray.coordinates),
|
6081
5885
|
labels: coordinateArray.labels
|
6082
5886
|
};
|
6083
5887
|
} else {
|
6084
|
-
|
5888
|
+
json[name2] = [scales[i], units[i]];
|
6085
5889
|
}
|
6086
5890
|
}
|
6087
|
-
return
|
5891
|
+
return json;
|
6088
5892
|
}
|
6089
5893
|
class TrackableCoordinateSpace extends WatchableValue {
|
6090
5894
|
constructor() {
|
@@ -13252,8 +13056,8 @@ if (ng_discardValue) {
|
|
13252
13056
|
gl.uniform1ui(shader.uniform("uPickID"), context.basePickId);
|
13253
13057
|
}
|
13254
13058
|
if (renderContext.emitColor) {
|
13255
|
-
const
|
13256
|
-
gl.uniform3f(shader.uniform("uColor"),
|
13059
|
+
const color = annotationLayer.state.displayState.color.value;
|
13060
|
+
gl.uniform3f(shader.uniform("uColor"), color[0], color[1], color[2]);
|
13257
13061
|
gl.uniform1ui(shader.uniform("uSelectedIndex"), context.selectedIndex);
|
13258
13062
|
}
|
13259
13063
|
const binder = shader.vertexShaderInputBinders["properties"];
|
@@ -15764,12 +15568,12 @@ function requireThrottle() {
|
|
15764
15568
|
}
|
15765
15569
|
var throttleExports = requireThrottle();
|
15766
15570
|
const throttle = /* @__PURE__ */ getDefaultExportFromCjs(throttleExports);
|
15767
|
-
function parseDataSubsourceSpecificationFromJson(
|
15768
|
-
if (typeof
|
15769
|
-
return { enabled:
|
15571
|
+
function parseDataSubsourceSpecificationFromJson(json) {
|
15572
|
+
if (typeof json === "boolean") {
|
15573
|
+
return { enabled: json };
|
15770
15574
|
}
|
15771
|
-
verifyObject(
|
15772
|
-
return { enabled: verifyOptionalObjectProperty(
|
15575
|
+
verifyObject(json);
|
15576
|
+
return { enabled: verifyOptionalObjectProperty(json, "enabled", verifyBoolean) };
|
15773
15577
|
}
|
15774
15578
|
function layerDataSourceSpecificationFromJson(obj, legacyTransform = void 0) {
|
15775
15579
|
if (typeof obj === "string") {
|
@@ -16595,19 +16399,19 @@ class Position extends RefCounted {
|
|
16595
16399
|
};
|
16596
16400
|
}
|
16597
16401
|
}
|
16598
|
-
function restoreLinkedFromJson(link, value,
|
16599
|
-
if (
|
16402
|
+
function restoreLinkedFromJson(link, value, json) {
|
16403
|
+
if (json === void 0 || _Object$keys(json).length === 0) {
|
16600
16404
|
link.value = NavigationLinkType.LINKED;
|
16601
16405
|
return;
|
16602
16406
|
}
|
16603
|
-
verifyObject(
|
16407
|
+
verifyObject(json);
|
16604
16408
|
link.value = NavigationLinkType.UNLINKED;
|
16605
|
-
verifyObjectProperty(
|
16409
|
+
verifyObjectProperty(json, "value", (x) => {
|
16606
16410
|
if (x !== void 0) {
|
16607
16411
|
value.restoreState(x);
|
16608
16412
|
}
|
16609
16413
|
});
|
16610
|
-
verifyObjectProperty(
|
16414
|
+
verifyObjectProperty(json, "link", (x) => link.restoreState(x));
|
16611
16415
|
}
|
16612
16416
|
class LinkedBase {
|
16613
16417
|
constructor(peer, link = new TrackableNavigationLink()) {
|
@@ -16792,7 +16596,7 @@ class TrackableRelativeDisplayScales extends RefCounted {
|
|
16792
16596
|
this.changed.dispatch();
|
16793
16597
|
}
|
16794
16598
|
toJSON() {
|
16795
|
-
const
|
16599
|
+
const json = {};
|
16796
16600
|
let nonEmpty = false;
|
16797
16601
|
const value = this.value;
|
16798
16602
|
const factors = value.factors;
|
@@ -16801,19 +16605,19 @@ class TrackableRelativeDisplayScales extends RefCounted {
|
|
16801
16605
|
for (let i = 0; i < rank; ++i) {
|
16802
16606
|
const factor = factors[i];
|
16803
16607
|
if (factor === 1) continue;
|
16804
|
-
|
16608
|
+
json[names[i]] = factor;
|
16805
16609
|
nonEmpty = true;
|
16806
16610
|
}
|
16807
|
-
if (nonEmpty) return
|
16611
|
+
if (nonEmpty) return json;
|
16808
16612
|
return void 0;
|
16809
16613
|
}
|
16810
|
-
restoreState(
|
16614
|
+
restoreState(json) {
|
16811
16615
|
const coordinateSpace = this.coordinateSpace.value;
|
16812
16616
|
const names = coordinateSpace.names, rank = coordinateSpace.rank;
|
16813
16617
|
const factors = new Float64Array(rank);
|
16814
16618
|
factors.fill(-1);
|
16815
|
-
if (
|
16816
|
-
const obj = verifyObject(
|
16619
|
+
if (json !== void 0) {
|
16620
|
+
const obj = verifyObject(json);
|
16817
16621
|
for (let i = 0; i < rank; ++i) {
|
16818
16622
|
factors[i] = verifyObjectProperty(obj, names[i], (x) => x === void 0 ? 1 : verifyFinitePositiveFloat(x));
|
16819
16623
|
}
|
@@ -18885,8 +18689,8 @@ vec3 ${this.prefix}(uint64_t x) {
|
|
18885
18689
|
}
|
18886
18690
|
}
|
18887
18691
|
let tempColor$1 = new Float32Array(3);
|
18888
|
-
function getCssColor(
|
18889
|
-
return `rgb(${
|
18692
|
+
function getCssColor(color) {
|
18693
|
+
return `rgb(${color[0] * 100}%,${color[1] * 100}%,${color[2] * 100}%)`;
|
18890
18694
|
}
|
18891
18695
|
class SegmentColorHash {
|
18892
18696
|
constructor(hashSeed = getRandomUint32()) {
|
@@ -20978,21 +20782,21 @@ class SegmentWidgetFactory {
|
|
20978
20782
|
const unmappedIdIndex = template.unmappedIdIndex;
|
20979
20783
|
if (unmappedIdIndex !== -1) {
|
20980
20784
|
let unmappedIdString;
|
20981
|
-
let
|
20785
|
+
let color;
|
20982
20786
|
if (displayState.baseSegmentColoring.value && (unmappedIdString = container.dataset.unmappedId) !== void 0) {
|
20983
20787
|
const unmappedId = tempStatedColor;
|
20984
20788
|
unmappedId.parseString(unmappedIdString);
|
20985
|
-
|
20789
|
+
color = getBaseObjectColor(this.displayState, unmappedId);
|
20986
20790
|
} else {
|
20987
|
-
|
20791
|
+
color = kOneVec;
|
20988
20792
|
}
|
20989
|
-
setSegmentIdElementStyle(idContainer.children[unmappedIdIndex],
|
20793
|
+
setSegmentIdElementStyle(idContainer.children[unmappedIdIndex], color);
|
20990
20794
|
}
|
20991
20795
|
}
|
20992
20796
|
}
|
20993
|
-
function setSegmentIdElementStyle(element,
|
20994
|
-
element.style.backgroundColor = getCssColor(
|
20995
|
-
element.style.color = useWhiteBackground(
|
20797
|
+
function setSegmentIdElementStyle(element, color) {
|
20798
|
+
element.style.backgroundColor = getCssColor(color);
|
20799
|
+
element.style.color = useWhiteBackground(color) ? "white" : "black";
|
20996
20800
|
}
|
20997
20801
|
class SegmentWidgetWithExtraColumnsFactory extends SegmentWidgetFactory {
|
20998
20802
|
constructor(displayState, parentElement, includeProperty) {
|
@@ -21116,33 +20920,33 @@ function registerRedrawWhenSegmentationDisplayState3DChanged(displayState, rende
|
|
21116
20920
|
}
|
21117
20921
|
const tempColor = create$2();
|
21118
20922
|
const tempStatedColor = new Uint64();
|
21119
|
-
function getBaseObjectColor(displayState, objectId,
|
20923
|
+
function getBaseObjectColor(displayState, objectId, color = tempColor) {
|
21120
20924
|
if (displayState == null) {
|
21121
|
-
|
21122
|
-
return
|
20925
|
+
color.fill(1);
|
20926
|
+
return color;
|
21123
20927
|
}
|
21124
20928
|
const colorGroupState = displayState.segmentationColorGroupState.value;
|
21125
20929
|
const segmentStatedColors = colorGroupState.segmentStatedColors;
|
21126
20930
|
if (segmentStatedColors.size !== 0 && colorGroupState.segmentStatedColors.get(objectId, tempStatedColor)) {
|
21127
|
-
|
21128
|
-
|
21129
|
-
|
21130
|
-
return
|
20931
|
+
color[0] = (tempStatedColor.low & 255) / 255;
|
20932
|
+
color[1] = ((tempStatedColor.low & 65280) >>> 8) / 255;
|
20933
|
+
color[2] = ((tempStatedColor.low & 16711680) >>> 16) / 255;
|
20934
|
+
return color;
|
21131
20935
|
}
|
21132
20936
|
const segmentDefaultColor = colorGroupState.segmentDefaultColor.value;
|
21133
20937
|
if (segmentDefaultColor !== void 0) {
|
21134
|
-
|
21135
|
-
|
21136
|
-
|
21137
|
-
return
|
20938
|
+
color[0] = segmentDefaultColor[0];
|
20939
|
+
color[1] = segmentDefaultColor[1];
|
20940
|
+
color[2] = segmentDefaultColor[2];
|
20941
|
+
return color;
|
21138
20942
|
}
|
21139
|
-
colorGroupState.segmentColorHash.compute(
|
21140
|
-
return
|
20943
|
+
colorGroupState.segmentColorHash.compute(color, objectId);
|
20944
|
+
return color;
|
21141
20945
|
}
|
21142
20946
|
function getObjectColor(displayState, objectId, alpha = 1) {
|
21143
|
-
const
|
21144
|
-
|
21145
|
-
getBaseObjectColor(displayState, objectId,
|
20947
|
+
const color = tempColor;
|
20948
|
+
color[3] = alpha;
|
20949
|
+
getBaseObjectColor(displayState, objectId, color);
|
21146
20950
|
let saturation = displayState.saturation.value;
|
21147
20951
|
if (displayState.segmentSelectionState.isSelected(objectId)) {
|
21148
20952
|
if (saturation > 0.5) {
|
@@ -21152,12 +20956,12 @@ function getObjectColor(displayState, objectId, alpha = 1) {
|
|
21152
20956
|
}
|
21153
20957
|
}
|
21154
20958
|
for (let i = 0; i < 3; ++i) {
|
21155
|
-
|
20959
|
+
color[i] = color[i] * saturation + (1 - saturation);
|
21156
20960
|
}
|
21157
|
-
|
21158
|
-
|
21159
|
-
|
21160
|
-
return
|
20961
|
+
color[0] *= alpha;
|
20962
|
+
color[1] *= alpha;
|
20963
|
+
color[2] *= alpha;
|
20964
|
+
return color;
|
21161
20965
|
}
|
21162
20966
|
function sendVisibleSegmentsState(state, options = {}) {
|
21163
20967
|
for (const property of VISIBLE_SEGMENTS_STATE_PROPERTIES) {
|
@@ -21186,33 +20990,10 @@ function forEachVisibleSegmentToDraw(displayState, renderLayer, emitColor, pickI
|
|
21186
20990
|
const baseSegmentColoring = displayState.baseSegmentColoring.value;
|
21187
20991
|
forEachVisibleSegment(displayState.segmentationGroupState.value, (objectId, rootObjectId) => {
|
21188
20992
|
let pickIndex = pickIDs === null || pickIDs === void 0 ? void 0 : pickIDs.registerUint64(renderLayer, objectId);
|
21189
|
-
let
|
21190
|
-
callback(objectId,
|
20993
|
+
let color = emitColor ? getObjectColor(displayState, baseSegmentColoring ? objectId : rootObjectId, alpha) : void 0;
|
20994
|
+
callback(objectId, color, pickIndex, rootObjectId);
|
21191
20995
|
});
|
21192
20996
|
}
|
21193
|
-
const frontend = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
21194
|
-
__proto__: null,
|
21195
|
-
SegmentSelectionState,
|
21196
|
-
SegmentWidgetFactory,
|
21197
|
-
SegmentWidgetWithExtraColumnsFactory,
|
21198
|
-
SegmentationLayerSharedObject,
|
21199
|
-
Uint64MapEntry,
|
21200
|
-
augmentSegmentId,
|
21201
|
-
bindSegmentListWidth,
|
21202
|
-
forEachVisibleSegmentToDraw,
|
21203
|
-
getBaseObjectColor,
|
21204
|
-
getObjectColor,
|
21205
|
-
makeSegmentWidget,
|
21206
|
-
maybeAugmentSegmentId,
|
21207
|
-
registerCallbackWhenSegmentationDisplayStateChanged,
|
21208
|
-
registerRedrawWhenSegmentationDisplayState3DChanged,
|
21209
|
-
registerRedrawWhenSegmentationDisplayStateChanged,
|
21210
|
-
registerRedrawWhenSegmentationDisplayStateWithAlphaChanged,
|
21211
|
-
resetTemporaryVisibleSegmentsState,
|
21212
|
-
segmentWidgetTemplateWithExtraColumns,
|
21213
|
-
sendVisibleSegmentsState,
|
21214
|
-
updateIdStringWidth
|
21215
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
21216
20997
|
/**
|
21217
20998
|
* @license
|
21218
20999
|
* Copyright 2016 Google Inc.
|
@@ -21319,8 +21100,8 @@ class MeshShaderManager {
|
|
21319
21100
|
gl.uniform1f(shader.uniform("uSilhouettePower"), silhouetteRendering);
|
21320
21101
|
}
|
21321
21102
|
}
|
21322
|
-
setColor(gl, shader,
|
21323
|
-
gl.uniform4fv(shader.uniform("uColor"),
|
21103
|
+
setColor(gl, shader, color) {
|
21104
|
+
gl.uniform4fv(shader.uniform("uColor"), color);
|
21324
21105
|
}
|
21325
21106
|
setPickID(gl, shader, pickID) {
|
21326
21107
|
gl.uniform1ui(shader.uniform("uPickID"), pickID);
|
@@ -21470,14 +21251,14 @@ class MeshLayer extends PerspectiveViewRenderLayer {
|
|
21470
21251
|
let totalChunks = 0, presentChunks = 0;
|
21471
21252
|
const renderScaleHistogram = this.displayState.renderScaleHistogram;
|
21472
21253
|
const fragmentChunks = this.source.fragmentSource.chunks;
|
21473
|
-
forEachVisibleSegmentToDraw(displayState, this, renderContext.emitColor, renderContext.emitPickID ? renderContext.pickIDs : void 0, (objectId,
|
21254
|
+
forEachVisibleSegmentToDraw(displayState, this, renderContext.emitColor, renderContext.emitPickID ? renderContext.pickIDs : void 0, (objectId, color, pickIndex) => {
|
21474
21255
|
const key = getObjectKey(objectId);
|
21475
21256
|
const manifestChunk = manifestChunks.get(key);
|
21476
21257
|
++totalChunks;
|
21477
21258
|
if (manifestChunk === void 0) return;
|
21478
21259
|
++presentChunks;
|
21479
21260
|
if (renderContext.emitColor) {
|
21480
|
-
meshShaderManager.setColor(gl, shader,
|
21261
|
+
meshShaderManager.setColor(gl, shader, color);
|
21481
21262
|
}
|
21482
21263
|
if (renderContext.emitPickID) {
|
21483
21264
|
meshShaderManager.setPickID(gl, shader, pickIndex);
|
@@ -21641,7 +21422,7 @@ class MultiscaleMeshLayer extends PerspectiveViewRenderLayer {
|
|
21641
21422
|
meshShaderManager.beginModel(gl, shader, renderContext, modelMatrix);
|
21642
21423
|
let totalManifestChunks = 0;
|
21643
21424
|
let presentManifestChunks = 0;
|
21644
|
-
forEachVisibleSegmentToDraw(displayState, this, renderContext.emitColor, renderContext.emitPickID ? renderContext.pickIDs : void 0, (objectId,
|
21425
|
+
forEachVisibleSegmentToDraw(displayState, this, renderContext.emitColor, renderContext.emitPickID ? renderContext.pickIDs : void 0, (objectId, color, pickIndex) => {
|
21645
21426
|
const key = getObjectKey(objectId);
|
21646
21427
|
const manifestChunk = chunks.get(key);
|
21647
21428
|
++totalManifestChunks;
|
@@ -21650,7 +21431,7 @@ class MultiscaleMeshLayer extends PerspectiveViewRenderLayer {
|
|
21650
21431
|
const manifest = manifestChunk.manifest;
|
21651
21432
|
const octree = manifest.octree, chunkShape = manifest.chunkShape, chunkGridSpatialOrigin = manifest.chunkGridSpatialOrigin, vertexOffsets = manifest.vertexOffsets;
|
21652
21433
|
if (renderContext.emitColor) {
|
21653
|
-
meshShaderManager.setColor(gl, shader,
|
21434
|
+
meshShaderManager.setColor(gl, shader, color);
|
21654
21435
|
}
|
21655
21436
|
if (renderContext.emitPickID) {
|
21656
21437
|
meshShaderManager.setPickID(gl, shader, pickIndex);
|
@@ -22368,8 +22149,8 @@ void emitDefault() {
|
|
22368
22149
|
gl.uniformMatrix4fv(shader.uniform("uProjection"), false, mat);
|
22369
22150
|
this.vertexIdHelper.enable();
|
22370
22151
|
}
|
22371
|
-
setColor(gl, shader,
|
22372
|
-
gl.uniform4fv(shader.uniform("uColor"),
|
22152
|
+
setColor(gl, shader, color) {
|
22153
|
+
gl.uniform4fv(shader.uniform("uColor"), color);
|
22373
22154
|
}
|
22374
22155
|
setPickID(gl, shader, pickID) {
|
22375
22156
|
gl.uniform1ui(shader.uniform("uPickID"), pickID);
|
@@ -22536,17 +22317,17 @@ class SkeletonLayer extends RefCounted {
|
|
22536
22317
|
gl.uniform1f(nodeShader.uniform("uNodeDiameter"), pointDiameter);
|
22537
22318
|
setControlsInShader(gl, nodeShader, shaderControlState, nodeShaderParameters.parseResult.controls);
|
22538
22319
|
const skeletons = source.chunks;
|
22539
|
-
forEachVisibleSegmentToDraw(displayState, layer, renderContext.emitColor, renderContext.emitPickID ? renderContext.pickIDs : void 0, (objectId,
|
22320
|
+
forEachVisibleSegmentToDraw(displayState, layer, renderContext.emitColor, renderContext.emitPickID ? renderContext.pickIDs : void 0, (objectId, color, pickIndex) => {
|
22540
22321
|
const key = getObjectKey(objectId);
|
22541
22322
|
const skeleton = skeletons.get(key);
|
22542
22323
|
if (skeleton === void 0 || skeleton.state !== ChunkState.GPU_MEMORY) {
|
22543
22324
|
return;
|
22544
22325
|
}
|
22545
|
-
if (
|
22326
|
+
if (color !== void 0) {
|
22546
22327
|
edgeShader.bind();
|
22547
|
-
renderHelper.setColor(gl, edgeShader,
|
22328
|
+
renderHelper.setColor(gl, edgeShader, color);
|
22548
22329
|
nodeShader.bind();
|
22549
|
-
renderHelper.setColor(gl, nodeShader,
|
22330
|
+
renderHelper.setColor(gl, nodeShader, color);
|
22550
22331
|
}
|
22551
22332
|
if (pickIndex !== void 0) {
|
22552
22333
|
edgeShader.bind();
|
@@ -25911,19 +25692,19 @@ class ToolBinder extends RefCounted {
|
|
25911
25692
|
}
|
25912
25693
|
if (tool !== void 0) {
|
25913
25694
|
const layerToolBinder = tool.layer.toolBinder;
|
25914
|
-
const
|
25915
|
-
const existingKey = layerToolBinder.jsonToKey.get(
|
25695
|
+
const json = _JSON$stringify(tool.toJSON());
|
25696
|
+
const existingKey = layerToolBinder.jsonToKey.get(json);
|
25916
25697
|
if (existingKey !== void 0) {
|
25917
25698
|
const existingTool2 = layerToolBinder.bindings.get(existingKey);
|
25918
25699
|
existingTool2.keyBinding = void 0;
|
25919
25700
|
bindings.delete(existingKey);
|
25920
25701
|
layerToolBinder.bindings.delete(existingKey);
|
25921
|
-
layerToolBinder.jsonToKey.delete(
|
25702
|
+
layerToolBinder.jsonToKey.delete(json);
|
25922
25703
|
this.destroyTool(existingTool2);
|
25923
25704
|
}
|
25924
25705
|
layerToolBinder.bindings.set(key, tool);
|
25925
25706
|
tool.keyBinding = key;
|
25926
|
-
layerToolBinder.jsonToKey.set(
|
25707
|
+
layerToolBinder.jsonToKey.set(json, key);
|
25927
25708
|
bindings.set(key, tool);
|
25928
25709
|
layerToolBinder.changed.dispatch();
|
25929
25710
|
}
|
@@ -45311,8 +45092,8 @@ class StateEditorDialog extends Overlay {
|
|
45311
45092
|
this.debouncedValueUpdater = debounce(() => {
|
45312
45093
|
const value = this.textEditor.getValue();
|
45313
45094
|
try {
|
45314
|
-
const
|
45315
|
-
this.parsedValue =
|
45095
|
+
const json = JSON.parse(value);
|
45096
|
+
this.parsedValue = json;
|
45316
45097
|
this.applyButton.disabled = false;
|
45317
45098
|
this.textEditor.setOption("lint", void 0);
|
45318
45099
|
} catch (parseError) {
|
@@ -46006,92 +45787,6 @@ function encodeFragment(fragment) {
|
|
46006
45787
|
return "%" + c.charCodeAt(0).toString(16).toUpperCase();
|
46007
45788
|
});
|
46008
45789
|
}
|
46009
|
-
class UrlHashBinding extends RefCounted {
|
46010
|
-
constructor(root, credentialsManager, options = {}) {
|
46011
|
-
super();
|
46012
|
-
this.root = root;
|
46013
|
-
this.credentialsManager = credentialsManager;
|
46014
|
-
this.parseError = new WatchableValue(void 0);
|
46015
|
-
var _options$updateDelayM = options.updateDelayMilliseconds;
|
46016
|
-
const updateDelayMilliseconds = _options$updateDelayM === void 0 ? 200 : _options$updateDelayM;
|
46017
|
-
var _options$defaultFragm = options.defaultFragment;
|
46018
|
-
const defaultFragment = _options$defaultFragm === void 0 ? "{}" : _options$defaultFragm;
|
46019
|
-
this.registerEventListener(window, "hashchange", () => this.updateFromUrlHash());
|
46020
|
-
const throttledSetUrlHash = debounce(() => this.setUrlHash(), updateDelayMilliseconds);
|
46021
|
-
this.registerDisposer(root.changed.add(throttledSetUrlHash));
|
46022
|
-
this.registerDisposer(() => throttledSetUrlHash.cancel());
|
46023
|
-
this.defaultFragment = defaultFragment;
|
46024
|
-
}
|
46025
|
-
/**
|
46026
|
-
* Sets the URL hash to match the current state.
|
46027
|
-
*/
|
46028
|
-
setUrlHash() {
|
46029
|
-
const cacheState = getCachedJson(this.root);
|
46030
|
-
const generation = cacheState.generation;
|
46031
|
-
if (generation !== this.prevStateGeneration) {
|
46032
|
-
this.prevStateGeneration = cacheState.generation;
|
46033
|
-
let stateString = encodeFragment(_JSON$stringify(cacheState.value));
|
46034
|
-
if (stateString !== this.prevStateString) {
|
46035
|
-
this.prevStateString = stateString;
|
46036
|
-
if (decodeURIComponent(stateString) === "{}") {
|
46037
|
-
history.replaceState(null, "", "#");
|
46038
|
-
} else {
|
46039
|
-
history.replaceState(null, "", "#!" + stateString);
|
46040
|
-
}
|
46041
|
-
}
|
46042
|
-
}
|
46043
|
-
}
|
46044
|
-
/**
|
46045
|
-
* Sets the current state to match the URL hash. If it is desired to initialize the state based
|
46046
|
-
* on the URL hash, then this should be called immediately after construction.
|
46047
|
-
*/
|
46048
|
-
updateFromUrlHash() {
|
46049
|
-
try {
|
46050
|
-
let s = location.href.replace(/^[^#]+/, "");
|
46051
|
-
if (s === "" || s === "#" || s === "#!") {
|
46052
|
-
s = "#!" + this.defaultFragment;
|
46053
|
-
}
|
46054
|
-
if (s.match(/^#!([a-z][a-z\d+-.]*):\/\//)) {
|
46055
|
-
const url = s.substring(2);
|
46056
|
-
var _parseSpecialUrl = parseSpecialUrl(url, this.credentialsManager);
|
46057
|
-
const parsedUrl = _parseSpecialUrl.url, credentialsProvider = _parseSpecialUrl.credentialsProvider;
|
46058
|
-
StatusMessage.forPromise(cancellableFetchSpecialOk(credentialsProvider, parsedUrl, {}, responseJson).then((json2) => {
|
46059
|
-
verifyObject(json2);
|
46060
|
-
this.root.reset();
|
46061
|
-
this.root.restoreState(json2);
|
46062
|
-
}), { initialMessage: `Loading state from ${url}`, errorPrefix: `Error loading state:` });
|
46063
|
-
} else if (s.startsWith("#!+")) {
|
46064
|
-
s = s.slice(3);
|
46065
|
-
s = decodeURIComponent(s);
|
46066
|
-
let state = urlSafeParse(s);
|
46067
|
-
verifyObject(state);
|
46068
|
-
this.root.restoreState(state);
|
46069
|
-
this.prevStateString = void 0;
|
46070
|
-
} else if (s.startsWith("#!")) {
|
46071
|
-
s = s.slice(2);
|
46072
|
-
s = decodeURIComponent(s);
|
46073
|
-
if (s === this.prevStateString) {
|
46074
|
-
return;
|
46075
|
-
}
|
46076
|
-
this.prevStateString = s;
|
46077
|
-
this.root.reset();
|
46078
|
-
let state = urlSafeParse(s);
|
46079
|
-
verifyObject(state);
|
46080
|
-
this.root.restoreState(state);
|
46081
|
-
} else {
|
46082
|
-
throw new Error(`URL hash is expected to be of the form "#!{...}" or "#!+{...}".`);
|
46083
|
-
}
|
46084
|
-
this.parseError.value = void 0;
|
46085
|
-
} catch (parseError) {
|
46086
|
-
this.parseError.value = parseError;
|
46087
|
-
}
|
46088
|
-
}
|
46089
|
-
}
|
46090
|
-
const url_hash_binding = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
46091
|
-
__proto__: null,
|
46092
|
-
UrlHashBinding,
|
46093
|
-
encodeFragment
|
46094
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
46095
45790
|
class DataManagementContext extends RefCounted {
|
46096
45791
|
constructor(gl, frameNumberCounter, bundleRoot = "") {
|
46097
45792
|
super();
|
@@ -46736,11 +46431,11 @@ class UserLayer extends RefCounted {
|
|
46736
46431
|
state.annotationId = void 0;
|
46737
46432
|
state.value = void 0;
|
46738
46433
|
}
|
46739
|
-
selectionStateFromJson(state,
|
46434
|
+
selectionStateFromJson(state, json) {
|
46740
46435
|
const localCoordinateSpace = state.localCoordinateSpace = this.localCoordinateSpace.value;
|
46741
46436
|
const rank = localCoordinateSpace.rank;
|
46742
46437
|
if (rank !== 0) {
|
46743
|
-
const localPosition = verifyOptionalObjectProperty(
|
46438
|
+
const localPosition = verifyOptionalObjectProperty(json, LOCAL_POSITION_JSON_KEY, (positionObj) => parseFixedLengthArray(new Float32Array(rank), positionObj, verifyFiniteFloat));
|
46744
46439
|
if (localPosition === void 0) {
|
46745
46440
|
state.localPositionValid = false;
|
46746
46441
|
} else {
|
@@ -46748,36 +46443,36 @@ class UserLayer extends RefCounted {
|
|
46748
46443
|
state.localPosition = localPosition;
|
46749
46444
|
}
|
46750
46445
|
}
|
46751
|
-
const annotationId = state.annotationId = verifyOptionalObjectProperty(
|
46446
|
+
const annotationId = state.annotationId = verifyOptionalObjectProperty(json, "annotationId", verifyString);
|
46752
46447
|
if (annotationId !== void 0) {
|
46753
|
-
state.annotationSourceIndex = verifyOptionalObjectProperty(
|
46754
|
-
state.annotationPartIndex = verifyOptionalObjectProperty(
|
46755
|
-
state.annotationSubsource = verifyOptionalObjectProperty(
|
46448
|
+
state.annotationSourceIndex = verifyOptionalObjectProperty(json, "annotationSource", verifyInt, 0);
|
46449
|
+
state.annotationPartIndex = verifyOptionalObjectProperty(json, "annotationPart", verifyInt);
|
46450
|
+
state.annotationSubsource = verifyOptionalObjectProperty(json, "annotationSubsource", verifyString);
|
46756
46451
|
}
|
46757
|
-
state.value =
|
46452
|
+
state.value = json.value;
|
46758
46453
|
}
|
46759
46454
|
// Derived classes should override.
|
46760
46455
|
displaySelectionState(state, parent, context) {
|
46761
46456
|
return false;
|
46762
46457
|
}
|
46763
46458
|
selectionStateToJson(state, forPython) {
|
46764
|
-
const
|
46459
|
+
const json = {};
|
46765
46460
|
if (state.localPositionValid) {
|
46766
46461
|
const localPosition = state.localPosition;
|
46767
46462
|
if (localPosition.length > 0) {
|
46768
|
-
|
46463
|
+
json.localPosition = _Array$from(localPosition);
|
46769
46464
|
}
|
46770
46465
|
}
|
46771
46466
|
if (state.annotationId !== void 0) {
|
46772
|
-
|
46773
|
-
|
46774
|
-
|
46775
|
-
|
46467
|
+
json.annotationId = state.annotationId;
|
46468
|
+
json.annotationPart = state.annotationPartIndex;
|
46469
|
+
json.annotationSource = state.annotationSourceIndex;
|
46470
|
+
json.annotationSubsource = state.annotationSubsource;
|
46776
46471
|
}
|
46777
46472
|
if (state.value != null) {
|
46778
|
-
|
46473
|
+
json.value = state.value;
|
46779
46474
|
}
|
46780
|
-
return
|
46475
|
+
return json;
|
46781
46476
|
}
|
46782
46477
|
captureSelectionState(state, mouseState) {
|
46783
46478
|
state.localCoordinateSpace = this.localCoordinateSpace.value;
|
@@ -46979,8 +46674,8 @@ class UserLayer extends RefCounted {
|
|
46979
46674
|
selectedValueToJson(value) {
|
46980
46675
|
return value;
|
46981
46676
|
}
|
46982
|
-
selectedValueFromJson(
|
46983
|
-
return
|
46677
|
+
selectedValueFromJson(json) {
|
46678
|
+
return json;
|
46984
46679
|
}
|
46985
46680
|
setLayerPosition(modelTransform, layerPosition) {
|
46986
46681
|
const globalPosition = this.manager.root.globalPosition;
|
@@ -47517,13 +47212,13 @@ class TrackableDataSelectionState extends RefCounted {
|
|
47517
47212
|
if (value !== this.value_) {
|
47518
47213
|
this.value_ = value;
|
47519
47214
|
if (value !== void 0 && this.pin.value) {
|
47520
|
-
const
|
47521
|
-
|
47522
|
-
|
47523
|
-
if (
|
47524
|
-
|
47215
|
+
const history = this.history;
|
47216
|
+
history.length = Math.min(history.length, this.historyIndex + 1);
|
47217
|
+
history.push(value);
|
47218
|
+
if (history.length > maxSelectionHistorySize) {
|
47219
|
+
history.splice(0, history.length - maxSelectionHistorySize);
|
47525
47220
|
}
|
47526
|
-
this.historyIndex =
|
47221
|
+
this.historyIndex = history.length - 1;
|
47527
47222
|
}
|
47528
47223
|
this.changed.dispatch();
|
47529
47224
|
}
|
@@ -57957,8 +57652,8 @@ class SegmentationUserLayerColorGroupState extends RefCounted {
|
|
57957
57652
|
let idStr = _ref2[0];
|
57958
57653
|
let colorVec = _ref2[1];
|
57959
57654
|
const id = Uint64.parseString(String(idStr));
|
57960
|
-
const
|
57961
|
-
this.segmentStatedColors.set(id,
|
57655
|
+
const color = new Uint64(packColor(colorVec));
|
57656
|
+
this.segmentStatedColors.set(id, color);
|
57962
57657
|
}
|
57963
57658
|
});
|
57964
57659
|
}
|
@@ -58350,8 +58045,8 @@ class SegmentationUserLayer extends Base$2 {
|
|
58350
58045
|
}
|
58351
58046
|
}
|
58352
58047
|
}
|
58353
|
-
selectionStateFromJson(state,
|
58354
|
-
super.selectionStateFromJson(state,
|
58048
|
+
selectionStateFromJson(state, json) {
|
58049
|
+
super.selectionStateFromJson(state, json);
|
58355
58050
|
const v = new Uint64();
|
58356
58051
|
let value = state.value;
|
58357
58052
|
if (typeof value === "number") value = value.toString();
|
@@ -58362,22 +58057,22 @@ class SegmentationUserLayer extends Base$2 {
|
|
58362
58057
|
}
|
58363
58058
|
}
|
58364
58059
|
selectionStateToJson(state, forPython) {
|
58365
|
-
const
|
58060
|
+
const json = super.selectionStateToJson(state, forPython);
|
58366
58061
|
let value = state.value;
|
58367
58062
|
if (value instanceof Uint64MapEntry) {
|
58368
58063
|
if (forPython) {
|
58369
|
-
|
58064
|
+
json.value = {
|
58370
58065
|
key: value.key.toString(),
|
58371
58066
|
value: value.value ? value.value.toString() : void 0,
|
58372
58067
|
label: value.label
|
58373
58068
|
};
|
58374
58069
|
} else {
|
58375
|
-
|
58070
|
+
json.value = (value.value || value.key).toString();
|
58376
58071
|
}
|
58377
58072
|
} else if (value instanceof Uint64) {
|
58378
|
-
|
58073
|
+
json.value = value.toString();
|
58379
58074
|
}
|
58380
|
-
return
|
58075
|
+
return json;
|
58381
58076
|
}
|
58382
58077
|
displaySegmentationSelection(state, parent, context) {
|
58383
58078
|
const value = state.value;
|
@@ -58509,14 +58204,6 @@ registerLayerShaderControlsTool(SegmentationUserLayer, (layer) => ({
|
|
58509
58204
|
}), SKELETON_RENDERING_SHADER_CONTROL_TOOL_ID);
|
58510
58205
|
registerSegmentSplitMergeTools();
|
58511
58206
|
registerSegmentSelectTools();
|
58512
|
-
const segmentation_user_layer = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
58513
|
-
__proto__: null,
|
58514
|
-
LAYER_CONTROLS: LAYER_CONTROLS$1,
|
58515
|
-
SKELETON_RENDERING_SHADER_CONTROL_TOOL_ID,
|
58516
|
-
SegmentationUserLayer,
|
58517
|
-
SegmentationUserLayerColorGroupState,
|
58518
|
-
SegmentationUserLayerGroupState
|
58519
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
58520
58207
|
/**
|
58521
58208
|
* @license
|
58522
58209
|
* Copyright 2018 Google Inc.
|
@@ -58711,9 +58398,9 @@ class LinkedSegmentationLayers extends RefCounted {
|
|
58711
58398
|
[FILTER_BY_SEGMENTATION_JSON_KEY]: filterBySegmentation.length === 0 ? void 0 : filterBySegmentation
|
58712
58399
|
};
|
58713
58400
|
}
|
58714
|
-
restoreState(
|
58401
|
+
restoreState(json) {
|
58715
58402
|
const isLoading = this.annotationStates.isLoading;
|
58716
|
-
verifyOptionalObjectProperty(
|
58403
|
+
verifyOptionalObjectProperty(json, LINKED_SEGMENTATION_LAYER_JSON_KEY, (linkedJson) => {
|
58717
58404
|
if (typeof linkedJson === "string") {
|
58718
58405
|
linkedJson = { "segments": linkedJson };
|
58719
58406
|
}
|
@@ -58736,7 +58423,7 @@ class LinkedSegmentationLayers extends RefCounted {
|
|
58736
58423
|
}
|
58737
58424
|
}
|
58738
58425
|
});
|
58739
|
-
verifyOptionalObjectProperty(
|
58426
|
+
verifyOptionalObjectProperty(json, FILTER_BY_SEGMENTATION_JSON_KEY, (filterJson) => {
|
58740
58427
|
if (typeof filterJson === "boolean") {
|
58741
58428
|
filterJson = filterJson === true ? ["segments"] : [];
|
58742
58429
|
}
|
@@ -59086,14 +58773,6 @@ registerLayerTypeDetector((subsource) => {
|
|
59086
58773
|
registerLayerShaderControlsTool(AnnotationUserLayer, (layer) => ({
|
59087
58774
|
shaderControlState: layer.annotationDisplayState.shaderControls
|
59088
58775
|
}));
|
59089
|
-
const user_layer = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
59090
|
-
__proto__: null,
|
59091
|
-
AnnotationUserLayer
|
59092
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
59093
|
-
const require$$2 = /* @__PURE__ */ getAugmentedNamespace(user_layer);
|
59094
|
-
const require$$3 = /* @__PURE__ */ getAugmentedNamespace(frontend);
|
59095
|
-
const require$$4 = /* @__PURE__ */ getAugmentedNamespace(segmentation_user_layer);
|
59096
|
-
const require$$5 = /* @__PURE__ */ getAugmentedNamespace(color);
|
59097
58776
|
function bindDefaultCopyHandler(viewer) {
|
59098
58777
|
viewer.registerEventListener(document, "copy", (event) => {
|
59099
58778
|
if (isInputTextTarget(event.target)) {
|
@@ -60595,7 +60274,7 @@ async function getAnnotationChunkSource$1(options, sourceParameters, dataInstanc
|
|
60595
60274
|
let multiscaleVolumeInfo = new MultiscaleVolumeInfo$1(dataInstanceInfo.volumeInfo);
|
60596
60275
|
return getChunkSource(multiscaleVolumeInfo, sourceParameters);
|
60597
60276
|
}
|
60598
|
-
async function getAnnotationSource$
|
60277
|
+
async function getAnnotationSource$2(options, sourceParameters, dataInstanceInfo, credentialsProvider) {
|
60599
60278
|
const box2 = {
|
60600
60279
|
lowerBounds: new Float64Array(dataInstanceInfo.lowerVoxelBound),
|
60601
60280
|
upperBounds: Float64Array.from(dataInstanceInfo.upperVoxelBound)
|
@@ -60721,7 +60400,7 @@ function getDataSource$1(options) {
|
|
60721
60400
|
max: 1,
|
60722
60401
|
step: 0.01
|
60723
60402
|
}];
|
60724
|
-
return getAnnotationSource$
|
60403
|
+
return getAnnotationSource$2(options, annotationSourceParameters, dataInstanceInfo, credentialsProvider);
|
60725
60404
|
} else {
|
60726
60405
|
if (!(dataInstanceInfo instanceof VolumeDataInstanceInfo)) {
|
60727
60406
|
throw new Error(`Invalid data instance ${dataInstanceKey}.`);
|
@@ -61763,7 +61442,7 @@ async function getAnnotationChunkSource(options, sourceParameters, dataInfo, cre
|
|
61763
61442
|
});
|
61764
61443
|
return getChunkSource(dataInfo, sourceParameters);
|
61765
61444
|
}
|
61766
|
-
async function getAnnotationSource(options, sourceParameters, credentialsProvider) {
|
61445
|
+
async function getAnnotationSource$1(options, sourceParameters, credentialsProvider) {
|
61767
61446
|
const dataInfo = await getAnnotationDataInfo(sourceParameters);
|
61768
61447
|
const box2 = {
|
61769
61448
|
lowerBounds: new Float64Array(dataInfo.lowerVoxelBound),
|
@@ -61875,7 +61554,7 @@ async function getDataSource(options, getCredentialsProvider) {
|
|
61875
61554
|
step: 1
|
61876
61555
|
}];
|
61877
61556
|
const credentialsProvider = getCredentialsProvider(sourceParameters.authServer);
|
61878
|
-
return getAnnotationSource(options, annotationSourceParameters, credentialsProvider);
|
61557
|
+
return getAnnotationSource$1(options, annotationSourceParameters, credentialsProvider);
|
61879
61558
|
});
|
61880
61559
|
}
|
61881
61560
|
async function completeHttpPath$1(_1) {
|
@@ -64495,9 +64174,9 @@ class MultiscaleVolumeChunkSource4 extends MultiscaleVolumeChunkSource$3 {
|
|
64495
64174
|
function getAttributes(chunkManager, credentialsProvider, url) {
|
64496
64175
|
return chunkManager.memoize.getUncounted({ type: "zarr:.zattrs json", url, credentialsProvider: getObjectId(credentialsProvider) }, async () => {
|
64497
64176
|
try {
|
64498
|
-
const
|
64499
|
-
verifyObject(
|
64500
|
-
return
|
64177
|
+
const json = await cancellableFetchSpecialOk(credentialsProvider, url + "/.zattrs", {}, responseJson);
|
64178
|
+
verifyObject(json);
|
64179
|
+
return json;
|
64501
64180
|
} catch (e) {
|
64502
64181
|
if (isNotFoundError(e)) return {};
|
64503
64182
|
throw e;
|
@@ -64506,8 +64185,8 @@ function getAttributes(chunkManager, credentialsProvider, url) {
|
|
64506
64185
|
}
|
64507
64186
|
function getMetadata(chunkManager, credentialsProvider, url) {
|
64508
64187
|
return chunkManager.memoize.getUncounted({ type: "zarr:.zarray json", url, credentialsProvider: getObjectId(credentialsProvider) }, async () => {
|
64509
|
-
const
|
64510
|
-
return parseZarrMetadata(
|
64188
|
+
const json = await cancellableFetchSpecialOk(credentialsProvider, url + "/.zarray", {}, responseJson);
|
64189
|
+
return parseZarrMetadata(json);
|
64511
64190
|
});
|
64512
64191
|
}
|
64513
64192
|
const supportedQueryParameters = [{
|
@@ -65489,860 +65168,613 @@ function setupDefaultViewer(options) {
|
|
65489
65168
|
disableContextMenu(options.target);
|
65490
65169
|
return viewer;
|
65491
65170
|
}
|
65492
|
-
|
65493
|
-
|
65494
|
-
|
65495
|
-
|
65496
|
-
|
65497
|
-
|
65498
|
-
|
65499
|
-
|
65500
|
-
|
65501
|
-
|
65502
|
-
|
65503
|
-
|
65504
|
-
|
65505
|
-
|
65506
|
-
|
65507
|
-
|
65508
|
-
|
65509
|
-
|
65510
|
-
|
65511
|
-
|
65512
|
-
|
65513
|
-
|
65514
|
-
|
65515
|
-
|
65516
|
-
|
65517
|
-
|
65518
|
-
|
65519
|
-
|
65520
|
-
|
65521
|
-
|
65522
|
-
|
65523
|
-
|
65524
|
-
|
65525
|
-
|
65526
|
-
|
65527
|
-
|
65528
|
-
|
65529
|
-
|
65530
|
-
|
65531
|
-
|
65532
|
-
|
65533
|
-
|
65534
|
-
exports.getAnnotationSource = getAnnotationSource2;
|
65535
|
-
exports.addLayerSignalRemover = addLayerSignalRemover;
|
65536
|
-
exports.unsubscribeLayersChangedSignals = unsubscribeLayersChangedSignals;
|
65537
|
-
exports.configureLayersChangedSignals = configureLayersChangedSignals;
|
65538
|
-
exports.configureAnnotationLayer = configureAnnotationLayer;
|
65539
|
-
exports.configureAnnotationLayerChanged = configureAnnotationLayerChanged;
|
65540
|
-
exports.getAnnotationSelectionHost = getAnnotationSelectionHost;
|
65541
|
-
exports.getSelectedAnnotationId = getSelectedAnnotationId;
|
65542
|
-
exports["default"] = void 0;
|
65543
|
-
var _react = _interopRequireDefault(React__default);
|
65544
|
-
var _propTypes = _interopRequireDefault(/* @__PURE__ */ requirePropTypes());
|
65545
|
-
var _user_layer = require$$2;
|
65546
|
-
var _frontend = require$$3;
|
65547
|
-
var _segmentation_user_layer = require$$4;
|
65548
|
-
var _color = require$$5;
|
65549
|
-
var _neuroglancer = require$$6;
|
65550
|
-
var _uint = require$$7;
|
65551
|
-
var _json = require$$8;
|
65552
|
-
var _url_hash_binding = require$$9;
|
65553
|
-
function _interopRequireDefault(obj) {
|
65554
|
-
return obj && obj.__esModule ? obj : { "default": obj };
|
65555
|
-
}
|
65556
|
-
function ownKeys(object, enumerableOnly) {
|
65557
|
-
var keys2 = Object.keys(object);
|
65558
|
-
if (Object.getOwnPropertySymbols) {
|
65559
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
65560
|
-
if (enumerableOnly) symbols = symbols.filter(function(sym) {
|
65561
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
65562
|
-
});
|
65563
|
-
keys2.push.apply(keys2, symbols);
|
65564
|
-
}
|
65565
|
-
return keys2;
|
65566
|
-
}
|
65567
|
-
function _objectSpread(target) {
|
65568
|
-
for (var i = 1; i < arguments.length; i++) {
|
65569
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
65570
|
-
if (i % 2) {
|
65571
|
-
ownKeys(Object(source), true).forEach(function(key) {
|
65572
|
-
_defineProperty(target, key, source[key]);
|
65573
|
-
});
|
65574
|
-
} else if (Object.getOwnPropertyDescriptors) {
|
65575
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
65576
|
-
} else {
|
65577
|
-
ownKeys(Object(source)).forEach(function(key) {
|
65578
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
65579
|
-
});
|
65171
|
+
const GREY_HEX = "#323232";
|
65172
|
+
const viewersKeyed = {};
|
65173
|
+
let viewerNoKey;
|
65174
|
+
function parseUrlHash(url) {
|
65175
|
+
let state = null;
|
65176
|
+
let s = url.replace(/^[^#]+/, "");
|
65177
|
+
if (s === "" || s === "#" || s === "#!") {
|
65178
|
+
s = "#!{}";
|
65179
|
+
}
|
65180
|
+
if (s.startsWith("#!+")) {
|
65181
|
+
s = s.slice(3);
|
65182
|
+
s = decodeURIComponent(s);
|
65183
|
+
state = urlSafeParse(s);
|
65184
|
+
} else if (s.startsWith("#!")) {
|
65185
|
+
s = s.slice(2);
|
65186
|
+
s = decodeURIComponent(s);
|
65187
|
+
state = urlSafeParse(s);
|
65188
|
+
} else {
|
65189
|
+
throw new Error("URL hash is expected to be of the form '#!{...}' or '#!+{...}'.");
|
65190
|
+
}
|
65191
|
+
return state;
|
65192
|
+
}
|
65193
|
+
function getNeuroglancerViewerState(key) {
|
65194
|
+
const v = key ? viewersKeyed[key] : viewerNoKey;
|
65195
|
+
return v ? v.state.toJSON() : {};
|
65196
|
+
}
|
65197
|
+
function getNeuroglancerColor(idStr, key) {
|
65198
|
+
try {
|
65199
|
+
const id = Uint64.parseString(idStr);
|
65200
|
+
const v = key ? viewersKeyed[key] : viewerNoKey;
|
65201
|
+
if (v) {
|
65202
|
+
for (const layer of v.layerManager.managedLayers) {
|
65203
|
+
if (layer.layer instanceof SegmentationUserLayer) {
|
65204
|
+
const { displayState } = layer.layer;
|
65205
|
+
const colorVec = getObjectColor(displayState, id);
|
65206
|
+
if (displayState.segmentSelectionState.isSelected(id)) {
|
65207
|
+
for (let i = 0; i < 3; i += 1) {
|
65208
|
+
colorVec[i] = (colorVec[i] - 0.5) / 0.5;
|
65209
|
+
}
|
65210
|
+
}
|
65211
|
+
const colorStr = serializeColor(colorVec);
|
65212
|
+
return colorStr;
|
65580
65213
|
}
|
65581
65214
|
}
|
65582
|
-
return target;
|
65583
65215
|
}
|
65584
|
-
|
65585
|
-
|
65586
|
-
|
65587
|
-
|
65216
|
+
} catch {
|
65217
|
+
}
|
65218
|
+
return "";
|
65219
|
+
}
|
65220
|
+
function closeSelectionTab(key) {
|
65221
|
+
const v = key ? viewersKeyed[key] : viewerNoKey;
|
65222
|
+
if (v && v.closeSelectionTab) {
|
65223
|
+
v.closeSelectionTab();
|
65224
|
+
}
|
65225
|
+
}
|
65226
|
+
function getLayerManager(key) {
|
65227
|
+
const v = key ? viewersKeyed[key] : viewerNoKey;
|
65228
|
+
if (v) {
|
65229
|
+
return v.layerManager;
|
65230
|
+
}
|
65231
|
+
return void 0;
|
65232
|
+
}
|
65233
|
+
function getManagedLayer(key, name2) {
|
65234
|
+
const layerManager = getLayerManager(key);
|
65235
|
+
if (layerManager) {
|
65236
|
+
return layerManager.managedLayers.filter((layer) => layer.name === name2)[0];
|
65237
|
+
}
|
65238
|
+
return void 0;
|
65239
|
+
}
|
65240
|
+
function getAnnotationLayer(key, name2) {
|
65241
|
+
const layer = getManagedLayer(key, name2);
|
65242
|
+
if (layer && layer.layer instanceof AnnotationUserLayer) {
|
65243
|
+
return layer.layer;
|
65244
|
+
}
|
65245
|
+
return void 0;
|
65246
|
+
}
|
65247
|
+
function getAnnotationSource(key, name2) {
|
65248
|
+
const layer = getAnnotationLayer(key, name2);
|
65249
|
+
if (layer && layer.dataSources && layer.dataSources[0].loadState_) {
|
65250
|
+
const { dataSource } = layer.dataSources[0].loadState_;
|
65251
|
+
if (dataSource) {
|
65252
|
+
return dataSource.subsources[0].subsource.annotation;
|
65588
65253
|
}
|
65589
|
-
|
65590
|
-
|
65591
|
-
|
65592
|
-
|
65593
|
-
|
65594
|
-
|
65595
|
-
|
65596
|
-
}
|
65254
|
+
}
|
65255
|
+
return void 0;
|
65256
|
+
}
|
65257
|
+
function addLayerSignalRemover(key, name2, remover) {
|
65258
|
+
const layerManager = getLayerManager(key);
|
65259
|
+
if (layerManager && name2 && remover) {
|
65260
|
+
if (!layerManager.customSignalHandlerRemovers) {
|
65261
|
+
layerManager.customSignalHandlerRemovers = {};
|
65597
65262
|
}
|
65598
|
-
|
65599
|
-
|
65600
|
-
return Constructor;
|
65263
|
+
if (!layerManager.customSignalHandlerRemovers[name2]) {
|
65264
|
+
layerManager.customSignalHandlerRemovers[name2] = [];
|
65601
65265
|
}
|
65602
|
-
|
65603
|
-
|
65604
|
-
|
65266
|
+
layerManager.customSignalHandlerRemovers[name2].push(remover);
|
65267
|
+
}
|
65268
|
+
}
|
65269
|
+
function unsubscribeLayersChangedSignals(layerManager, signalKey) {
|
65270
|
+
if (layerManager) {
|
65271
|
+
if (layerManager.customSignalHandlerRemovers) {
|
65272
|
+
if (layerManager.customSignalHandlerRemovers[signalKey]) {
|
65273
|
+
layerManager.customSignalHandlerRemovers[signalKey].forEach((remover) => {
|
65274
|
+
remover();
|
65275
|
+
});
|
65276
|
+
delete layerManager.customSignalHandlerRemovers[signalKey];
|
65605
65277
|
}
|
65606
|
-
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
|
65607
|
-
if (superClass) _setPrototypeOf(subClass, superClass);
|
65608
65278
|
}
|
65609
|
-
|
65610
|
-
|
65611
|
-
|
65612
|
-
|
65613
|
-
|
65614
|
-
|
65615
|
-
|
65616
|
-
|
65617
|
-
|
65618
|
-
|
65619
|
-
|
65620
|
-
if (
|
65621
|
-
|
65622
|
-
result = Reflect.construct(Super, arguments, NewTarget);
|
65623
|
-
} else {
|
65624
|
-
result = Super.apply(this, arguments);
|
65279
|
+
}
|
65280
|
+
}
|
65281
|
+
function configureLayersChangedSignals(key, layerConfig) {
|
65282
|
+
const layerManager = getLayerManager(key);
|
65283
|
+
if (layerManager) {
|
65284
|
+
const { layerName } = layerConfig;
|
65285
|
+
unsubscribeLayersChangedSignals(layerManager, layerName);
|
65286
|
+
if (layerConfig.process) {
|
65287
|
+
const recordRemover = (remover) => addLayerSignalRemover(void 0, layerName, remover);
|
65288
|
+
recordRemover(layerManager.layersChanged.add(() => {
|
65289
|
+
const layer2 = getManagedLayer(void 0, layerName);
|
65290
|
+
if (layer2) {
|
65291
|
+
layerConfig.process(layer2);
|
65625
65292
|
}
|
65626
|
-
|
65627
|
-
|
65628
|
-
|
65629
|
-
|
65630
|
-
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
65631
|
-
return call;
|
65293
|
+
}));
|
65294
|
+
const layer = getManagedLayer(void 0, layerName);
|
65295
|
+
if (layer) {
|
65296
|
+
layerConfig.process(layer);
|
65632
65297
|
}
|
65633
|
-
return
|
65298
|
+
return () => {
|
65299
|
+
if (layerConfig.cancel) {
|
65300
|
+
layerConfig.cancel();
|
65301
|
+
}
|
65302
|
+
unsubscribeLayersChangedSignals(layerManager, layerName);
|
65303
|
+
};
|
65634
65304
|
}
|
65635
|
-
|
65636
|
-
|
65637
|
-
|
65638
|
-
|
65639
|
-
|
65305
|
+
}
|
65306
|
+
return layerConfig.cancel;
|
65307
|
+
}
|
65308
|
+
function configureAnnotationSource(source, props, recordRemover) {
|
65309
|
+
if (source && !source.signalReady) {
|
65310
|
+
if (props.onAnnotationAdded) {
|
65311
|
+
recordRemover(source.childAdded.add((annotation) => {
|
65312
|
+
props.onAnnotationAdded(annotation);
|
65313
|
+
}));
|
65640
65314
|
}
|
65641
|
-
|
65642
|
-
|
65643
|
-
|
65644
|
-
|
65645
|
-
try {
|
65646
|
-
Date.prototype.toString.call(Reflect.construct(Date, [], function() {
|
65647
|
-
}));
|
65648
|
-
return true;
|
65649
|
-
} catch (e) {
|
65650
|
-
return false;
|
65651
|
-
}
|
65315
|
+
if (props.onAnnotationDeleted) {
|
65316
|
+
recordRemover(source.childDeleted.add((id) => {
|
65317
|
+
props.onAnnotationDeleted(id);
|
65318
|
+
}));
|
65652
65319
|
}
|
65653
|
-
|
65654
|
-
|
65655
|
-
|
65656
|
-
};
|
65657
|
-
return _getPrototypeOf(o);
|
65320
|
+
if (props.onAnnotationUpdated) {
|
65321
|
+
recordRemover(source.childUpdated.add((annotation) => {
|
65322
|
+
props.onAnnotationUpdated(annotation);
|
65323
|
+
}));
|
65658
65324
|
}
|
65659
|
-
|
65660
|
-
|
65661
|
-
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
|
65662
|
-
} else {
|
65663
|
-
obj[key] = value;
|
65664
|
-
}
|
65665
|
-
return obj;
|
65325
|
+
if (props.onAnnotationChanged && source.referencesChanged) {
|
65326
|
+
recordRemover(source.referencesChanged.add(props.onAnnotationChanged));
|
65666
65327
|
}
|
65667
|
-
|
65668
|
-
|
65669
|
-
|
65670
|
-
|
65671
|
-
|
65672
|
-
|
65673
|
-
|
65674
|
-
|
65675
|
-
|
65676
|
-
|
65677
|
-
|
65678
|
-
|
65679
|
-
|
65680
|
-
|
65681
|
-
|
65682
|
-
|
65683
|
-
|
65684
|
-
|
65685
|
-
|
65686
|
-
|
65687
|
-
|
65688
|
-
|
65689
|
-
normalCompletion = step.done;
|
65690
|
-
return step;
|
65691
|
-
}, e: function e(_e2) {
|
65692
|
-
didErr = true;
|
65693
|
-
err = _e2;
|
65694
|
-
}, f: function f() {
|
65695
|
-
try {
|
65696
|
-
if (!normalCompletion && it["return"] != null) it["return"]();
|
65697
|
-
} finally {
|
65698
|
-
if (didErr) throw err;
|
65699
|
-
}
|
65700
|
-
} };
|
65328
|
+
source.signalReady = true;
|
65329
|
+
recordRemover(() => {
|
65330
|
+
source.signalReady = false;
|
65331
|
+
});
|
65332
|
+
}
|
65333
|
+
}
|
65334
|
+
function getLoadedDataSource(layer) {
|
65335
|
+
if (layer.dataSources && layer.dataSources.length > 0 && layer.dataSources[0].loadState_ && layer.dataSources[0].loadState_.dataSource) {
|
65336
|
+
return layer.dataSources[0].loadState_.dataSource;
|
65337
|
+
}
|
65338
|
+
}
|
65339
|
+
function getAnnotationSourceFromLayer(layer) {
|
65340
|
+
const dataSource = getLoadedDataSource(layer);
|
65341
|
+
if (dataSource) {
|
65342
|
+
return dataSource.subsources[0].subsource.annotation;
|
65343
|
+
}
|
65344
|
+
}
|
65345
|
+
function configureAnnotationSourceChange(annotationLayer, props, recordRemover) {
|
65346
|
+
const configure = () => {
|
65347
|
+
const source = getAnnotationSourceFromLayer(annotationLayer);
|
65348
|
+
if (source) {
|
65349
|
+
configureAnnotationSource(source, props, recordRemover);
|
65701
65350
|
}
|
65702
|
-
|
65703
|
-
|
65704
|
-
|
65705
|
-
|
65706
|
-
|
65707
|
-
|
65708
|
-
|
65709
|
-
}
|
65710
|
-
|
65711
|
-
|
65712
|
-
|
65713
|
-
|
65714
|
-
|
65715
|
-
|
65716
|
-
|
65717
|
-
|
65718
|
-
|
65719
|
-
|
65720
|
-
|
65721
|
-
|
65722
|
-
|
65723
|
-
|
65724
|
-
|
65725
|
-
if (s.startsWith("#!+")) {
|
65726
|
-
s = s.slice(3);
|
65727
|
-
s = decodeURIComponent(s);
|
65728
|
-
state = (0, _json.urlSafeParse)(s);
|
65729
|
-
} else if (s.startsWith("#!")) {
|
65730
|
-
s = s.slice(2);
|
65731
|
-
s = decodeURIComponent(s);
|
65732
|
-
state = (0, _json.urlSafeParse)(s);
|
65733
|
-
} else {
|
65734
|
-
throw new Error('URL hash is expected to be of the form "#!{...}" or "#!+{...}".');
|
65351
|
+
};
|
65352
|
+
const sourceChanged = annotationLayer.dataSourcesChanged;
|
65353
|
+
if (sourceChanged && !sourceChanged.signalReady) {
|
65354
|
+
recordRemover(sourceChanged.add(configure));
|
65355
|
+
sourceChanged.signalReady = true;
|
65356
|
+
recordRemover(() => {
|
65357
|
+
sourceChanged.signalReady = false;
|
65358
|
+
});
|
65359
|
+
configure();
|
65360
|
+
}
|
65361
|
+
}
|
65362
|
+
function configureAnnotationLayer(layer, props, recordRemover) {
|
65363
|
+
if (layer) {
|
65364
|
+
layer.expectingExternalTable = true;
|
65365
|
+
if (layer.selectedAnnotation && !layer.selectedAnnotation.changed.signalReady) {
|
65366
|
+
if (props.onAnnotationSelectionChanged) {
|
65367
|
+
recordRemover(layer.selectedAnnotation.changed.add(() => {
|
65368
|
+
props.onAnnotationSelectionChanged(layer.selectedAnnotation.value);
|
65369
|
+
}));
|
65370
|
+
recordRemover(() => {
|
65371
|
+
layer.selectedAnnotation.changed.signalReady = false;
|
65372
|
+
});
|
65373
|
+
layer.selectedAnnotation.changed.signalReady = true;
|
65735
65374
|
}
|
65736
|
-
return state;
|
65737
65375
|
}
|
65738
|
-
|
65739
|
-
|
65740
|
-
|
65376
|
+
configureAnnotationSourceChange(layer, props, recordRemover);
|
65377
|
+
}
|
65378
|
+
}
|
65379
|
+
function configureAnnotationLayerChanged(layer, props, recordRemover) {
|
65380
|
+
if (!layer.layerChanged.signalReady) {
|
65381
|
+
const remover = layer.layerChanged.add(() => {
|
65382
|
+
configureAnnotationLayer(layer.layer, props, recordRemover);
|
65383
|
+
});
|
65384
|
+
layer.layerChanged.signalReady = true;
|
65385
|
+
recordRemover(remover);
|
65386
|
+
recordRemover(() => {
|
65387
|
+
layer.layerChanged.signalReady = false;
|
65388
|
+
});
|
65389
|
+
configureAnnotationLayer(layer.layer, props, recordRemover);
|
65390
|
+
}
|
65391
|
+
}
|
65392
|
+
function getAnnotationSelectionHost(key) {
|
65393
|
+
const viewer = key ? viewersKeyed[key] : viewerNoKey;
|
65394
|
+
if (viewer) {
|
65395
|
+
if (viewer.selectionDetailsState) {
|
65396
|
+
return "viewer";
|
65741
65397
|
}
|
65742
|
-
|
65743
|
-
|
65744
|
-
|
65745
|
-
|
65746
|
-
|
65747
|
-
|
65748
|
-
|
65749
|
-
|
65750
|
-
|
65751
|
-
|
65752
|
-
|
65753
|
-
|
65754
|
-
|
65755
|
-
|
65756
|
-
colorVec[i] = (colorVec[i] - 0.5) / 0.5;
|
65757
|
-
}
|
65758
|
-
}
|
65759
|
-
var colorStr = (0, _color.serializeColor)(colorVec);
|
65760
|
-
return colorStr;
|
65761
|
-
}
|
65762
|
-
}
|
65763
|
-
} catch (err) {
|
65764
|
-
_iterator.e(err);
|
65765
|
-
} finally {
|
65766
|
-
_iterator.f();
|
65398
|
+
return "layer";
|
65399
|
+
}
|
65400
|
+
return null;
|
65401
|
+
}
|
65402
|
+
function getSelectedAnnotationId(key, layerName) {
|
65403
|
+
const viewer = key ? viewersKeyed[key] : viewerNoKey;
|
65404
|
+
if (viewer) {
|
65405
|
+
if (viewer.selectionDetailsState) {
|
65406
|
+
if (viewer.selectionDetailsState.value) {
|
65407
|
+
const { layers } = viewer.selectionDetailsState.value;
|
65408
|
+
if (layers) {
|
65409
|
+
const layer = layers.find((_layer) => _layer.layer.managedLayer.name === layerName);
|
65410
|
+
if (layer && layer.state) {
|
65411
|
+
return layer.state.annotationId;
|
65767
65412
|
}
|
65768
65413
|
}
|
65769
|
-
} catch (_unused) {
|
65770
|
-
}
|
65771
|
-
return "";
|
65772
|
-
}
|
65773
|
-
function closeSelectionTab(key) {
|
65774
|
-
var v = key ? viewersKeyed[key] : viewerNoKey;
|
65775
|
-
if (v && v.closeSelectionTab) {
|
65776
|
-
v.closeSelectionTab();
|
65777
65414
|
}
|
65778
|
-
}
|
65779
|
-
|
65780
|
-
|
65781
|
-
|
65782
|
-
return v.layerManager;
|
65415
|
+
} else {
|
65416
|
+
const layer = getAnnotationLayer(void 0, layerName);
|
65417
|
+
if (layer && layer.selectedAnnotation && layer.selectedAnnotation.value) {
|
65418
|
+
return layer.selectedAnnotation.value.id;
|
65783
65419
|
}
|
65784
|
-
return void 0;
|
65785
65420
|
}
|
65786
|
-
|
65787
|
-
|
65788
|
-
|
65789
|
-
|
65790
|
-
|
65791
|
-
|
65792
|
-
|
65793
|
-
|
65421
|
+
}
|
65422
|
+
return null;
|
65423
|
+
}
|
65424
|
+
class Neuroglancer extends React__default.Component {
|
65425
|
+
static defaultProps = {
|
65426
|
+
perspectiveZoom: 20,
|
65427
|
+
eventBindingsToUpdate: null,
|
65428
|
+
brainMapsClientId: "NOT_A_VALID_ID",
|
65429
|
+
viewerState: null,
|
65430
|
+
onSelectedChanged: null,
|
65431
|
+
onVisibleChanged: null,
|
65432
|
+
onSelectionDetailsStateChanged: null,
|
65433
|
+
onViewerStateChanged: null,
|
65434
|
+
key: null,
|
65435
|
+
callbacks: [],
|
65436
|
+
ngServer: "https://neuroglancer-demo.appspot.com/"
|
65437
|
+
};
|
65438
|
+
constructor(props) {
|
65439
|
+
super(props);
|
65440
|
+
this.ngContainer = React__default.createRef();
|
65441
|
+
this.viewer = null;
|
65442
|
+
this.muteViewerChanged = false;
|
65443
|
+
this.prevVisibleIds = /* @__PURE__ */ new Set();
|
65444
|
+
this.prevColorMap = null;
|
65445
|
+
this.disposers = [];
|
65446
|
+
this.prevColorOverrides = /* @__PURE__ */ new Set();
|
65447
|
+
this.overrideColorsById = /* @__PURE__ */ Object.create(null);
|
65448
|
+
this.allKnownIds = /* @__PURE__ */ new Set();
|
65449
|
+
}
|
65450
|
+
minimalPoseSnapshot = () => {
|
65451
|
+
const v = this.viewer;
|
65452
|
+
const projScale = v.projectionScale?.value;
|
65453
|
+
const projQuat = v.projectionOrientation?.orientation;
|
65454
|
+
return {
|
65455
|
+
position: Array.from(v.position.value || []),
|
65456
|
+
projectionScale: projScale,
|
65457
|
+
projectionOrientation: Array.from(projQuat || [])
|
65458
|
+
};
|
65459
|
+
};
|
65460
|
+
// Coalesce many NG changes → one upstream update per frame.
|
65461
|
+
scheduleEmit = () => {
|
65462
|
+
let raf = null;
|
65463
|
+
return () => {
|
65464
|
+
if (this.muteViewerChanged)
|
65465
|
+
return;
|
65466
|
+
if (raf !== null)
|
65467
|
+
return;
|
65468
|
+
raf = requestAnimationFrame(() => {
|
65469
|
+
raf = null;
|
65470
|
+
this.props.onViewerStateChanged?.(this.minimalPoseSnapshot());
|
65471
|
+
});
|
65472
|
+
};
|
65473
|
+
};
|
65474
|
+
// Guard to mute outgoing emits we are programmatically making changes
|
65475
|
+
withoutEmitting = (fn) => {
|
65476
|
+
this.muteViewerChanged = true;
|
65477
|
+
try {
|
65478
|
+
fn();
|
65479
|
+
} finally {
|
65480
|
+
requestAnimationFrame(() => {
|
65481
|
+
this.muteViewerChanged = false;
|
65482
|
+
});
|
65794
65483
|
}
|
65795
|
-
|
65796
|
-
|
65797
|
-
|
65798
|
-
|
65799
|
-
|
65800
|
-
|
65484
|
+
};
|
65485
|
+
// Only consider actual changes in camera settings, i.e., position/rotation/zoom
|
65486
|
+
didLayersChange = (prevVS, nextVS) => {
|
65487
|
+
const stripColors = (layers) => (layers || []).map((l) => {
|
65488
|
+
if (!l)
|
65489
|
+
return l;
|
65490
|
+
const { segmentColors, ...rest } = l;
|
65491
|
+
return rest;
|
65492
|
+
});
|
65493
|
+
const prevLayers = stripColors(prevVS?.layers);
|
65494
|
+
const nextLayers = stripColors(nextVS?.layers);
|
65495
|
+
return JSON.stringify(prevLayers) !== JSON.stringify(nextLayers);
|
65496
|
+
};
|
65497
|
+
/* To add colors to the segments, turning unselected to grey */
|
65498
|
+
applyColorsAndVisibility = (cellColorMapping) => {
|
65499
|
+
if (!this.viewer)
|
65500
|
+
return;
|
65501
|
+
const selected = { ...cellColorMapping || {} };
|
65502
|
+
for (const id of Object.keys(selected))
|
65503
|
+
this.allKnownIds.add(id);
|
65504
|
+
if (this.allKnownIds.size === 0) {
|
65505
|
+
const init = this.props.viewerState?.layers?.[0]?.segmentColors || {};
|
65506
|
+
for (const id of Object.keys(init))
|
65507
|
+
this.allKnownIds.add(id);
|
65508
|
+
}
|
65509
|
+
const fullSegmentColors = {};
|
65510
|
+
for (const id of this.allKnownIds) {
|
65511
|
+
fullSegmentColors[id] = selected[id] || GREY_HEX;
|
65512
|
+
}
|
65513
|
+
const baseLayers = this.props.viewerState?.layers ?? (this.viewer.state.toJSON().layers || []);
|
65514
|
+
const newLayers = baseLayers.map((layer, idx) => {
|
65515
|
+
if (idx === 0 || layer?.type === "segmentation") {
|
65516
|
+
return { ...layer, segmentColors: fullSegmentColors };
|
65517
|
+
}
|
65518
|
+
return layer;
|
65519
|
+
});
|
65520
|
+
this.withoutEmitting(() => {
|
65521
|
+
this.viewer.state.restoreState({ layers: newLayers });
|
65522
|
+
});
|
65523
|
+
};
|
65524
|
+
componentDidMount() {
|
65525
|
+
const {
|
65526
|
+
viewerState,
|
65527
|
+
brainMapsClientId,
|
65528
|
+
eventBindingsToUpdate,
|
65529
|
+
callbacks,
|
65530
|
+
// ngServer,
|
65531
|
+
key,
|
65532
|
+
bundleRoot
|
65533
|
+
} = this.props;
|
65534
|
+
this.viewer = setupDefaultViewer({
|
65535
|
+
brainMapsClientId,
|
65536
|
+
target: this.ngContainer.current,
|
65537
|
+
bundleRoot
|
65538
|
+
});
|
65539
|
+
this.setCallbacks(callbacks);
|
65540
|
+
if (eventBindingsToUpdate) {
|
65541
|
+
this.updateEventBindings(eventBindingsToUpdate);
|
65542
|
+
}
|
65543
|
+
this.viewer.expectingExternalUI = true;
|
65544
|
+
if (this.viewer.selectionDetailsState) {
|
65545
|
+
this.viewer.selectionDetailsState.changed.add(this.selectionDetailsStateChanged);
|
65546
|
+
}
|
65547
|
+
this.viewer.layerManager.layersChanged.add(this.layersChanged);
|
65548
|
+
const emit = this.scheduleEmit();
|
65549
|
+
this.disposers.push(this.viewer.projectionScale.changed.add(emit));
|
65550
|
+
this.disposers.push(this.viewer.projectionOrientation.changed.add(emit));
|
65551
|
+
this.disposers.push(this.viewer.position.changed.add(emit));
|
65552
|
+
if (viewerState) {
|
65553
|
+
this.withoutEmitting(() => {
|
65554
|
+
this.viewer.state.restoreState(viewerState);
|
65555
|
+
});
|
65801
65556
|
}
|
65802
|
-
|
65803
|
-
|
65804
|
-
|
65805
|
-
|
65806
|
-
if (dataSource) {
|
65807
|
-
return dataSource.subsources[0].subsource.annotation;
|
65808
|
-
}
|
65809
|
-
}
|
65810
|
-
return void 0;
|
65557
|
+
if (key) {
|
65558
|
+
viewersKeyed[key] = this.viewer;
|
65559
|
+
} else {
|
65560
|
+
viewerNoKey = this.viewer;
|
65811
65561
|
}
|
65812
|
-
|
65813
|
-
|
65814
|
-
|
65815
|
-
|
65816
|
-
|
65817
|
-
|
65818
|
-
|
65819
|
-
|
65820
|
-
}
|
65821
|
-
layerManager.customSignalHandlerRemovers[name2].push(remover);
|
65562
|
+
}
|
65563
|
+
componentDidUpdate(prevProps, prevState) {
|
65564
|
+
const { viewerState, cellColorMapping } = this.props;
|
65565
|
+
const selectedSegments = {};
|
65566
|
+
for (const layer of this.viewer.layerManager.managedLayers) {
|
65567
|
+
if (layer.layer instanceof SegmentationUserLayer) {
|
65568
|
+
const { segmentSelectionState } = layer.layer.displayState;
|
65569
|
+
selectedSegments[layer.name] = segmentSelectionState.selectedSegment;
|
65822
65570
|
}
|
65823
65571
|
}
|
65824
|
-
|
65825
|
-
if (
|
65826
|
-
|
65827
|
-
|
65828
|
-
layerManager.customSignalHandlerRemovers[signalKey].forEach(function(remover) {
|
65829
|
-
remover();
|
65830
|
-
});
|
65831
|
-
delete layerManager.customSignalHandlerRemovers[signalKey];
|
65832
|
-
}
|
65833
|
-
}
|
65572
|
+
for (const layer of this.viewer.layerManager.managedLayers) {
|
65573
|
+
if (layer.layer instanceof SegmentationUserLayer) {
|
65574
|
+
const { segmentSelectionState } = layer.layer.displayState;
|
65575
|
+
segmentSelectionState.set(selectedSegments[layer.name]);
|
65834
65576
|
}
|
65835
65577
|
}
|
65836
|
-
|
65837
|
-
|
65838
|
-
|
65839
|
-
|
65840
|
-
|
65841
|
-
|
65842
|
-
|
65843
|
-
|
65844
|
-
|
65845
|
-
|
65846
|
-
|
65847
|
-
|
65848
|
-
|
65849
|
-
|
65850
|
-
|
65851
|
-
|
65852
|
-
|
65853
|
-
|
65854
|
-
|
65855
|
-
|
65856
|
-
|
65857
|
-
|
65858
|
-
|
65859
|
-
unsubscribeLayersChangedSignals(layerManager, layerName);
|
65860
|
-
};
|
65578
|
+
if (!viewerState)
|
65579
|
+
return;
|
65580
|
+
const prevVS = prevProps.viewerState;
|
65581
|
+
const camState = diffCameraState(prevVS, viewerState);
|
65582
|
+
if (camState.changed) {
|
65583
|
+
const patch = {};
|
65584
|
+
if (camState.scale) {
|
65585
|
+
patch.projectionScale = viewerState.projectionScale;
|
65586
|
+
if (Array.isArray(viewerState.position))
|
65587
|
+
patch.position = viewerState.position;
|
65588
|
+
} else if (camState.pos) {
|
65589
|
+
patch.position = viewerState.position;
|
65590
|
+
}
|
65591
|
+
if (camState.rot)
|
65592
|
+
patch.projectionOrientation = viewerState.projectionOrientation;
|
65593
|
+
this.withoutEmitting(() => this.viewer.state.restoreState(patch));
|
65594
|
+
}
|
65595
|
+
if (this.didLayersChange(prevVS, viewerState)) {
|
65596
|
+
this.withoutEmitting(() => {
|
65597
|
+
const layers = Array.isArray(viewerState.layers) ? viewerState.layers : [];
|
65598
|
+
this.viewer.state.restoreState({ layers });
|
65599
|
+
if (cellColorMapping && Object.keys(cellColorMapping).length) {
|
65600
|
+
this.applyColorsAndVisibility(cellColorMapping);
|
65861
65601
|
}
|
65862
|
-
}
|
65863
|
-
return layerConfig.cancel;
|
65602
|
+
});
|
65864
65603
|
}
|
65865
|
-
|
65866
|
-
|
65867
|
-
|
65868
|
-
|
65869
|
-
|
65870
|
-
|
65871
|
-
|
65872
|
-
if (props.onAnnotationDeleted) {
|
65873
|
-
recordRemover(source.childDeleted.add(function(id) {
|
65874
|
-
props.onAnnotationDeleted(id);
|
65875
|
-
}));
|
65876
|
-
}
|
65877
|
-
if (props.onAnnotationUpdated) {
|
65878
|
-
recordRemover(source.childUpdated.add(function(annotation) {
|
65879
|
-
props.onAnnotationUpdated(annotation);
|
65880
|
-
}));
|
65881
|
-
}
|
65882
|
-
if (props.onAnnotationChanged && source.referencesChanged) {
|
65883
|
-
recordRemover(source.referencesChanged.add(props.onAnnotationChanged));
|
65884
|
-
}
|
65885
|
-
source.signalReady = true;
|
65886
|
-
recordRemover(function() {
|
65887
|
-
source.signalReady = false;
|
65888
|
-
});
|
65889
|
-
}
|
65604
|
+
const prevSize = prevProps.cellColorMapping ? Object.keys(prevProps.cellColorMapping).length : 0;
|
65605
|
+
const currSize = cellColorMapping ? Object.keys(cellColorMapping).length : 0;
|
65606
|
+
const mappingRefChanged = prevProps.cellColorMapping !== cellColorMapping;
|
65607
|
+
if (!this.didLayersChange(prevVS, viewerState) && (mappingRefChanged || prevSize !== currSize)) {
|
65608
|
+
this.withoutEmitting(() => {
|
65609
|
+
this.applyColorsAndVisibility(cellColorMapping);
|
65610
|
+
});
|
65890
65611
|
}
|
65891
|
-
|
65892
|
-
if (
|
65893
|
-
return
|
65894
|
-
}
|
65612
|
+
const stripSegFields = (layers) => (layers || []).map((l) => {
|
65613
|
+
if (!l)
|
65614
|
+
return l;
|
65615
|
+
const { segments, segmentColors, ...rest } = l;
|
65616
|
+
return rest;
|
65617
|
+
});
|
65618
|
+
const prevLayers = prevProps.viewerState?.layers;
|
65619
|
+
const nextLayers = viewerState?.layers;
|
65620
|
+
const prevCore = JSON.stringify(stripSegFields(prevLayers));
|
65621
|
+
const nextCore = JSON.stringify(stripSegFields(nextLayers));
|
65622
|
+
const sourcesChanged = prevCore !== nextCore;
|
65623
|
+
const prevSegCount = prevLayers && prevLayers[0] && Array.isArray(prevLayers[0].segments) ? prevLayers[0].segments.length : 0;
|
65624
|
+
const nextSegCount = nextLayers && nextLayers[0] && Array.isArray(nextLayers[0].segments) ? nextLayers[0].segments.length : 0;
|
65625
|
+
const initialSegmentsAdded = prevSegCount === 0 && nextSegCount > 0;
|
65626
|
+
if (sourcesChanged || initialSegmentsAdded) {
|
65627
|
+
this.withoutEmitting(() => {
|
65628
|
+
this.viewer.state.restoreState({ layers: nextLayers });
|
65629
|
+
});
|
65895
65630
|
}
|
65896
|
-
|
65897
|
-
|
65898
|
-
|
65899
|
-
|
65631
|
+
}
|
65632
|
+
componentWillUnmount() {
|
65633
|
+
this.disposers.forEach((off) => {
|
65634
|
+
try {
|
65635
|
+
off();
|
65636
|
+
} catch {
|
65900
65637
|
}
|
65901
|
-
}
|
65902
|
-
|
65903
|
-
|
65904
|
-
|
65905
|
-
|
65906
|
-
|
65638
|
+
});
|
65639
|
+
this.disposers = [];
|
65640
|
+
const { key } = this.props;
|
65641
|
+
if (key) {
|
65642
|
+
delete viewersKeyed[key];
|
65643
|
+
} else {
|
65644
|
+
viewerNoKey = void 0;
|
65645
|
+
}
|
65646
|
+
}
|
65647
|
+
/* setCallbacks allows us to set a callback on a neuroglancer event
|
65648
|
+
* each callback created should be in the format:
|
65649
|
+
* [
|
65650
|
+
* {
|
65651
|
+
* name: 'unique-name',
|
65652
|
+
* event: 'the neuroglancer event to target, eg: click0, keyt',
|
65653
|
+
* function: (slice) => { slice.whatever }
|
65654
|
+
* },
|
65655
|
+
* {...}
|
65656
|
+
* ]
|
65657
|
+
*
|
65658
|
+
*/
|
65659
|
+
setCallbacks(callbacks) {
|
65660
|
+
callbacks.forEach((callback) => {
|
65661
|
+
this.viewer.bindCallback(callback.name, callback.function);
|
65662
|
+
this.viewer.inputEventBindings.sliceView.set(callback.event, callback.name);
|
65663
|
+
});
|
65664
|
+
}
|
65665
|
+
updateEventBindings = (eventBindingsToUpdate) => {
|
65666
|
+
const root = this.viewer.inputEventBindings;
|
65667
|
+
const traverse = (current) => {
|
65668
|
+
const replace = (eaMap, event0, event1) => {
|
65669
|
+
const action = eaMap.get(event0);
|
65670
|
+
if (action) {
|
65671
|
+
eaMap.delete(event0);
|
65672
|
+
if (event1) {
|
65673
|
+
eaMap.set(event1, action);
|
65674
|
+
}
|
65907
65675
|
}
|
65908
65676
|
};
|
65909
|
-
|
65910
|
-
|
65911
|
-
|
65912
|
-
|
65913
|
-
|
65914
|
-
|
65915
|
-
}
|
65916
|
-
|
65677
|
+
const eventActionMap = current.bindings;
|
65678
|
+
eventBindingsToUpdate.forEach((oldNewBinding) => {
|
65679
|
+
const eventOldBase = Array.isArray(oldNewBinding) ? oldNewBinding[0] : oldNewBinding;
|
65680
|
+
const eventOldA = `at:${eventOldBase}`;
|
65681
|
+
const eventNewA = oldNewBinding[1] ? `at:${oldNewBinding[1]}` : void 0;
|
65682
|
+
replace(eventActionMap, eventOldA, eventNewA);
|
65683
|
+
const eventOldB = `bubble:${eventOldBase}`;
|
65684
|
+
const eventNewB = oldNewBinding[1] ? `bubble:${oldNewBinding[1]}` : void 0;
|
65685
|
+
replace(eventActionMap, eventOldB, eventNewB);
|
65686
|
+
});
|
65687
|
+
current.parents.forEach((parent) => {
|
65688
|
+
traverse(parent);
|
65689
|
+
});
|
65690
|
+
};
|
65691
|
+
traverse(root.global);
|
65692
|
+
traverse(root.perspectiveView);
|
65693
|
+
traverse(root.sliceView);
|
65694
|
+
};
|
65695
|
+
selectionDetailsStateChanged = () => {
|
65696
|
+
if (this.viewer) {
|
65697
|
+
const { onSelectionDetailsStateChanged } = this.props;
|
65698
|
+
if (onSelectionDetailsStateChanged) {
|
65699
|
+
onSelectionDetailsStateChanged();
|
65917
65700
|
}
|
65918
65701
|
}
|
65919
|
-
|
65920
|
-
|
65921
|
-
|
65922
|
-
|
65923
|
-
|
65924
|
-
|
65925
|
-
|
65926
|
-
|
65927
|
-
|
65928
|
-
|
65929
|
-
|
65930
|
-
layer.
|
65702
|
+
};
|
65703
|
+
layersChanged = () => {
|
65704
|
+
if (this.handlerRemovers) {
|
65705
|
+
this.handlerRemovers.forEach((remover) => remover());
|
65706
|
+
}
|
65707
|
+
if (this.viewer) {
|
65708
|
+
const { onSelectedChanged, onVisibleChanged } = this.props;
|
65709
|
+
if (onSelectedChanged || onVisibleChanged) {
|
65710
|
+
this.handlerRemovers = [];
|
65711
|
+
for (const layer of this.viewer.layerManager.managedLayers) {
|
65712
|
+
if (layer.layer instanceof SegmentationUserLayer) {
|
65713
|
+
const { segmentSelectionState } = layer.layer.displayState;
|
65714
|
+
const { visibleSegments } = layer.layer.displayState.segmentationGroupState.value;
|
65715
|
+
if (segmentSelectionState && onSelectedChanged) {
|
65716
|
+
const selectedChanged = this.selectedChanged.bind(void 0, layer);
|
65717
|
+
const remover = segmentSelectionState.changed.add(selectedChanged);
|
65718
|
+
this.handlerRemovers.push(remover);
|
65719
|
+
layer.registerDisposer(remover);
|
65720
|
+
}
|
65721
|
+
if (visibleSegments && onVisibleChanged) {
|
65722
|
+
const visibleChanged = this.visibleChanged.bind(void 0, layer);
|
65723
|
+
const remover = visibleSegments.changed.add(visibleChanged);
|
65724
|
+
this.handlerRemovers.push(remover);
|
65725
|
+
layer.registerDisposer(remover);
|
65726
|
+
}
|
65931
65727
|
}
|
65932
65728
|
}
|
65933
|
-
configureAnnotationSourceChange(layer, props, recordRemover);
|
65934
|
-
}
|
65935
|
-
}
|
65936
|
-
function configureAnnotationLayerChanged(layer, props, recordRemover) {
|
65937
|
-
if (!layer.layerChanged.signalReady) {
|
65938
|
-
var remover = layer.layerChanged.add(function() {
|
65939
|
-
configureAnnotationLayer(layer.layer, props, recordRemover);
|
65940
|
-
});
|
65941
|
-
layer.layerChanged.signalReady = true;
|
65942
|
-
recordRemover(remover);
|
65943
|
-
recordRemover(function() {
|
65944
|
-
layer.layerChanged.signalReady = false;
|
65945
|
-
});
|
65946
|
-
configureAnnotationLayer(layer.layer, props, recordRemover);
|
65947
65729
|
}
|
65948
65730
|
}
|
65949
|
-
|
65950
|
-
|
65951
|
-
|
65952
|
-
|
65953
|
-
|
65954
|
-
|
65955
|
-
|
65731
|
+
};
|
65732
|
+
/* ** Vitessce Integration update start ** */
|
65733
|
+
selectedChanged = (layer) => {
|
65734
|
+
if (!this.viewer)
|
65735
|
+
return;
|
65736
|
+
const { onSelectedChanged } = this.props;
|
65737
|
+
if (onSelectedChanged) {
|
65738
|
+
const { segmentSelectionState } = layer.layer.displayState;
|
65739
|
+
if (!segmentSelectionState)
|
65740
|
+
return;
|
65741
|
+
const selected = segmentSelectionState.selectedSegment;
|
65742
|
+
if (selected) {
|
65743
|
+
onSelectedChanged(selected, layer);
|
65956
65744
|
}
|
65957
|
-
return null;
|
65958
65745
|
}
|
65959
|
-
|
65960
|
-
|
65961
|
-
|
65962
|
-
|
65963
|
-
|
65964
|
-
|
65965
|
-
|
65966
|
-
|
65967
|
-
return _layer.layer.managedLayer.name === layerName;
|
65968
|
-
});
|
65969
|
-
if (layer && layer.state) {
|
65970
|
-
return layer.state.annotationId;
|
65971
|
-
}
|
65972
|
-
}
|
65973
|
-
}
|
65974
|
-
} else {
|
65975
|
-
var _layer2 = getAnnotationLayer(void 0, layerName);
|
65976
|
-
if (_layer2 && _layer2.selectedAnnotation && _layer2.selectedAnnotation.value) {
|
65977
|
-
return _layer2.selectedAnnotation.value.id;
|
65978
|
-
}
|
65746
|
+
};
|
65747
|
+
visibleChanged = (layer) => {
|
65748
|
+
if (this.viewer) {
|
65749
|
+
const { onVisibleChanged } = this.props;
|
65750
|
+
if (onVisibleChanged) {
|
65751
|
+
const { visibleSegments } = layer.layer.displayState.segmentationGroupState.value;
|
65752
|
+
if (visibleSegments) {
|
65753
|
+
onVisibleChanged(visibleSegments, layer);
|
65979
65754
|
}
|
65980
65755
|
}
|
65981
|
-
return null;
|
65982
65756
|
}
|
65983
|
-
|
65984
|
-
|
65985
|
-
|
65986
|
-
|
65987
|
-
|
65988
|
-
_classCallCheck(this, Neuroglancer3);
|
65989
|
-
_this = _super.call(this, props);
|
65990
|
-
_defineProperty(_assertThisInitialized(_this), "updateEventBindings", function(eventBindingsToUpdate) {
|
65991
|
-
var root = _this.viewer.inputEventBindings;
|
65992
|
-
var traverse = function traverse2(current) {
|
65993
|
-
var replace = function replace2(eaMap, event0, event1) {
|
65994
|
-
var action = eaMap.get(event0);
|
65995
|
-
if (action) {
|
65996
|
-
eaMap["delete"](event0);
|
65997
|
-
if (event1) {
|
65998
|
-
eaMap.set(event1, action);
|
65999
|
-
}
|
66000
|
-
}
|
66001
|
-
};
|
66002
|
-
var eventActionMap = current.bindings;
|
66003
|
-
eventBindingsToUpdate.forEach(function(oldNewBinding) {
|
66004
|
-
var eventOldBase = Array.isArray(oldNewBinding) ? oldNewBinding[0] : oldNewBinding;
|
66005
|
-
var eventOldA = "at:".concat(eventOldBase);
|
66006
|
-
var eventNewA = oldNewBinding[1] ? "at:".concat(oldNewBinding[1]) : void 0;
|
66007
|
-
replace(eventActionMap, eventOldA, eventNewA);
|
66008
|
-
var eventOldB = "bubble:".concat(eventOldBase);
|
66009
|
-
var eventNewB = oldNewBinding[1] ? "bubble:".concat(oldNewBinding[1]) : void 0;
|
66010
|
-
replace(eventActionMap, eventOldB, eventNewB);
|
66011
|
-
});
|
66012
|
-
current.parents.forEach(function(parent) {
|
66013
|
-
traverse2(parent);
|
66014
|
-
});
|
66015
|
-
};
|
66016
|
-
traverse(root.global);
|
66017
|
-
traverse(root.perspectiveView);
|
66018
|
-
traverse(root.sliceView);
|
66019
|
-
});
|
66020
|
-
_defineProperty(_assertThisInitialized(_this), "selectionDetailsStateChanged", function() {
|
66021
|
-
if (_this.viewer) {
|
66022
|
-
var onSelectionDetailsStateChanged = _this.props.onSelectionDetailsStateChanged;
|
66023
|
-
if (onSelectionDetailsStateChanged) {
|
66024
|
-
onSelectionDetailsStateChanged();
|
66025
|
-
}
|
66026
|
-
}
|
66027
|
-
});
|
66028
|
-
_defineProperty(_assertThisInitialized(_this), "layersChanged", function() {
|
66029
|
-
if (_this.handlerRemovers) {
|
66030
|
-
_this.handlerRemovers.forEach(function(remover2) {
|
66031
|
-
return remover2();
|
66032
|
-
});
|
66033
|
-
}
|
66034
|
-
if (_this.viewer) {
|
66035
|
-
var _this$props = _this.props, onSelectedChanged = _this$props.onSelectedChanged, onVisibleChanged = _this$props.onVisibleChanged;
|
66036
|
-
if (onSelectedChanged || onVisibleChanged) {
|
66037
|
-
_this.handlerRemovers = [];
|
66038
|
-
var _iterator2 = _createForOfIteratorHelper(_this.viewer.layerManager.managedLayers), _step2;
|
66039
|
-
try {
|
66040
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done; ) {
|
66041
|
-
var layer = _step2.value;
|
66042
|
-
if (layer.layer instanceof _segmentation_user_layer.SegmentationUserLayer) {
|
66043
|
-
var segmentSelectionState = layer.layer.displayState.segmentSelectionState;
|
66044
|
-
var visibleSegments = layer.layer.displayState.segmentationGroupState.value.visibleSegments;
|
66045
|
-
if (segmentSelectionState && onSelectedChanged) {
|
66046
|
-
var selectedChanged = _this.selectedChanged.bind(void 0, layer);
|
66047
|
-
var remover = segmentSelectionState.changed.add(selectedChanged);
|
66048
|
-
_this.handlerRemovers.push(remover);
|
66049
|
-
layer.registerDisposer(remover);
|
66050
|
-
}
|
66051
|
-
if (visibleSegments && onVisibleChanged) {
|
66052
|
-
var visibleChanged = _this.visibleChanged.bind(void 0, layer);
|
66053
|
-
var _remover = visibleSegments.changed.add(visibleChanged);
|
66054
|
-
_this.handlerRemovers.push(_remover);
|
66055
|
-
layer.registerDisposer(_remover);
|
66056
|
-
}
|
66057
|
-
}
|
66058
|
-
}
|
66059
|
-
} catch (err) {
|
66060
|
-
_iterator2.e(err);
|
66061
|
-
} finally {
|
66062
|
-
_iterator2.f();
|
66063
|
-
}
|
66064
|
-
}
|
66065
|
-
}
|
66066
|
-
});
|
66067
|
-
_defineProperty(_assertThisInitialized(_this), "selectedChanged", function(layer) {
|
66068
|
-
if (_this.viewer) {
|
66069
|
-
var onSelectedChanged = _this.props.onSelectedChanged;
|
66070
|
-
if (onSelectedChanged) {
|
66071
|
-
var segmentSelectionState = layer.layer.displayState.segmentSelectionState;
|
66072
|
-
if (segmentSelectionState) {
|
66073
|
-
var segment = segmentSelectionState.hasSelectedSegment ? segmentSelectionState.selectedSegment : null;
|
66074
|
-
onSelectedChanged(segment, layer);
|
66075
|
-
}
|
66076
|
-
}
|
66077
|
-
}
|
66078
|
-
});
|
66079
|
-
_defineProperty(_assertThisInitialized(_this), "visibleChanged", function(layer) {
|
66080
|
-
if (_this.viewer) {
|
66081
|
-
var onVisibleChanged = _this.props.onVisibleChanged;
|
66082
|
-
if (onVisibleChanged) {
|
66083
|
-
var visibleSegments = layer.layer.displayState.segmentationGroupState.value.visibleSegments;
|
66084
|
-
if (visibleSegments) {
|
66085
|
-
onVisibleChanged(visibleSegments, layer);
|
66086
|
-
}
|
66087
|
-
}
|
66088
|
-
}
|
66089
|
-
});
|
66090
|
-
_this.ngContainer = /* @__PURE__ */ _react["default"].createRef();
|
66091
|
-
_this.viewer = null;
|
66092
|
-
return _this;
|
66093
|
-
}
|
66094
|
-
_createClass(Neuroglancer3, [{
|
66095
|
-
key: "componentDidMount",
|
66096
|
-
value: function componentDidMount() {
|
66097
|
-
var _this2 = this;
|
66098
|
-
var _this$props2 = this.props, perspectiveZoom = _this$props2.perspectiveZoom, viewerState = _this$props2.viewerState, brainMapsClientId = _this$props2.brainMapsClientId, eventBindingsToUpdate = _this$props2.eventBindingsToUpdate, onViewerStateChanged = _this$props2.onViewerStateChanged, callbacks = _this$props2.callbacks, ngServer = _this$props2.ngServer, key = _this$props2.key, bundleRoot = _this$props2.bundleRoot;
|
66099
|
-
this.viewer = (0, _neuroglancer.setupDefaultViewer)({
|
66100
|
-
brainMapsClientId,
|
66101
|
-
target: this.ngContainer.current,
|
66102
|
-
bundleRoot: bundleRoot || "/"
|
66103
|
-
});
|
66104
|
-
this.setCallbacks(callbacks);
|
66105
|
-
if (eventBindingsToUpdate) {
|
66106
|
-
this.updateEventBindings(eventBindingsToUpdate);
|
66107
|
-
}
|
66108
|
-
this.viewer.expectingExternalUI = true;
|
66109
|
-
if (ngServer) {
|
66110
|
-
this.viewer.makeUrlFromState = function(state) {
|
66111
|
-
var newState = _objectSpread({}, state);
|
66112
|
-
if (state.layers) {
|
66113
|
-
newState.layers = state.layers.filter(function(layer) {
|
66114
|
-
if (layer.source) {
|
66115
|
-
var sourceUrl = layer.source.url || layer.source;
|
66116
|
-
if (typeof sourceUrl === "string") {
|
66117
|
-
return !sourceUrl.startsWith("clio://");
|
66118
|
-
}
|
66119
|
-
}
|
66120
|
-
return true;
|
66121
|
-
});
|
66122
|
-
}
|
66123
|
-
return "".concat(ngServer, "/#!").concat((0, _url_hash_binding.encodeFragment)(JSON.stringify(newState)));
|
66124
|
-
};
|
66125
|
-
}
|
66126
|
-
if (this.viewer.selectionDetailsState) {
|
66127
|
-
this.viewer.selectionDetailsState.changed.add(this.selectionDetailsStateChanged);
|
66128
|
-
}
|
66129
|
-
this.viewer.layerManager.layersChanged.add(this.layersChanged);
|
66130
|
-
if (viewerState) {
|
66131
|
-
var newViewerState = viewerState;
|
66132
|
-
if (newViewerState.projectionScale === null) {
|
66133
|
-
delete newViewerState.projectionScale;
|
66134
|
-
}
|
66135
|
-
if (newViewerState.crossSectionScale === null) {
|
66136
|
-
delete newViewerState.crossSectionScale;
|
66137
|
-
}
|
66138
|
-
if (newViewerState.projectionOrientation === null) {
|
66139
|
-
delete newViewerState.projectionOrientation;
|
66140
|
-
}
|
66141
|
-
if (newViewerState.crossSectionOrientation === null) {
|
66142
|
-
delete newViewerState.crossSectionOrientation;
|
66143
|
-
}
|
66144
|
-
this.viewer.state.restoreState(newViewerState);
|
66145
|
-
} else {
|
66146
|
-
this.viewer.state.restoreState({
|
66147
|
-
layers: {
|
66148
|
-
grayscale: {
|
66149
|
-
type: "image",
|
66150
|
-
source: "dvid://https://flyem.dvid.io/ab6e610d4fe140aba0e030645a1d7229/grayscalejpeg"
|
66151
|
-
},
|
66152
|
-
segmentation: {
|
66153
|
-
type: "segmentation",
|
66154
|
-
source: "dvid://https://flyem.dvid.io/d925633ed0974da78e2bb5cf38d01f4d/segmentation"
|
66155
|
-
}
|
66156
|
-
},
|
66157
|
-
perspectiveZoom,
|
66158
|
-
navigation: {
|
66159
|
-
zoomFactor: 8
|
66160
|
-
}
|
66161
|
-
});
|
66162
|
-
}
|
66163
|
-
this.viewer.state.changed.add(function() {
|
66164
|
-
if (onViewerStateChanged) {
|
66165
|
-
try {
|
66166
|
-
if (_this2.viewer.state.viewer.position) {
|
66167
|
-
onViewerStateChanged(_this2.viewer.state.toJSON());
|
66168
|
-
}
|
66169
|
-
} catch (error) {
|
66170
|
-
console.debug(error);
|
66171
|
-
}
|
66172
|
-
}
|
66173
|
-
});
|
66174
|
-
if (key) {
|
66175
|
-
viewersKeyed[key] = this.viewer;
|
66176
|
-
} else {
|
66177
|
-
viewerNoKey = this.viewer;
|
66178
|
-
}
|
66179
|
-
window.viewer = this.viewer;
|
66180
|
-
}
|
66181
|
-
}, {
|
66182
|
-
key: "componentDidUpdate",
|
66183
|
-
value: function componentDidUpdate() {
|
66184
|
-
var _this3 = this;
|
66185
|
-
var selectedSegments = {};
|
66186
|
-
var _iterator3 = _createForOfIteratorHelper(this.viewer.layerManager.managedLayers), _step3;
|
66187
|
-
try {
|
66188
|
-
for (_iterator3.s(); !(_step3 = _iterator3.n()).done; ) {
|
66189
|
-
var layer = _step3.value;
|
66190
|
-
if (layer.layer instanceof _segmentation_user_layer.SegmentationUserLayer) {
|
66191
|
-
var segmentSelectionState = layer.layer.displayState.segmentSelectionState;
|
66192
|
-
selectedSegments[layer.name] = segmentSelectionState.selectedSegment;
|
66193
|
-
}
|
66194
|
-
}
|
66195
|
-
} catch (err) {
|
66196
|
-
_iterator3.e(err);
|
66197
|
-
} finally {
|
66198
|
-
_iterator3.f();
|
66199
|
-
}
|
66200
|
-
var viewerState = this.props.viewerState;
|
66201
|
-
if (viewerState) {
|
66202
|
-
var newViewerState = _objectSpread({}, viewerState);
|
66203
|
-
var restoreStates = [function() {
|
66204
|
-
_this3.viewer.state.restoreState(newViewerState);
|
66205
|
-
}];
|
66206
|
-
if (viewerState.projectionScale === null) {
|
66207
|
-
delete newViewerState.projectionScale;
|
66208
|
-
restoreStates.push(function() {
|
66209
|
-
_this3.viewer.projectionScale.reset();
|
66210
|
-
});
|
66211
|
-
}
|
66212
|
-
if (viewerState.crossSectionScale === null) {
|
66213
|
-
delete newViewerState.crossSectionScale;
|
66214
|
-
}
|
66215
|
-
restoreStates.forEach(function(restore) {
|
66216
|
-
return restore();
|
66217
|
-
});
|
66218
|
-
}
|
66219
|
-
var _iterator4 = _createForOfIteratorHelper(this.viewer.layerManager.managedLayers), _step4;
|
66220
|
-
try {
|
66221
|
-
for (_iterator4.s(); !(_step4 = _iterator4.n()).done; ) {
|
66222
|
-
var _layer3 = _step4.value;
|
66223
|
-
if (_layer3.layer instanceof _segmentation_user_layer.SegmentationUserLayer) {
|
66224
|
-
var _segmentSelectionState = _layer3.layer.displayState.segmentSelectionState;
|
66225
|
-
_segmentSelectionState.set(selectedSegments[_layer3.name]);
|
66226
|
-
}
|
66227
|
-
}
|
66228
|
-
} catch (err) {
|
66229
|
-
_iterator4.e(err);
|
66230
|
-
} finally {
|
66231
|
-
_iterator4.f();
|
66232
|
-
}
|
66233
|
-
if ("position" in viewerState) {
|
66234
|
-
if (Array.isArray(viewerState.position)) {
|
66235
|
-
if (viewerState.position.length === 0) {
|
66236
|
-
this.viewer.position.reset();
|
66237
|
-
}
|
66238
|
-
}
|
66239
|
-
}
|
66240
|
-
}
|
66241
|
-
}, {
|
66242
|
-
key: "componentWillUnmount",
|
66243
|
-
value: function componentWillUnmount() {
|
66244
|
-
var key = this.props.key;
|
66245
|
-
if (key) {
|
66246
|
-
delete viewersKeyed[key];
|
66247
|
-
} else {
|
66248
|
-
viewerNoKey = void 0;
|
66249
|
-
}
|
66250
|
-
}
|
66251
|
-
/* setCallbacks allows us to set a callback on a neuroglancer event
|
66252
|
-
* each callback created should be in the format:
|
66253
|
-
* [
|
66254
|
-
* {
|
66255
|
-
* name: 'unique-name',
|
66256
|
-
* event: 'the neuroglancer event to target, eg: click0, keyt',
|
66257
|
-
* function: (slice) => { slice.whatever }
|
66258
|
-
* },
|
66259
|
-
* {...}
|
66260
|
-
* ]
|
66261
|
-
*
|
66262
|
-
*/
|
66263
|
-
}, {
|
66264
|
-
key: "setCallbacks",
|
66265
|
-
value: function setCallbacks(callbacks) {
|
66266
|
-
var _this4 = this;
|
66267
|
-
callbacks.forEach(function(callback) {
|
66268
|
-
_this4.viewer.bindCallback(callback.name, callback["function"]);
|
66269
|
-
_this4.viewer.inputEventBindings.sliceView.set(callback.event, callback.name);
|
66270
|
-
});
|
66271
|
-
}
|
66272
|
-
}, {
|
66273
|
-
key: "render",
|
66274
|
-
value: function render() {
|
66275
|
-
var perspectiveZoom = this.props.perspectiveZoom;
|
66276
|
-
return /* @__PURE__ */ _react["default"].createElement("div", {
|
66277
|
-
className: "neuroglancer-container",
|
66278
|
-
ref: this.ngContainer
|
66279
|
-
}, /* @__PURE__ */ _react["default"].createElement("p", null, "Neuroglancer here with zoom ", perspectiveZoom));
|
66280
|
-
}
|
66281
|
-
}]);
|
66282
|
-
return Neuroglancer3;
|
66283
|
-
}(_react["default"].Component);
|
66284
|
-
exports["default"] = Neuroglancer2;
|
66285
|
-
Neuroglancer2.propTypes = {
|
66286
|
-
perspectiveZoom: _propTypes["default"].number,
|
66287
|
-
viewerState: _propTypes["default"].object,
|
66288
|
-
brainMapsClientId: _propTypes["default"].string,
|
66289
|
-
key: _propTypes["default"].string,
|
66290
|
-
/**
|
66291
|
-
* An array of event bindings to change in Neuroglancer. The array format is as follows:
|
66292
|
-
* [[old-event1, new-event1], [old-event2], old-event3]
|
66293
|
-
* Here, `old-event1`'s will be unbound and its action will be re-bound to `new-event1`.
|
66294
|
-
* The bindings for `old-event2` and `old-event3` will be removed.
|
66295
|
-
* Neuroglancer has its own syntax for event descriptors, and here are some examples:
|
66296
|
-
* 'keya', 'shift+keyb' 'control+keyc', 'digit4', 'space', 'arrowleft', 'comma', 'period',
|
66297
|
-
* 'minus', 'equal', 'bracketleft'.
|
66298
|
-
*/
|
66299
|
-
eventBindingsToUpdate: _propTypes["default"].array,
|
66300
|
-
/**
|
66301
|
-
* A function of the form `(segment, layer) => {}`, called each time there is a change to
|
66302
|
-
* the segment the user has "selected" (i.e., hovered over) in Neuroglancer.
|
66303
|
-
* The `segment` argument will be a Neuroglancer `Uint64` with the ID of the now-selected
|
66304
|
-
* segment, or `null` if no segment is now selected.
|
66305
|
-
* The `layer` argument will be a Neuroglaner `ManagedUserLayer`, whose `layer` property
|
66306
|
-
* will be a Neuroglancer `SegmentationUserLayer`.
|
66307
|
-
*/
|
66308
|
-
onSelectedChanged: _propTypes["default"].func,
|
66309
|
-
/**
|
66310
|
-
* A function of the form `(segments, layer) => {}`, called each time there is a change to
|
66311
|
-
* the segments the user has designated as "visible" (i.e., double-clicked on) in Neuroglancer.
|
66312
|
-
* The `segments` argument will be a Neuroglancer `Uint64Set` whose elements are `Uint64`
|
66313
|
-
* instances for the IDs of the now-visible segments.
|
66314
|
-
* The `layer` argument will be a Neuroglaner `ManagedUserLayer`, whose `layer` property
|
66315
|
-
* will be a Neuroglancer `SegmentationUserLayer`.
|
66316
|
-
*/
|
66317
|
-
onVisibleChanged: _propTypes["default"].func,
|
66318
|
-
/**
|
66319
|
-
* A function of the form `() => {}` to respond to selection changes in the viewer.
|
66320
|
-
*/
|
66321
|
-
onSelectionDetailsStateChanged: _propTypes["default"].func,
|
66322
|
-
onViewerStateChanged: _propTypes["default"].func,
|
66323
|
-
callbacks: _propTypes["default"].arrayOf(_propTypes["default"].object),
|
66324
|
-
ngServer: _propTypes["default"].string
|
66325
|
-
};
|
66326
|
-
Neuroglancer2.defaultProps = {
|
66327
|
-
perspectiveZoom: 20,
|
66328
|
-
eventBindingsToUpdate: null,
|
66329
|
-
brainMapsClientId: "NOT_A_VALID_ID",
|
66330
|
-
viewerState: null,
|
66331
|
-
onSelectedChanged: null,
|
66332
|
-
onVisibleChanged: null,
|
66333
|
-
onSelectionDetailsStateChanged: null,
|
66334
|
-
onViewerStateChanged: null,
|
66335
|
-
key: null,
|
66336
|
-
callbacks: [],
|
66337
|
-
ngServer: "https://neuroglancer-demo.appspot.com/"
|
66338
|
-
};
|
66339
|
-
})(lib);
|
66340
|
-
return lib;
|
65757
|
+
};
|
65758
|
+
render() {
|
65759
|
+
const { perspectiveZoom } = this.props;
|
65760
|
+
return jsxRuntimeExports.jsx("div", { className: "neuroglancer-container", ref: this.ngContainer, children: jsxRuntimeExports.jsxs("p", { children: ["Neuroglancer here with zoom ", perspectiveZoom] }) });
|
65761
|
+
}
|
66341
65762
|
}
|
66342
|
-
var libExports = requireLib();
|
66343
|
-
const ReactNeuroglancer = /* @__PURE__ */ getDefaultExportFromCjs(libExports);
|
66344
|
-
const Component = typeof ReactNeuroglancer.default === "function" ? ReactNeuroglancer.default : ReactNeuroglancer;
|
66345
|
-
const ReactNeuroglancerWrapper = React__default.forwardRef((props, ref) => jsxRuntimeExports.jsx(Component, { ref, ...props }));
|
66346
65763
|
export {
|
66347
|
-
|
65764
|
+
addLayerSignalRemover,
|
65765
|
+
closeSelectionTab,
|
65766
|
+
configureAnnotationLayer,
|
65767
|
+
configureAnnotationLayerChanged,
|
65768
|
+
configureLayersChangedSignals,
|
65769
|
+
Neuroglancer as default,
|
65770
|
+
getAnnotationLayer,
|
65771
|
+
getAnnotationSelectionHost,
|
65772
|
+
getAnnotationSource,
|
65773
|
+
getLayerManager,
|
65774
|
+
getManagedLayer,
|
65775
|
+
getNeuroglancerColor,
|
65776
|
+
getNeuroglancerViewerState,
|
65777
|
+
getSelectedAnnotationId,
|
65778
|
+
parseUrlHash,
|
65779
|
+
unsubscribeLayersChangedSignals
|
66348
65780
|
};
|