Skip to content
Snippets Groups Projects
Commit d436d3d5 authored by Alexander Rose's avatar Alexander Rose
Browse files

take objectId into account for hoverSelection, clear hoverSelection

parent 65be7bcd
No related branches found
No related tags found
No related merge requests found
......@@ -14,7 +14,7 @@ import { Unit, Element, Queries } from 'mol-model/structure';
import { UnitsRepresentation, DefaultStructureProps } from './index';
import { Task } from 'mol-task'
import { MeshBuilder } from '../../shape/mesh-builder';
import { createTransforms, createColors, createFlags } from './utils';
import { createTransforms, createColors, createFlags, createEmptyFlags } from './utils';
import VertexMap from '../../shape/vertex-map';
import { icosahedronVertexCount } from '../../primitive/icosahedron';
import { deepEqual, defaults } from 'mol-util';
......@@ -165,7 +165,11 @@ export default function Spacefill(): UnitsRepresentation<SpacefillProps> {
if (newProps.hoverSelection !== currentProps.hoverSelection) {
await ctx.update('Computing spacefill flags');
if (newProps.hoverSelection.objectId === spheres.id) {
createFlags(currentGroup, newProps.hoverSelection.instanceId, newProps.hoverSelection.elementId, spheres.values)
} else {
createEmptyFlags(spheres.values)
}
}
ValueCell.updateIfChanged(spheres.values.uAlpha, newProps.alpha)
......
......@@ -82,9 +82,15 @@ export function createFlags(group: Unit.SymmetryGroup, instanceId: number, eleme
}
const emptyFlagTexture = { array: new Uint8Array(1), width: 1, height: 1 }
export function createEmptyFlags() {
export function createEmptyFlags(flagData?: FlagData) {
if (flagData) {
ValueCell.update(flagData.tFlag, emptyFlagTexture)
ValueCell.update(flagData.uFlagTexSize, Vec2.create(1, 1))
return flagData
} else {
return {
tFlag: ValueCell.create(emptyFlagTexture),
uFlagTexSize: ValueCell.create(Vec2.create(1, 1)),
}
}
}
\ No newline at end of file
......@@ -83,12 +83,12 @@ namespace Viewer {
const info = repr.getLabel(p)
if (info) {
label = info.label
}
// TODO do better, take objectId fully into account
repr.update({ hoverSelection: p }).run().then(() => {
scene.update()
requestDraw()
})
}
})
identified.next(`Object: ${p.objectId}, Instance: ${p.instanceId}, Element: ${p.elementId}, Label: ${label}`)
})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment