|
@@ -81,12 +81,12 @@ export function UnitsVisual<G extends Geometry, P extends StructureParams & Geom
|
|
|
let geometry: G;
|
|
|
let locationIt: LocationIterator;
|
|
|
|
|
|
- function prepareUpdate(theme: Theme, props: Partial<PD.Values<P>> = {}, structureGroup: StructureGroup) {
|
|
|
+ function prepareUpdate(theme: Theme, props: PD.Values<P>, structureGroup: StructureGroup) {
|
|
|
if (!structureGroup && !currentStructureGroup) {
|
|
|
throw new Error('missing structureGroup');
|
|
|
}
|
|
|
|
|
|
- newProps = Object.assign({}, currentProps, props);
|
|
|
+ newProps = props;
|
|
|
newTheme = theme;
|
|
|
newStructureGroup = structureGroup;
|
|
|
|
|
@@ -130,7 +130,7 @@ export function UnitsVisual<G extends Geometry, P extends StructureParams & Geom
|
|
|
if (Unit.conformationId(newUnit) !== Unit.conformationId(currentUnit)) {
|
|
|
// console.log('new conformation');
|
|
|
updateState.updateTransform = true;
|
|
|
- if (!Unit.areAreConformationsEquivalent(newUnit, currentUnit)) {
|
|
|
+ if (!updateState.createGeometry && !Unit.areAreConformationsEquivalent(newUnit, currentUnit)) {
|
|
|
// console.log('new position');
|
|
|
updateState.createGeometry = true;
|
|
|
}
|
|
@@ -236,7 +236,7 @@ export function UnitsVisual<G extends Geometry, P extends StructureParams & Geom
|
|
|
return {
|
|
|
get groupCount() { return locationIt ? locationIt.count : 0; },
|
|
|
get renderObject () { return locationIt && locationIt.count ? renderObject : undefined; },
|
|
|
- createOrUpdate(ctx: VisualContext, theme: Theme, props: Partial<PD.Values<P>> = {}, structureGroup?: StructureGroup) {
|
|
|
+ createOrUpdate(ctx: VisualContext, theme: Theme, props: PD.Values<P>, structureGroup?: StructureGroup) {
|
|
|
prepareUpdate(theme, props, structureGroup || currentStructureGroup);
|
|
|
if (updateState.createGeometry) {
|
|
|
const newGeometry = _createGeometry(ctx, newStructureGroup.group.units[0], newStructureGroup.structure, newTheme, newProps, geometry);
|