Skip to content

Commit

Permalink
feat: kebab accessors for gui lib testing (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
brianzinn authored Sep 4, 2020
1 parent 9826b67 commit 744e38e
Show file tree
Hide file tree
Showing 4 changed files with 301 additions and 6 deletions.
11 changes: 9 additions & 2 deletions src/UpdateInstance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,15 @@ export const applyUpdateToInstance = (hostInstance: any, update: PropertyUpdate,
case PropChangeType.FresnelParameters:
case PropChangeType.LambdaExpression:
case PropChangeType.Texture:
// console.log(` > ${type}: updating ${update.type} on ${update.propertyName} to ${update.value}`)
target[update.propertyName] = update.value;
// console.log(` > ${type}: updating ${update.changeType} on ${update.propertyName} to ${update.value}`)
if (update.propertyName.indexOf('.') !== -1) {
const dotProps: string[] = update.propertyName.split('.')
const lastProp = dotProps.pop()!;
const newTarget = dotProps.reduce((target, prop) => target[prop], target);
newTarget[lastProp] = update.value;
} else {
target[update.propertyName] = update.value;
}
break;
case PropChangeType.Vector3:
if (target[update.propertyName]) {
Expand Down
Loading

0 comments on commit 744e38e

Please sign in to comment.