@signosoft/signpad-js 0.4.7 → 0.4.8
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/dist/index.d.ts +98 -1
- package/dist/signosoft-signpad.js +1280 -1206
- package/dist/signosoft-signpad.umd.cjs +30 -33
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -331,6 +331,103 @@ export declare interface ILanguageOptions {
|
|
|
331
331
|
translations?: ITranslationSet | Record<string, ITranslationSet>;
|
|
332
332
|
}
|
|
333
333
|
|
|
334
|
+
/**
|
|
335
|
+
* `IosTouchManager` handles touch interactions on iOS devices and converts them
|
|
336
|
+
* into standardized `IPenData`. Uses the Touch Events API and reads `Touch.force`
|
|
337
|
+
* for real pressure data on devices that support 3D Touch / Haptic Touch.
|
|
338
|
+
* Falls back to 0.5 pressure on hardware without force sensing.
|
|
339
|
+
*/
|
|
340
|
+
declare class IosTouchManager {
|
|
341
|
+
/** @private */
|
|
342
|
+
private canvas;
|
|
343
|
+
/** @private */
|
|
344
|
+
private onPenData;
|
|
345
|
+
/** @private */
|
|
346
|
+
private isDrawing;
|
|
347
|
+
/** @private */
|
|
348
|
+
private sequenceCounter;
|
|
349
|
+
/** @private */
|
|
350
|
+
private sessionStartTime;
|
|
351
|
+
/** @private Debug counter for listener registrations */
|
|
352
|
+
private debugListenerRegistrationCount;
|
|
353
|
+
/** @private */
|
|
354
|
+
private listenersAttached;
|
|
355
|
+
private boundHandleTouchStart;
|
|
356
|
+
private boundHandleTouchMove;
|
|
357
|
+
private boundHandleTouchEnd;
|
|
358
|
+
private boundHandleTouchCancel;
|
|
359
|
+
/**
|
|
360
|
+
* Creates an instance of IosTouchManager.
|
|
361
|
+
* @param canvas - The HTMLCanvasElement to attach touch listeners to.
|
|
362
|
+
* @param onPenDataCallback - The callback function that receives generated IPenData.
|
|
363
|
+
*/
|
|
364
|
+
constructor(canvas: HTMLCanvasElement, onPenDataCallback: IPenDataCallback);
|
|
365
|
+
/**
|
|
366
|
+
* Returns whether the user is currently in the middle of a drawing stroke.
|
|
367
|
+
*/
|
|
368
|
+
get isCurrentlyDrawing(): boolean;
|
|
369
|
+
/**
|
|
370
|
+
* Attaches touch event listeners to the canvas to enable signature capture.
|
|
371
|
+
*/
|
|
372
|
+
addListeners(): void;
|
|
373
|
+
/**
|
|
374
|
+
* Removes touch event listeners from the canvas and stops active drawing.
|
|
375
|
+
*/
|
|
376
|
+
removeListeners(): void;
|
|
377
|
+
/**
|
|
378
|
+
* Returns true if touch listeners are currently attached.
|
|
379
|
+
*/
|
|
380
|
+
areListenersAttached(): boolean;
|
|
381
|
+
/**
|
|
382
|
+
* Resets the internal session state, including sequence counters and start time.
|
|
383
|
+
*/
|
|
384
|
+
resetSession(): void;
|
|
385
|
+
/**
|
|
386
|
+
* Handles the 'touchstart' event: starts a stroke and initializes the session time.
|
|
387
|
+
* @private
|
|
388
|
+
*/
|
|
389
|
+
private handleTouchStart;
|
|
390
|
+
/**
|
|
391
|
+
* Handles the 'touchmove' event: continues the stroke.
|
|
392
|
+
* @private
|
|
393
|
+
*/
|
|
394
|
+
private handleTouchMove;
|
|
395
|
+
/**
|
|
396
|
+
* Handles the 'touchend' event: ends the stroke.
|
|
397
|
+
* @private
|
|
398
|
+
*/
|
|
399
|
+
private handleTouchEnd;
|
|
400
|
+
/**
|
|
401
|
+
* Handles the 'touchcancel' event: terminates a stroke interrupted by the OS.
|
|
402
|
+
* @private
|
|
403
|
+
*/
|
|
404
|
+
private handleTouchCancel;
|
|
405
|
+
/**
|
|
406
|
+
* Core logic to transform a Touch into IPenData.
|
|
407
|
+
* @param touch - The raw browser Touch object.
|
|
408
|
+
* @param inContact - Whether the finger is actively drawing on the surface.
|
|
409
|
+
* @private
|
|
410
|
+
*/
|
|
411
|
+
private processTouchEvent;
|
|
412
|
+
/**
|
|
413
|
+
* Returns the pressure value from a Touch event.
|
|
414
|
+
* Reads Touch.force (0–1) on devices with 3D Touch / Haptic Touch.
|
|
415
|
+
* Falls back to 0.5 when force is unavailable or zero (non-force hardware).
|
|
416
|
+
* @private
|
|
417
|
+
*/
|
|
418
|
+
private getPressure;
|
|
419
|
+
/**
|
|
420
|
+
* Converts absolute touch coordinates into a normalized 0-1 range relative to canvas size.
|
|
421
|
+
* @private
|
|
422
|
+
*/
|
|
423
|
+
private getNormalizedCoordinates;
|
|
424
|
+
/**
|
|
425
|
+
* Calculates the seconds elapsed since the start of the signature session.
|
|
426
|
+
* @private
|
|
427
|
+
*/
|
|
428
|
+
private timestampToSeconds;
|
|
429
|
+
}
|
|
430
|
+
|
|
334
431
|
declare interface IPenData_2 {
|
|
335
432
|
relativeX: number;
|
|
336
433
|
relativeY: number;
|
|
@@ -614,7 +711,7 @@ export declare class SignosoftSignpad extends LitElement {
|
|
|
614
711
|
setHasStartedDrawing(value: boolean): void;
|
|
615
712
|
setDeviceStatusText(value: string): void;
|
|
616
713
|
canvasManager: CanvasManager | null;
|
|
617
|
-
pointerManager: PointerManager | null;
|
|
714
|
+
pointerManager: PointerManager | IosTouchManager | null;
|
|
618
715
|
connectionManager: ConnectionManager;
|
|
619
716
|
stateManager: StateManager;
|
|
620
717
|
buttonManager: ButtonManager;
|