mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-07-29 14:56:18 +02:00
Ignore spurious finger tip position values
This commit is contained in:
parent
784009a9fa
commit
777a0b51c1
1 changed files with 10 additions and 2 deletions
|
@ -70,7 +70,9 @@
|
||||||
|
|
||||||
function drawLine(position, width) {
|
function drawLine(position, width) {
|
||||||
// Add a stroke to the polyline if stroke is a sufficient length.
|
// Add a stroke to the polyline if stroke is a sufficient length.
|
||||||
var localPosition;
|
var localPosition,
|
||||||
|
distanceToPrevious,
|
||||||
|
MAX_DISTANCE_TO_PREVIOUS = 1.0;
|
||||||
|
|
||||||
if (!isDrawingLine) {
|
if (!isDrawingLine) {
|
||||||
print("ERROR: drawLine() called when not drawing line");
|
print("ERROR: drawLine() called when not drawing line");
|
||||||
|
@ -78,8 +80,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
localPosition = Vec3.subtract(position, basePosition);
|
localPosition = Vec3.subtract(position, basePosition);
|
||||||
|
distanceToPrevious = Vec3.distance(localPosition, strokePoints[strokePoints.length - 1]);
|
||||||
|
|
||||||
if (Vec3.distance(localPosition, strokePoints[strokePoints.length - 1]) >= MIN_STROKE_LENGTH
|
if (distanceToPrevious > MAX_DISTANCE_TO_PREVIOUS) {
|
||||||
|
// Ignore occasional spurious finger tip positions.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (distanceToPrevious >= MIN_STROKE_LENGTH
|
||||||
&& strokePoints.length < MAX_POINTS_PER_LINE) {
|
&& strokePoints.length < MAX_POINTS_PER_LINE) {
|
||||||
strokePoints.push(localPosition);
|
strokePoints.push(localPosition);
|
||||||
strokeNormals.push(strokeNormal());
|
strokeNormals.push(strokeNormal());
|
||||||
|
|
Loading…
Reference in a new issue