improve trace/line selection precision on zoom

This commit is contained in:
Stewart Allen 2022-12-28 11:00:20 -05:00
commit 6b85e44b67
2 changed files with 9 additions and 4 deletions

View file

@ -1368,6 +1368,11 @@ gapp.register("moto.space", [], (root, exports) => {
updateLastAction();
updateFocus();
}, (val) => {
if (camera && viewControl) {
// increase intersect line precision on zoom
const dist = camera.position.distanceTo(viewControl.target);
raycaster.params.Line.threshold = Math.min(1, dist / 100);
}
updateLastAction();
if (slider) slider(val);
});