👇 Adds touch for drag controls

This commit is contained in:
Rune Harlyk
2024-02-03 20:09:11 +01:00
parent 6e7b5faa0a
commit 37bad623e7
+8 -12
View File
@@ -272,18 +272,14 @@ export default class SceneBuilder {
this.setJointValue(joint.name, angle); this.setJointValue(joint.name, angle);
updateAngle(joint.name, angle) updateAngle(joint.name, angle)
}; };
dragControls.onDragStart = () => { dragControls.onDragStart = () => this.controls.enabled = false;
this.controls.enabled = false; dragControls.onDragEnd = () => this.controls.enabled = true;
}; dragControls.onHover = (joint:URDFMimicJoint) => this.highlightLinkGeometry(joint, false, highlightMaterial);
dragControls.onDragEnd = () => { dragControls.onUnhover = (joint:URDFMimicJoint) => this.highlightLinkGeometry(joint, true, highlightMaterial);
this.controls.enabled = true;
}; this.renderer.domElement.addEventListener('touchstart', (data) => dragControls._mouseDown(data.touches[0]));
dragControls.onHover = (joint:URDFMimicJoint) => { this.renderer.domElement.addEventListener('touchmove', (data) => dragControls._mouseMove(data.touches[0]))
this.highlightLinkGeometry(joint, false, highlightMaterial); this.renderer.domElement.addEventListener('touchup', (data) => dragControls._mouseUp(data.touches[0]));
}
dragControls.onUnhover = (joint:URDFMimicJoint) => {
this.highlightLinkGeometry(joint, true, highlightMaterial);
}
return this return this
} }