Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion packages/lib/src/components/GSplat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,29 @@ componentDefinition.schema = {
validate: (val: unknown) => val instanceof Asset,
errorMsg: (val: unknown) => `Invalid value for prop "asset": "${JSON.stringify(val)}". Expected an Asset.`,
default: null
},
// `unified` is a special property that can not be modified while the component is enabled
unified: {
validate: (val: unknown) => typeof val === 'boolean',
errorMsg: (val: unknown) => `Invalid value for prop "unified": "${JSON.stringify(val)}". Expected a boolean.`,
default: false,
apply: (instance: GSplatComponent, props: Record<string, unknown>, key: string) => {
const value = props[key] as boolean;

if (instance.unified === value) {
return;
}

// If not enabled, just set directly
if (!instance.enabled) {
instance.unified = value;
return;
}

// Temporarily disable component, set value, re-enable
instance.enabled = false;
instance.unified = value;
instance.enabled = true;
}
}
}
}
Loading