Browse Source

Volume slice granuality

dsehnal 2 years ago
parent
commit
793696d4c0

+ 1 - 1
src/mol-model/volume/volume.ts

@@ -220,7 +220,7 @@ export namespace Volume {
         }
     }
 
-    export type PickingGranularity = 'volume' | 'surface' | 'voxel';
+    export type PickingGranularity = 'volume' | 'object' | 'voxel';
     export const PickingGranularity = {
         set(volume: Volume, granularity: PickingGranularity) {
             volume._propertyData['__picking_granularity__'] = granularity;

+ 3 - 3
src/mol-repr/volume/isosurface.ts

@@ -68,10 +68,10 @@ function getIsosurfaceLoci(pickingId: PickingId, volume: Volume, props: VolumeIs
     const { objectId, groupId } = pickingId;
 
     if (id === objectId) {
-        const granuality = Volume.PickingGranularity.get(volume);
-        if (granuality === 'volume') {
+        const granularity = Volume.PickingGranularity.get(volume);
+        if (granularity === 'volume') {
             return Volume.Loci(volume);
-        } else if (granuality === 'surface') {
+        } else if (granularity === 'object') {
             return Volume.Isosurface.Loci(volume, props.isoValue);
         } else {
             return Volume.Cell.Loci(volume, Interval.ofSingleton(groupId as Volume.CellIndex));

+ 6 - 1
src/mol-repr/volume/slice.ts

@@ -150,7 +150,12 @@ function getLoci(volume: Volume, props: PD.Values<SliceParams>) {
 function getSliceLoci(pickingId: PickingId, volume: Volume, props: PD.Values<SliceParams>, id: number) {
     const { objectId, groupId } = pickingId;
     if (id === objectId) {
-        return Volume.Cell.Loci(volume, Interval.ofSingleton(groupId as Volume.CellIndex));
+        const granularity = Volume.PickingGranularity.get(volume);
+        if (granularity === 'volume') {
+            return Volume.Loci(volume);
+        } else {
+            return Volume.Cell.Loci(volume, Interval.ofSingleton(groupId as Volume.CellIndex));
+        }
     }
     return EmptyLoci;
 }