🧹 Clean up components
This commit is contained in:
+14
-19
@@ -43,11 +43,6 @@ interface light {
|
|||||||
intensity?: number;
|
intensity?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface gridOptions {
|
|
||||||
divisions?: number;
|
|
||||||
size?: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface arrowOptions {
|
interface arrowOptions {
|
||||||
origin: position;
|
origin: position;
|
||||||
direction: position;
|
direction: position;
|
||||||
@@ -57,8 +52,6 @@ interface arrowOptions {
|
|||||||
|
|
||||||
type directionalLight = position & light;
|
type directionalLight = position & light;
|
||||||
|
|
||||||
type gridHelperOptions = gridOptions & position;
|
|
||||||
|
|
||||||
export default class SceneBuilder {
|
export default class SceneBuilder {
|
||||||
public scene: Scene;
|
public scene: Scene;
|
||||||
public camera!: PerspectiveCamera;
|
public camera!: PerspectiveCamera;
|
||||||
@@ -355,14 +348,20 @@ export default class SceneBuilder {
|
|||||||
dragControls.onUnhover = (joint: URDFMimicJoint) =>
|
dragControls.onUnhover = (joint: URDFMimicJoint) =>
|
||||||
this.highlightLinkGeometry(joint, true, highlightMaterial);
|
this.highlightLinkGeometry(joint, true, highlightMaterial);
|
||||||
|
|
||||||
this.renderer.domElement.addEventListener('touchstart', (data) =>
|
this.renderer.domElement.addEventListener(
|
||||||
dragControls._mouseDown(data.touches[0])
|
'touchstart',
|
||||||
|
(data) => dragControls._mouseDown(data.touches[0]),
|
||||||
|
{ passive: true }
|
||||||
);
|
);
|
||||||
this.renderer.domElement.addEventListener('touchmove', (data) =>
|
this.renderer.domElement.addEventListener(
|
||||||
dragControls._mouseMove(data.touches[0])
|
'touchmove',
|
||||||
|
(data) => dragControls._mouseMove(data.touches[0]),
|
||||||
|
{ passive: true }
|
||||||
);
|
);
|
||||||
this.renderer.domElement.addEventListener('touchend', (data) =>
|
this.renderer.domElement.addEventListener(
|
||||||
dragControls._mouseUp(data.touches[0])
|
'touchend',
|
||||||
|
(data) => dragControls._mouseUp(data.touches[0]),
|
||||||
|
{ passive: true }
|
||||||
);
|
);
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
@@ -373,12 +372,8 @@ export default class SceneBuilder {
|
|||||||
|
|
||||||
private handleRobotShadow = () => {
|
private handleRobotShadow = () => {
|
||||||
if (this.isLoaded) return;
|
if (this.isLoaded) return;
|
||||||
const intervalId = setInterval(() => {
|
const intervalId = setInterval(() => this.model?.traverse((c) => (c.castShadow = true)), 10);
|
||||||
this.model?.traverse((c) => (c.castShadow = true));
|
setTimeout(() => clearInterval(intervalId), 1000);
|
||||||
}, 10);
|
|
||||||
setTimeout(() => {
|
|
||||||
clearInterval(intervalId);
|
|
||||||
}, 1000);
|
|
||||||
this.isLoaded = true;
|
this.isLoaded = true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -109,11 +109,11 @@
|
|||||||
<div class="flex justify-center w-full"></div>
|
<div class="flex justify-center w-full"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="absolute bottom-0 z-10 flex items-end">
|
<div class="absolute bottom-0 z-10 flex items-end">
|
||||||
<div class="flex items-center flex-col bg-base-300 bg-opacity-50 p-4 pb-2 gap-2 rounded-tr-xl">
|
<div class="flex items-center flex-col bg-base-300 bg-opacity-50 p-3 pb-2 gap-2 rounded-tr-xl">
|
||||||
<VerticalSlider min={0} max={100} on:input={(e) => handleRange(e, 'height')} />
|
<VerticalSlider min={0} max={100} on:input={(e) => handleRange(e, 'height')} />
|
||||||
<label for="height">Ht</label>
|
<label for="height">Ht</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-end gap-4 bg-base-300 bg-opacity-50 h-min rounded-tr-xl p-2">
|
<div class="flex items-end gap-4 bg-base-300 bg-opacity-50 h-min rounded-tr-xl pl-0 p-3">
|
||||||
<div class="join">
|
<div class="join">
|
||||||
{#each modes as modeValue}
|
{#each modes as modeValue}
|
||||||
<button
|
<button
|
||||||
@@ -126,8 +126,8 @@
|
|||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{#if $mode === ModesEnum.Walk || $mode === ModesEnum.Crawl}
|
||||||
<div class="flex gap-4">
|
<div class="flex gap-4">
|
||||||
{#if $mode === ModesEnum.Walk || $mode === ModesEnum.Crawl}
|
|
||||||
<div>
|
<div>
|
||||||
<label for="s1">S1</label>
|
<label for="s1">S1</label>
|
||||||
<input
|
<input
|
||||||
@@ -143,8 +143,8 @@
|
|||||||
<label for="speed">Speed</label>
|
<label for="speed">Speed</label>
|
||||||
<input type="range" name="speed" min="0" max="100" on:input={(e) => handleRange(e, 'speed')} class="range range-sm range-primary" />
|
<input type="range" name="speed" min="0" max="100" on:input={(e) => handleRange(e, 'speed')} class="range range-sm range-primary" />
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
|
||||||
</div>
|
</div>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user