Refactor PropertiesOperations duplicate
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
0e7e8a47ce
commit
8759c77042
1 changed files with 11 additions and 18 deletions
|
@ -97,33 +97,26 @@ export function OnPropertiesSubmit(
|
|||
|
||||
// Assign container properties
|
||||
for (const property in container.properties) {
|
||||
const input = (event.target as HTMLFormElement).querySelector(`#${property}`);
|
||||
if (input instanceof HTMLInputElement) {
|
||||
(container.properties as any)[property] = input.value;
|
||||
const input: HTMLInputElement | null = (event.target as HTMLFormElement).querySelector(`#${property}`);
|
||||
|
||||
if (INPUT_TYPES[property] === 'number') {
|
||||
(container.properties as any)[property] = Number(input.value);
|
||||
if (input === null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
(container.properties as any)[property] = input.value;
|
||||
if (INPUT_TYPES[property] === 'number') {
|
||||
(container.properties as any)[property] = Number(input.value);
|
||||
}
|
||||
}
|
||||
|
||||
// Assign cssproperties
|
||||
for (const styleProperty in container.properties.style) {
|
||||
const input = (event.target as HTMLFormElement).querySelector(`#${styleProperty}`);
|
||||
if (input instanceof HTMLInputElement) {
|
||||
(container.properties.style as any)[styleProperty] = input.value;
|
||||
|
||||
if (INPUT_TYPES[styleProperty] === 'number') {
|
||||
(container.properties.style as any)[styleProperty] = Number(input.value);
|
||||
const input: HTMLInputElement | null = (event.target as HTMLFormElement).querySelector(`#${styleProperty}`);
|
||||
if (input === null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
(container.properties.style as any)[styleProperty] = input.value;
|
||||
}
|
||||
}
|
||||
|
||||
if (container.properties.isRigidBody) {
|
||||
RecalculatePhysics(container);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue