@daugasauron/dolly-host-touch 0.1.5 → 0.1.6

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.
Files changed (3) hide show
  1. package/abi.mjs +1 -1
  2. package/package.json +2 -2
  3. package/touch.mjs +3 -4
package/abi.mjs CHANGED
@@ -23,4 +23,4 @@ export const DOLLY_TOUCH_RELEASE = 94;
23
23
  export const DOLLY_TOUCH_BUTTONS = 95;
24
24
  export const DOLLY_TOUCH_READ_RECORDS = 64;
25
25
  export const DOLLY_ERRNO = Object.freeze({ E2BIG: 1, EACCES: 2, EADDRINUSE: 3, EADDRNOTAVAIL: 4, EAFNOSUPPORT: 5, EAGAIN: 6, EALREADY: 7, EBADF: 8, EBADMSG: 9, EBUSY: 10, ECANCELED: 11, ECHILD: 12, ECONNABORTED: 13, ECONNREFUSED: 14, ECONNRESET: 15, EDEADLK: 16, EDESTADDRREQ: 17, EDOM: 18, EDQUOT: 19, EEXIST: 20, EFAULT: 21, EFBIG: 22, EHOSTUNREACH: 23, EIDRM: 24, EILSEQ: 25, EINPROGRESS: 26, EINTR: 27, EINVAL: 28, EIO: 29, EISCONN: 30, EISDIR: 31, ELOOP: 32, EMFILE: 33, EMLINK: 34, EMSGSIZE: 35, EMULTIHOP: 36, ENAMETOOLONG: 37, ENETDOWN: 38, ENETRESET: 39, ENETUNREACH: 40, ENFILE: 41, ENOBUFS: 42, ENODEV: 43, ENOENT: 44, ENOEXEC: 45, ENOLCK: 46, ENOLINK: 47, ENOMEM: 48, ENOMSG: 49, ENOPROTOOPT: 50, ENOSPC: 51, ENOSYS: 52, ENOTCONN: 53, ENOTDIR: 54, ENOTEMPTY: 55, ENOTRECOVERABLE: 56, ENOTSOCK: 57, ENOTTY: 59, ENXIO: 60, EOVERFLOW: 61, EOWNERDEAD: 62, EPERM: 63, EPIPE: 64, EPROTO: 65, EPROTONOSUPPORT: 66, EPROTOTYPE: 67, ERANGE: 68, EROFS: 69, ESPIPE: 70, ESRCH: 71, ESTALE: 72, ETIMEDOUT: 73, ETXTBSY: 74, EXDEV: 75, ENODATA: 116, ENOTSUP: 138 });
26
- export const DOLLY_TOUCH_ABI_DIGEST = "a666fc4a91ca78e6a7f42e9357d4e3aa8586d6aa662049f7a590794408caa67d";
26
+ export const DOLLY_TOUCH_ABI_DIGEST = "e7f6b42eadb193639f011924f744ad887be7949b8c884e52dbfefba9f9e5fd69";
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
- "version": "0.1.5",
2
+ "version": "0.1.6",
3
3
  "type": "module",
4
4
  "name": "@daugasauron/dolly-host-touch",
5
5
  "license": "MIT",
6
6
  "dependencies": {
7
- "@daugasauron/dolly": "0.1.5"
7
+ "@daugasauron/dolly": "0.1.6"
8
8
  },
9
9
  "description": "Dolly's touch@0 host module: fingers on a touchscreen, every one that is down with its id, and a program's buttons.",
10
10
  "repository": {
package/touch.mjs CHANGED
@@ -136,14 +136,13 @@ const phases = { pointerdown: T.DOLLY_TOUCH_DOWN, pointermove: T.DOLLY_TOUCH_MOV
136
136
  // Worker last reported it: without one the terminal's scroll and pinch are
137
137
  // input@0's. A finger taken stays this module's until it ends. The holder's
138
138
  // buttons are input@0's bar's, before its Paste.
139
- export function browser({ canvas, surfaceSize, send, get }) {
139
+ export function browser({ canvas, framePoint, send, get }) {
140
140
  let started = false, lease = 0;
141
141
  const taken = new Set();
142
142
  // Positions are pixels of the frame the canvas shows, as input@0's pointer records are.
143
143
  function sample(event) {
144
- const bounds = canvas.getBoundingClientRect(), { width, height } = surfaceSize() ?? canvas;
145
- return { x: Math.round(bounds.width === 0 ? 0 : (event.clientX - bounds.left) * width / bounds.width),
146
- y: Math.round(bounds.height === 0 ? 0 : (event.clientY - bounds.top) * height / bounds.height),
144
+ const { x, y } = framePoint(event);
145
+ return { x: Math.round(x), y: Math.round(y),
147
146
  pressure: Math.round(event.pressure * 1000), time: Math.floor(event.timeStamp) };
148
147
  }
149
148
  function listen(event) {