@broberg/bodymap 0.10.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -0
- package/dist/three.cjs +8 -3
- package/dist/three.cjs.map +1 -1
- package/dist/three.d.cts +21 -1
- package/dist/three.d.ts +21 -1
- package/dist/three.js +7 -4
- package/dist/three.js.map +1 -1
- package/package.json +1 -1
package/dist/three.d.cts
CHANGED
|
@@ -260,6 +260,26 @@ declare function seamWeight(seamEnabled: boolean, blend: number): number;
|
|
|
260
260
|
* Returns true when it computed (the model had none, and would otherwise render
|
|
261
261
|
* flat), false when it left the authored normals alone.
|
|
262
262
|
*/
|
|
263
|
+
/**
|
|
264
|
+
* F052.32 — is this pointer-up a TAP, or the end of a drag?
|
|
265
|
+
*
|
|
266
|
+
* DISTANCE IS THE WHOLE TEST. A drag moves; a tap does not. There used to be a
|
|
267
|
+
* 450 ms ceiling beside it, and it did not help tell those apart — what it did
|
|
268
|
+
* was rule that a SLOW press is not a tap.
|
|
269
|
+
*
|
|
270
|
+
* A slow press is exactly what a CAREFUL tap is. Aiming at a small body part on
|
|
271
|
+
* a phone, at a mark you are trying to hit again, takes longer than a casual
|
|
272
|
+
* poke — so the ceiling discarded precisely the taps a user was trying hardest
|
|
273
|
+
* to make, on a health app whose users are in pain.
|
|
274
|
+
*
|
|
275
|
+
* And it discarded them in SILENCE: the guard returned from the whole handler,
|
|
276
|
+
* so there was no pick, no clear, no feedback and no repaint. The owner reported
|
|
277
|
+
* it twice, as "the remove button is gone" and as "the sound does not work". One
|
|
278
|
+
* swallowed tap, two sightings, each explained away separately.
|
|
279
|
+
*/
|
|
280
|
+
declare function isTap(dx: number, dy: number, maxDistance?: number): boolean;
|
|
281
|
+
/** Pixels of travel a tap may have. Beyond this it was a rotation. */
|
|
282
|
+
declare const TAP_MAX_DISTANCE = 6;
|
|
263
283
|
declare function ensureNormals(geo: {
|
|
264
284
|
getAttribute(name: string): unknown;
|
|
265
285
|
computeVertexNormals(): void;
|
|
@@ -353,4 +373,4 @@ interface BodyMap3DProps {
|
|
|
353
373
|
}
|
|
354
374
|
declare function BodyMap3D(props: BodyMap3DProps): react.JSX.Element;
|
|
355
375
|
|
|
356
|
-
export { BodyMap3D, type BodyMap3DHint, type BodyMap3DModels, type BodyMap3DProps, type BodyMap3DSex, type BodyMap3DUiLabels, ensureNormals, seamBlend, seamWeight, serializeReport };
|
|
376
|
+
export { BodyMap3D, type BodyMap3DHint, type BodyMap3DModels, type BodyMap3DProps, type BodyMap3DSex, type BodyMap3DUiLabels, TAP_MAX_DISTANCE, ensureNormals, isTap, seamBlend, seamWeight, serializeReport };
|
package/dist/three.d.ts
CHANGED
|
@@ -260,6 +260,26 @@ declare function seamWeight(seamEnabled: boolean, blend: number): number;
|
|
|
260
260
|
* Returns true when it computed (the model had none, and would otherwise render
|
|
261
261
|
* flat), false when it left the authored normals alone.
|
|
262
262
|
*/
|
|
263
|
+
/**
|
|
264
|
+
* F052.32 — is this pointer-up a TAP, or the end of a drag?
|
|
265
|
+
*
|
|
266
|
+
* DISTANCE IS THE WHOLE TEST. A drag moves; a tap does not. There used to be a
|
|
267
|
+
* 450 ms ceiling beside it, and it did not help tell those apart — what it did
|
|
268
|
+
* was rule that a SLOW press is not a tap.
|
|
269
|
+
*
|
|
270
|
+
* A slow press is exactly what a CAREFUL tap is. Aiming at a small body part on
|
|
271
|
+
* a phone, at a mark you are trying to hit again, takes longer than a casual
|
|
272
|
+
* poke — so the ceiling discarded precisely the taps a user was trying hardest
|
|
273
|
+
* to make, on a health app whose users are in pain.
|
|
274
|
+
*
|
|
275
|
+
* And it discarded them in SILENCE: the guard returned from the whole handler,
|
|
276
|
+
* so there was no pick, no clear, no feedback and no repaint. The owner reported
|
|
277
|
+
* it twice, as "the remove button is gone" and as "the sound does not work". One
|
|
278
|
+
* swallowed tap, two sightings, each explained away separately.
|
|
279
|
+
*/
|
|
280
|
+
declare function isTap(dx: number, dy: number, maxDistance?: number): boolean;
|
|
281
|
+
/** Pixels of travel a tap may have. Beyond this it was a rotation. */
|
|
282
|
+
declare const TAP_MAX_DISTANCE = 6;
|
|
263
283
|
declare function ensureNormals(geo: {
|
|
264
284
|
getAttribute(name: string): unknown;
|
|
265
285
|
computeVertexNormals(): void;
|
|
@@ -353,4 +373,4 @@ interface BodyMap3DProps {
|
|
|
353
373
|
}
|
|
354
374
|
declare function BodyMap3D(props: BodyMap3DProps): react.JSX.Element;
|
|
355
375
|
|
|
356
|
-
export { BodyMap3D, type BodyMap3DHint, type BodyMap3DModels, type BodyMap3DProps, type BodyMap3DSex, type BodyMap3DUiLabels, ensureNormals, seamBlend, seamWeight, serializeReport };
|
|
376
|
+
export { BodyMap3D, type BodyMap3DHint, type BodyMap3DModels, type BodyMap3DProps, type BodyMap3DSex, type BodyMap3DUiLabels, TAP_MAX_DISTANCE, ensureNormals, isTap, seamBlend, seamWeight, serializeReport };
|
package/dist/three.js
CHANGED
|
@@ -260,6 +260,10 @@ function seamBlend(nearestSq, secondSq) {
|
|
|
260
260
|
function seamWeight(seamEnabled, blend) {
|
|
261
261
|
return seamEnabled ? blend : 0;
|
|
262
262
|
}
|
|
263
|
+
function isTap(dx, dy, maxDistance = TAP_MAX_DISTANCE) {
|
|
264
|
+
return Math.hypot(dx, dy) <= maxDistance;
|
|
265
|
+
}
|
|
266
|
+
var TAP_MAX_DISTANCE = 6;
|
|
263
267
|
function ensureNormals(geo) {
|
|
264
268
|
if (geo.getAttribute("normal")) return false;
|
|
265
269
|
geo.computeVertexNormals();
|
|
@@ -573,12 +577,11 @@ function BodyMap3D(props) {
|
|
|
573
577
|
}
|
|
574
578
|
return best;
|
|
575
579
|
};
|
|
576
|
-
let downX = 0, downY = 0
|
|
580
|
+
let downX = 0, downY = 0;
|
|
577
581
|
const canvas = renderer.domElement;
|
|
578
582
|
const onDown = (e) => {
|
|
579
583
|
downX = e.clientX;
|
|
580
584
|
downY = e.clientY;
|
|
581
|
-
downT = Date.now();
|
|
582
585
|
};
|
|
583
586
|
const onMove = (e) => {
|
|
584
587
|
if ((e.buttons || 0) !== 0) return;
|
|
@@ -590,7 +593,7 @@ function BodyMap3D(props) {
|
|
|
590
593
|
renderFrame();
|
|
591
594
|
};
|
|
592
595
|
const onUp = (e) => {
|
|
593
|
-
if (
|
|
596
|
+
if (!isTap(e.clientX - downX, e.clientY - downY)) return;
|
|
594
597
|
const k = pick(e.clientX, e.clientY);
|
|
595
598
|
if (!k) return;
|
|
596
599
|
const outcome = pickRef.current(k);
|
|
@@ -830,6 +833,6 @@ function BodyMap3D(props) {
|
|
|
830
833
|
);
|
|
831
834
|
}
|
|
832
835
|
|
|
833
|
-
export { BodyMap3D, ensureNormals, seamBlend, seamWeight, serializeReport };
|
|
836
|
+
export { BodyMap3D, TAP_MAX_DISTANCE, ensureNormals, isTap, seamBlend, seamWeight, serializeReport };
|
|
834
837
|
//# sourceMappingURL=three.js.map
|
|
835
838
|
//# sourceMappingURL=three.js.map
|