@@ -1547,10 +1547,10 @@ export class Input {
1547
1547
if ( this . _trackpadMode ) return ;
1548
1548
const client_dpr = window . devicePixelRatio || 1 ;
1549
1549
const dpr_for_input_coords = this . useCssScaling ? 1 : client_dpr ;
1550
- const down = ( event . type === 'mousedown' ? 1 : 0 ) ;
1550
+ const down = ( event . type === 'mousedown' || event . type === 'pointerdown' ? 1 : 0 ) ;
1551
1551
var mtype = "m" ;
1552
1552
let canvas = document . getElementById ( 'videoCanvas' ) ;
1553
- if ( event . type === 'mousedown' || event . type === 'mouseup' ) {
1553
+ if ( event . type === 'mousedown' || event . type === 'mouseup' || event . type === 'pointerdown' || event . type === 'pointerup' || event . type === 'pointercancel' ) {
1554
1554
if ( event . button === 3 ) {
1555
1555
event . preventDefault ( ) ;
1556
1556
} else if ( event . button === 4 ) {
@@ -1570,7 +1570,7 @@ export class Input {
1570
1570
this . x = Math . round ( movementX_logical * dpr_for_input_coords ) ;
1571
1571
this . y = Math . round ( movementY_logical * dpr_for_input_coords ) ;
1572
1572
1573
- } else if ( event . type === 'mousemove' ) {
1573
+ } else if ( event . type === 'mousemove' || event . type === 'pointermove' ) {
1574
1574
if ( window . isManualResolutionMode && canvas ) {
1575
1575
const canvasRect = canvas . getBoundingClientRect ( ) ; // CSS logical size
1576
1576
if ( canvasRect . width > 0 && canvasRect . height > 0 && canvas . width > 0 && canvas . height > 0 ) {
@@ -1611,6 +1611,28 @@ export class Input {
1611
1611
this . send ( toks . join ( "," ) ) ;
1612
1612
}
1613
1613
1614
+ _handlePointerDown ( event ) {
1615
+ if ( event . pointerType !== 'pen' ) {
1616
+ return ;
1617
+ }
1618
+ event . preventDefault ( ) ;
1619
+ this . _mouseButtonMovement ( event ) ;
1620
+ }
1621
+
1622
+ _handlePointerMove ( event ) {
1623
+ if ( event . pointerType !== 'pen' ) {
1624
+ return ;
1625
+ }
1626
+ this . _mouseButtonMovement ( event ) ;
1627
+ }
1628
+
1629
+ _handlePointerUp ( event ) {
1630
+ if ( event . pointerType !== 'pen' ) {
1631
+ return ;
1632
+ }
1633
+ this . _mouseButtonMovement ( event ) ;
1634
+ }
1635
+
1614
1636
_handleTrackpadEvent ( event ) {
1615
1637
if ( this . _targetHasClass ( event . target , WHITELIST_CLASS ) ) return ;
1616
1638
event . preventDefault ( ) ;
@@ -2290,7 +2312,10 @@ export class Input {
2290
2312
this . listeners_context . push ( addListener ( compositionTarget , 'compositionstart' , this . _compositionStart , this ) ) ;
2291
2313
this . listeners_context . push ( addListener ( compositionTarget , 'compositionupdate' , this . _compositionUpdate , this ) ) ;
2292
2314
this . listeners_context . push ( addListener ( compositionTarget , 'compositionend' , this . _compositionEnd , this ) ) ;
2293
-
2315
+ this . listeners_context . push ( addListener ( this . element , 'pointerdown' , this . _handlePointerDown , this ) ) ;
2316
+ this . listeners_context . push ( addListener ( this . element , 'pointermove' , this . _handlePointerMove , this ) ) ;
2317
+ this . listeners_context . push ( addListener ( this . element , 'pointerup' , this . _handlePointerUp , this ) ) ;
2318
+ this . listeners_context . push ( addListener ( this . element , 'pointercancel' , this . _handlePointerUp , this ) ) ;
2294
2319
2295
2320
if ( 'ontouchstart' in window ) {
2296
2321
this . listeners_context . push ( addListener ( this . element , 'touchstart' , this . _handleTouchEvent , this , false ) ) ;
0 commit comments