|
3 | 3 | open EventAPI
|
4 | 4 | open DOMAPI
|
5 | 5 |
|
| 6 | +type touchType = |
| 7 | + | @as("direct") Direct |
| 8 | + | @as("stylus") Stylus |
| 9 | + |
6 | 10 | /**
|
7 | 11 | Simple user interface events.
|
8 | 12 | [See UIEvent on MDN](https://developer.mozilla.org/docs/Web/API/UIEvent)
|
@@ -296,6 +300,164 @@ type wheelEvent = {
|
296 | 300 | deltaMode: int,
|
297 | 301 | }
|
298 | 302 |
|
| 303 | +/** |
| 304 | +A single contact point on a touch-sensitive device. The contact point is commonly a finger or stylus and the device may be a touchscreen or trackpad. |
| 305 | +[See Touch on MDN](https://developer.mozilla.org/docs/Web/API/Touch) |
| 306 | +*/ |
| 307 | +type touch = { |
| 308 | + /** |
| 309 | + [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Touch/identifier) |
| 310 | + */ |
| 311 | + identifier: int, |
| 312 | + /** |
| 313 | + [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Touch/target) |
| 314 | + */ |
| 315 | + target: eventTarget, |
| 316 | + /** |
| 317 | + [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Touch/screenX) |
| 318 | + */ |
| 319 | + screenX: float, |
| 320 | + /** |
| 321 | + [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Touch/screenY) |
| 322 | + */ |
| 323 | + screenY: float, |
| 324 | + /** |
| 325 | + [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Touch/clientX) |
| 326 | + */ |
| 327 | + clientX: float, |
| 328 | + /** |
| 329 | + [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Touch/clientY) |
| 330 | + */ |
| 331 | + clientY: float, |
| 332 | + /** |
| 333 | + [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Touch/pageX) |
| 334 | + */ |
| 335 | + pageX: float, |
| 336 | + /** |
| 337 | + [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Touch/pageY) |
| 338 | + */ |
| 339 | + pageY: float, |
| 340 | + /** |
| 341 | + [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Touch/radiusX) |
| 342 | + */ |
| 343 | + radiusX: float, |
| 344 | + /** |
| 345 | + [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Touch/radiusY) |
| 346 | + */ |
| 347 | + radiusY: float, |
| 348 | + /** |
| 349 | + [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Touch/rotationAngle) |
| 350 | + */ |
| 351 | + rotationAngle: float, |
| 352 | + /** |
| 353 | + [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Touch/force) |
| 354 | + */ |
| 355 | + force: float, |
| 356 | +} |
| 357 | + |
| 358 | +/** |
| 359 | +A list of contact points on a touch surface. For example, if the user has three fingers on the touch surface (such as a screen or trackpad), the corresponding TouchList object would have one Touch object for each finger, for a total of three entries. |
| 360 | +[See TouchList on MDN](https://developer.mozilla.org/docs/Web/API/TouchList) |
| 361 | +*/ |
| 362 | +type touchList = { |
| 363 | + /** |
| 364 | + [Read more on MDN](https://developer.mozilla.org/docs/Web/API/TouchList/length) |
| 365 | + */ |
| 366 | + length: int, |
| 367 | +} |
| 368 | + |
| 369 | +/** |
| 370 | +An event sent when the state of contacts with a touch-sensitive surface changes. This surface can be a touch screen or trackpad, for example. The event can describe one or more points of contact with the screen and includes support for detecting movement, addition and removal of contact points, and so forth. |
| 371 | +[See TouchEvent on MDN](https://developer.mozilla.org/docs/Web/API/TouchEvent) |
| 372 | +*/ |
| 373 | +type touchEvent = { |
| 374 | + ...uiEvent, |
| 375 | + /** |
| 376 | + [Read more on MDN](https://developer.mozilla.org/docs/Web/API/TouchEvent/touches) |
| 377 | + */ |
| 378 | + touches: touchList, |
| 379 | + /** |
| 380 | + [Read more on MDN](https://developer.mozilla.org/docs/Web/API/TouchEvent/targetTouches) |
| 381 | + */ |
| 382 | + targetTouches: touchList, |
| 383 | + /** |
| 384 | + [Read more on MDN](https://developer.mozilla.org/docs/Web/API/TouchEvent/changedTouches) |
| 385 | + */ |
| 386 | + changedTouches: touchList, |
| 387 | + /** |
| 388 | + [Read more on MDN](https://developer.mozilla.org/docs/Web/API/TouchEvent/altKey) |
| 389 | + */ |
| 390 | + altKey: bool, |
| 391 | + /** |
| 392 | + [Read more on MDN](https://developer.mozilla.org/docs/Web/API/TouchEvent/metaKey) |
| 393 | + */ |
| 394 | + metaKey: bool, |
| 395 | + /** |
| 396 | + [Read more on MDN](https://developer.mozilla.org/docs/Web/API/TouchEvent/ctrlKey) |
| 397 | + */ |
| 398 | + ctrlKey: bool, |
| 399 | + /** |
| 400 | + [Read more on MDN](https://developer.mozilla.org/docs/Web/API/TouchEvent/shiftKey) |
| 401 | + */ |
| 402 | + shiftKey: bool, |
| 403 | +} |
| 404 | + |
| 405 | +/** |
| 406 | +The state of a DOM event produced by a pointer such as the geometry of the contact point, the device type that generated the event, the amount of pressure that was applied on the contact surface, etc. |
| 407 | +[See PointerEvent on MDN](https://developer.mozilla.org/docs/Web/API/PointerEvent) |
| 408 | +*/ |
| 409 | +type pointerEvent = { |
| 410 | + ...mouseEvent, |
| 411 | + /** |
| 412 | + [Read more on MDN](https://developer.mozilla.org/docs/Web/API/PointerEvent/pointerId) |
| 413 | + */ |
| 414 | + pointerId: int, |
| 415 | + /** |
| 416 | + [Read more on MDN](https://developer.mozilla.org/docs/Web/API/PointerEvent/width) |
| 417 | + */ |
| 418 | + width: float, |
| 419 | + /** |
| 420 | + [Read more on MDN](https://developer.mozilla.org/docs/Web/API/PointerEvent/height) |
| 421 | + */ |
| 422 | + height: float, |
| 423 | + /** |
| 424 | + [Read more on MDN](https://developer.mozilla.org/docs/Web/API/PointerEvent/pressure) |
| 425 | + */ |
| 426 | + pressure: float, |
| 427 | + /** |
| 428 | + [Read more on MDN](https://developer.mozilla.org/docs/Web/API/PointerEvent/tangentialPressure) |
| 429 | + */ |
| 430 | + tangentialPressure: float, |
| 431 | + /** |
| 432 | + [Read more on MDN](https://developer.mozilla.org/docs/Web/API/PointerEvent/tiltX) |
| 433 | + */ |
| 434 | + tiltX: int, |
| 435 | + /** |
| 436 | + [Read more on MDN](https://developer.mozilla.org/docs/Web/API/PointerEvent/tiltY) |
| 437 | + */ |
| 438 | + tiltY: int, |
| 439 | + /** |
| 440 | + [Read more on MDN](https://developer.mozilla.org/docs/Web/API/PointerEvent/twist) |
| 441 | + */ |
| 442 | + twist: int, |
| 443 | + /** |
| 444 | + [Read more on MDN](https://developer.mozilla.org/docs/Web/API/PointerEvent/altitudeAngle) |
| 445 | + */ |
| 446 | + altitudeAngle: float, |
| 447 | + /** |
| 448 | + [Read more on MDN](https://developer.mozilla.org/docs/Web/API/PointerEvent/azimuthAngle) |
| 449 | + */ |
| 450 | + azimuthAngle: float, |
| 451 | + /** |
| 452 | + [Read more on MDN](https://developer.mozilla.org/docs/Web/API/PointerEvent/pointerType) |
| 453 | + */ |
| 454 | + pointerType: string, |
| 455 | + /** |
| 456 | + [Read more on MDN](https://developer.mozilla.org/docs/Web/API/PointerEvent/isPrimary) |
| 457 | + */ |
| 458 | + isPrimary: bool, |
| 459 | +} |
| 460 | + |
299 | 461 | type uiEventInit = {
|
300 | 462 | ...eventInit,
|
301 | 463 | mutable view?: Null.t<window>,
|
@@ -371,3 +533,46 @@ type inputEventInit = {
|
371 | 533 | mutable dataTransfer?: Null.t<dataTransfer>,
|
372 | 534 | mutable targetRanges?: array<staticRange>,
|
373 | 535 | }
|
| 536 | + |
| 537 | +type touchInit = { |
| 538 | + mutable identifier: int, |
| 539 | + mutable target: eventTarget, |
| 540 | + mutable clientX?: float, |
| 541 | + mutable clientY?: float, |
| 542 | + mutable screenX?: float, |
| 543 | + mutable screenY?: float, |
| 544 | + mutable pageX?: float, |
| 545 | + mutable pageY?: float, |
| 546 | + mutable radiusX?: float, |
| 547 | + mutable radiusY?: float, |
| 548 | + mutable rotationAngle?: float, |
| 549 | + mutable force?: float, |
| 550 | + mutable altitudeAngle?: float, |
| 551 | + mutable azimuthAngle?: float, |
| 552 | + mutable touchType?: touchType, |
| 553 | +} |
| 554 | + |
| 555 | +type pointerEventInit = { |
| 556 | + ...mouseEventInit, |
| 557 | + mutable pointerId?: int, |
| 558 | + mutable width?: float, |
| 559 | + mutable height?: float, |
| 560 | + mutable pressure?: float, |
| 561 | + mutable tangentialPressure?: float, |
| 562 | + mutable tiltX?: int, |
| 563 | + mutable tiltY?: int, |
| 564 | + mutable twist?: int, |
| 565 | + mutable altitudeAngle?: float, |
| 566 | + mutable azimuthAngle?: float, |
| 567 | + mutable pointerType?: string, |
| 568 | + mutable isPrimary?: bool, |
| 569 | + mutable coalescedEvents?: array<pointerEvent>, |
| 570 | + mutable predictedEvents?: array<pointerEvent>, |
| 571 | +} |
| 572 | + |
| 573 | +type touchEventInit = { |
| 574 | + ...eventModifierInit, |
| 575 | + mutable touches?: array<touch>, |
| 576 | + mutable targetTouches?: array<touch>, |
| 577 | + mutable changedTouches?: array<touch>, |
| 578 | +} |
0 commit comments