|
281 | 281 | * pointer source
|
282 | 282 | * @returns {Actions}
|
283 | 283 | */
|
284 |
| - pointerDown: function({button=this.ButtonType.LEFT, sourceName=null}={}) { |
| 284 | + pointerDown: function({button=this.ButtonType.LEFT, sourceName=null, |
| 285 | + width, height, pressure, tangentialPressure, |
| 286 | + tiltX, tiltY, twist, altitudeAngle, azimuthAngle}={}) { |
285 | 287 | let source = this.getSource("pointer", sourceName);
|
286 |
| - source.pointerDown(this, button); |
| 288 | + source.pointerDown(this, button, width, height, pressure, tangentialPressure, |
| 289 | + tiltX, tiltY, twist, altitudeAngle, azimuthAngle); |
287 | 290 | return this;
|
288 | 291 | },
|
289 | 292 |
|
|
314 | 317 | * @returns {Actions}
|
315 | 318 | */
|
316 | 319 | pointerMove: function(x, y,
|
317 |
| - {origin="viewport", duration, sourceName=null}={}) { |
| 320 | + {origin="viewport", duration, sourceName=null, |
| 321 | + width, height, pressure, tangentialPressure, |
| 322 | + tiltX, tiltY, twist, altitudeAngle, azimuthAngle}={}) { |
318 | 323 | let source = this.getSource("pointer", sourceName);
|
319 |
| - source.pointerMove(this, x, y, duration, origin); |
| 324 | + source.pointerMove(this, x, y, duration, origin, width, height, pressure, |
| 325 | + tangentialPressure, tiltX, tiltY, twist, altitudeAngle, |
| 326 | + azimuthAngle); |
320 | 327 | return this;
|
321 | 328 | },
|
322 | 329 |
|
|
424 | 431 | this.actions = new Map();
|
425 | 432 | }
|
426 | 433 |
|
| 434 | + function setPointerProperties(action, width, height, pressure, tangentialPressure, |
| 435 | + tiltX, tiltY, twist, altitudeAngle, azimuthAngle) { |
| 436 | + if (width) { |
| 437 | + action.width = width; |
| 438 | + } |
| 439 | + if (height) { |
| 440 | + action.height = height; |
| 441 | + } |
| 442 | + if (pressure) { |
| 443 | + action.pressure = pressure; |
| 444 | + } |
| 445 | + if (tangentialPressure) { |
| 446 | + action.tangentialPressure = tangentialPressure; |
| 447 | + } |
| 448 | + if (tiltX) { |
| 449 | + action.tiltX = tiltX; |
| 450 | + } |
| 451 | + if (tiltY) { |
| 452 | + action.tiltY = tiltY; |
| 453 | + } |
| 454 | + if (twist) { |
| 455 | + action.twist = twist; |
| 456 | + } |
| 457 | + if (altitudeAngle) { |
| 458 | + action.altitudeAngle = altitudeAngle; |
| 459 | + } |
| 460 | + if (azimuthAngle) { |
| 461 | + action.azimuthAngle = azimuthAngle; |
| 462 | + } |
| 463 | + return action; |
| 464 | + } |
| 465 | + |
427 | 466 | PointerSource.prototype = {
|
428 | 467 | serialize: function(tickCount) {
|
429 | 468 | if (!this.actions.size) {
|
|
441 | 480 | return data;
|
442 | 481 | },
|
443 | 482 |
|
444 |
| - pointerDown: function(actions, button) { |
| 483 | + pointerDown: function(actions, button, width, height, pressure, tangentialPressure, |
| 484 | + tiltX, tiltY, twist, altitudeAngle, azimuthAngle) { |
445 | 485 | let tick = actions.tickIdx;
|
446 | 486 | if (this.actions.has(tick)) {
|
447 | 487 | tick = actions.addTick().tickIdx;
|
448 | 488 | }
|
449 |
| - this.actions.set(tick, {type: "pointerDown", button}); |
| 489 | + let actionProperties = setPointerProperties({type: "pointerDown", button}, width, height, |
| 490 | + pressure, tangentialPressure, tiltX, tiltY, |
| 491 | + twist, altitudeAngle, azimuthAngle); |
| 492 | + this.actions.set(tick, actionProperties); |
450 | 493 | },
|
451 | 494 |
|
452 | 495 | pointerUp: function(actions, button) {
|
|
457 | 500 | this.actions.set(tick, {type: "pointerUp", button});
|
458 | 501 | },
|
459 | 502 |
|
460 |
| - pointerMove: function(actions, x, y, duration, origin) { |
| 503 | + pointerMove: function(actions, x, y, duration, origin, width, height, pressure, |
| 504 | + tangentialPressure, tiltX, tiltY, twist, altitudeAngle, azimuthAngle) { |
461 | 505 | let tick = actions.tickIdx;
|
462 | 506 | if (this.actions.has(tick)) {
|
463 | 507 | tick = actions.addTick().tickIdx;
|
464 | 508 | }
|
465 |
| - this.actions.set(tick, {type: "pointerMove", x, y, origin}); |
| 509 | + let moveAction = {type: "pointerMove", x, y, origin}; |
466 | 510 | if (duration) {
|
467 |
| - this.actions.get(tick).duration = duration; |
| 511 | + moveAction.duration = duration; |
468 | 512 | }
|
| 513 | + let actionProperties = setPointerProperties(moveAction, width, height, pressure, |
| 514 | + tangentialPressure, tiltX, tiltY, twist, |
| 515 | + altitudeAngle, azimuthAngle); |
| 516 | + this.actions.set(tick, actionProperties); |
469 | 517 | },
|
470 | 518 |
|
471 | 519 | addPause: function(actions, duration) {
|
|
0 commit comments