Skip to content

Commit 7d03052

Browse files
committed
refactor: format + lint + cleanup
1 parent ab0a001 commit 7d03052

File tree

17 files changed

+101
-184
lines changed

17 files changed

+101
-184
lines changed

package.json

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,6 @@
528528
"neuroglancer/kvstore/zip:disabled": "./src/util/false.ts",
529529
"default": "./src/kvstore/zip/register_backend.ts"
530530
},
531-
"#kvstore/indexeddb/register": "./src/kvstore/indexeddb/register.ts",
532531
"#layer/annotation": {
533532
"neuroglancer/layer/annotation:enabled": "./src/layer/annotation/index.ts",
534533
"neuroglancer/layer:none_by_default": "./src/util/false.ts",
@@ -553,12 +552,6 @@
553552
"neuroglancer/layer/single_mesh:disabled": "./src/util/false.ts",
554553
"default": "./src/layer/single_mesh/index.ts"
555554
},
556-
"#layer/vox": {
557-
"neuroglancer/layer/vox:enabled": "./src/layer/vox/index.ts",
558-
"neuroglancer/layer:none_by_default": "./src/util/false.ts",
559-
"neuroglancer/layer/vox:disabled": "./src/util/false.ts",
560-
"default": "./src/layer/vox/index.ts"
561-
},
562555
"#main": {
563556
"neuroglancer/python": "./src/main_python.ts",
564557
"default": "./src/main.ts"

src/kvstore/opfs/backend.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @license
3-
* Copyright 2025
3+
* Copyright 2025 Google Inc.
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at

src/kvstore/opfs/common.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @license
3-
* Copyright 2025
3+
* Copyright 2025 Google Inc.
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at

src/kvstore/opfs/register_backend.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @license
3-
* Copyright 2025
3+
* Copyright 2025 Google Inc.
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at

src/kvstore/opfs/register_frontend.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @license
3-
* Copyright 2025
3+
* Copyright 2025 Google Inc.
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at

src/layer/enabled_frontend_modules.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,3 @@ import "#layer/annotation";
33
import "#layer/image";
44
import "#layer/segmentation";
55
import "#layer/single_mesh";
6-
import "#layer/vox";

src/layer/vox/controls.ts

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/**
2+
* @license
3+
* Copyright 2025 Google Inc.
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
import type { UserLayerConstructor } from "#src/layer/index.js";
218
import { LayerActionContext } from "#src/layer/index.js";
319
import type { UserLayerWithVoxelEditing } from "#src/layer/vox/index.js";
@@ -15,7 +31,10 @@ import { colorLayerControl } from "#src/widget/layer_control_color.js";
1531
import { enumLayerControl } from "#src/widget/layer_control_enum.js";
1632
import { rangeLayerControl } from "#src/widget/layer_control_range.js";
1733

18-
class BigIntAsTrackableRGB extends RefCounted implements WatchableValueInterface<vec3> {
34+
class BigIntAsTrackableRGB
35+
extends RefCounted
36+
implements WatchableValueInterface<vec3>
37+
{
1938
changed = new NullarySignal();
2039
private tempColor = vec3.create();
2140

@@ -88,7 +107,10 @@ export const VOXEL_LAYER_CONTROLS: LayerControlDefinition<UserLayerWithVoxelEdit
88107
{
89108
label: "Paint Color",
90109
toolJson: { type: "vox-paint-color" },
91-
...colorLayerControl((layer: UserLayerWithVoxelEditing) => new BigIntAsTrackableRGB(layer.paintValue)),
110+
...colorLayerControl(
111+
(layer: UserLayerWithVoxelEditing) =>
112+
new BigIntAsTrackableRGB(layer.paintValue),
113+
),
92114
},
93115
{
94116
label: "Paint Value",
@@ -120,7 +142,10 @@ export const VOXEL_LAYER_CONTROLS: LayerControlDefinition<UserLayerWithVoxelEdit
120142
...buttonLayerControl({
121143
text: "Random",
122144
onClick: (layer) =>
123-
layer.handleVoxAction("randomize-paint-value", new LayerActionContext()),
145+
layer.handleVoxAction(
146+
"randomize-paint-value",
147+
new LayerActionContext(),
148+
),
124149
}),
125150
},
126151
];

src/layer/vox/index.ts

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
import type {
1818
LayerActionContext,
1919
MouseSelectionState,
20-
UserLayer,
2120
} from "#src/layer/index.js";
21+
import { UserLayer } from "#src/layer/index.js";
2222
import type { LoadedDataSubsource } from "#src/layer/layer_data_source.js";
2323
import { VoxToolTab } from "#src/layer/vox/tabs/tools.js";
2424
import type {
@@ -48,14 +48,10 @@ import {
4848
} from "#src/util/json.js";
4949
import { TrackableEnum } from "#src/util/trackable_enum.js";
5050
import { VoxelPreviewMultiscaleSource } from "#src/voxel_annotation/PreviewMultiscaleChunkSource.js";
51-
import type { VoxelEditControllerHost } from "#src/voxel_annotation/edit_controller.js";
51+
import type { VoxelEditControllerHost } from "#src/voxel_annotation/base.js";
52+
import { BrushShape } from "#src/voxel_annotation/base.js";
5253
import { VoxelEditController } from "#src/voxel_annotation/edit_controller.js";
5354

54-
export enum BrushShape {
55-
DISK = 0,
56-
SPHERE = 1,
57-
}
58-
5955
const BRUSH_SIZE_JSON_KEY = "brushSize";
6056
const ERASE_MODE_JSON_KEY = "eraseMode";
6157
const BRUSH_SHAPE_JSON_KEY = "brushShape";
@@ -154,10 +150,16 @@ export class VoxelEditingContext
154150

155151
for (let chunkDim = 0; chunkDim < 3; ++chunkDim) {
156152
let sum = 0;
157-
for (let globalDim = 0; globalDim < Math.min(globalRank, 3); ++globalDim) {
153+
for (
154+
let globalDim = 0;
155+
globalDim < Math.min(globalRank, 3);
156+
++globalDim
157+
) {
158158
const layerDim = globalToRenderLayerDimensions[globalDim];
159159
if (layerDim !== -1) {
160-
sum += layerToChunkTransform[chunkDim + layerDim * (layerRank + 1)] * globalNormal[globalDim];
160+
sum +=
161+
layerToChunkTransform[chunkDim + layerDim * (layerRank + 1)] *
162+
globalNormal[globalDim];
161163
}
162164
}
163165
voxelNormal[chunkDim] = sum;
@@ -243,11 +245,23 @@ export function UserLayerWithVoxelEditingMixin<
243245

244246
restoreState(specification: any) {
245247
super.restoreState(specification);
246-
verifyOptionalObjectProperty(specification, BRUSH_SIZE_JSON_KEY, v => this.voxBrushRadius.restoreState(v));
247-
verifyOptionalObjectProperty(specification, ERASE_MODE_JSON_KEY, v => this.voxEraseMode.restoreState(v));
248-
verifyOptionalObjectProperty(specification, BRUSH_SHAPE_JSON_KEY, v => this.voxBrushShape.restoreState(v));
249-
verifyOptionalObjectProperty(specification, FLOOD_FILL_MAX_VOXELS_JSON_KEY, v => this.voxFloodMaxVoxels.restoreState(v));
250-
verifyOptionalObjectProperty(specification, PAINT_VALUE_JSON_KEY, v => this.paintValue.restoreState(v));
248+
verifyOptionalObjectProperty(specification, BRUSH_SIZE_JSON_KEY, (v) =>
249+
this.voxBrushRadius.restoreState(v),
250+
);
251+
verifyOptionalObjectProperty(specification, ERASE_MODE_JSON_KEY, (v) =>
252+
this.voxEraseMode.restoreState(v),
253+
);
254+
verifyOptionalObjectProperty(specification, BRUSH_SHAPE_JSON_KEY, (v) =>
255+
this.voxBrushShape.restoreState(v),
256+
);
257+
verifyOptionalObjectProperty(
258+
specification,
259+
FLOOD_FILL_MAX_VOXELS_JSON_KEY,
260+
(v) => this.voxFloodMaxVoxels.restoreState(v),
261+
);
262+
verifyOptionalObjectProperty(specification, PAINT_VALUE_JSON_KEY, (v) =>
263+
this.paintValue.restoreState(v),
264+
);
251265
}
252266

253267
getVoxelPaintValue(erase: boolean): bigint {
@@ -258,7 +272,6 @@ export function UserLayerWithVoxelEditingMixin<
258272
this.paintValue.value = value;
259273
}
260274

261-
262275
abstract _createVoxelRenderLayer(
263276
source: MultiscaleVolumeChunkSource,
264277
transform: WatchableValueInterface<RenderLayerTransformOrError>,

src/layer/vox/style.css

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,29 +14,17 @@
1414
* limitations under the License.
1515
*/
1616

17-
:root {
18-
/* best-effort variables if app doesn't define them */
19-
--ng-bg: rgba(20, 22, 27, 0.9);
20-
--ng-card: rgba(255, 255, 255, 0.04);
21-
--ng-border: rgba(255, 255, 255, 0.15);
22-
--ng-text: rgba(230, 230, 235, 0.95);
23-
--ng-muted: rgba(230, 230, 235, 0.65);
24-
--ng-accent: #3a6df0;
25-
}
26-
2717
.neuroglancer-vox-row label {
2818
flex: 0 0 140px;
2919
min-width: 0;
3020
font-weight: 500;
31-
color: var(--ng-muted);
3221
}
3322

3423
.neuroglancer-vox-status {
3524
display: block;
3625
flex: 1 1 100%;
3726
min-width: 100%;
3827
padding-top: 4px;
39-
color: var(--ng-muted);
4028
}
4129

4230
.neuroglancer-vox-settings-tab button:hover,

src/sliceview/frontend.ts

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -438,14 +438,6 @@ export class SliceView extends Base {
438438
lastSeenGeneration: curUpdateGeneration,
439439
displayDimensionRenderInfo,
440440
};
441-
if ((renderLayer as any).constructor?.type === "vox") {
442-
console.log(
443-
"[SliceView.updateVisibleLayersNow] new vox layerInfo created, allSources orientations=",
444-
layerInfo.allSources.length,
445-
"first orientation scales=",
446-
layerInfo.allSources[0]?.length ?? 0,
447-
);
448-
}
449441
disposers.push(renderLayer.messages.addChild(layerInfo.messages));
450442
visibleLayers.set(renderLayer.addRef(), layerInfo);
451443
this.bindVisibleRenderLayer(renderLayer, disposers);
@@ -463,14 +455,6 @@ export class SliceView extends Base {
463455
renderLayer,
464456
layerInfo.messages,
465457
);
466-
if ((renderLayer as any).constructor?.type === "vox") {
467-
console.log(
468-
"[SliceView.updateVisibleLayersNow] vox layer transform changed, new allSources orientations=",
469-
layerInfo.allSources.length,
470-
"first orientation scales=",
471-
layerInfo.allSources[0]?.length ?? 0,
472-
);
473-
}
474458
disposeTransformedSources(renderLayer, allSources);
475459
layerInfo.visibleSources.length = 0;
476460
layerInfo.displayDimensionRenderInfo = displayDimensionRenderInfo;
@@ -730,14 +714,7 @@ export interface SliceViewChunkSource {
730714

731715
/*
732716
export class SliceViewChunk extends Chunk {
733-
chunkGridPosition: vec3;
734-
declare source: SliceViewChunkSource;
735-
736-
constructor(source: SliceViewChunkSource, x: any) {
737-
super(source);
738-
this.chunkGridPosition = x.chunkGridPosition;
739-
this.state = ChunkState.SYSTEM_MEMORY;
740-
}
717+
// MOVED to chunk_base.ts to avoid import loop
741718
}
742719
*/
743720

0 commit comments

Comments
 (0)