File tree 5 files changed +36
-1
lines changed
5 files changed +36
-1
lines changed Original file line number Diff line number Diff line change @@ -815,6 +815,7 @@ <h1>OffscreenCanvas</h1>
815
815
'pointerType',
816
816
'clientX',
817
817
'clientY',
818
+ 'pointerId',
818
819
'pageX',
819
820
'pageY',
820
821
]);
@@ -853,13 +854,19 @@ <h1>OffscreenCanvas</h1>
853
854
}
854
855
855
856
function touchEventHandler(event, sendFn) {
857
+ // preventDefault() fixes mousemove, mouseup and mousedown
858
+ // firing when doing a simple touchup touchdown
859
+ // Happens only at offscreen canvas
860
+ event.preventDefault();
856
861
const touches = [];
857
862
const data = {type: event.type, touches};
858
863
for (let i = 0; i < event.touches.length; ++i) {
859
864
const touch = event.touches[i];
860
865
touches.push({
861
866
pageX: touch.pageX,
862
867
pageY: touch.pageY,
868
+ clientX: touch.clientX,
869
+ clientY: touch.clientY,
863
870
});
864
871
}
865
872
sendFn(data);
Original file line number Diff line number Diff line change 34
34
'pointerType' ,
35
35
'clientX' ,
36
36
'clientY' ,
37
+ 'pointerId' ,
37
38
'pageX' ,
38
39
'pageY' ,
39
40
] ) ;
84
85
}
85
86
86
87
function touchEventHandler ( event , sendFn ) {
87
-
88
+
89
+ // preventDefault() fixes mousemove, mouseup and mousedown
90
+ // firing at touch events when doing a simple touchup touchdown
91
+ // Happens only at offscreen canvas
92
+ event . preventDefault ( ) ;
88
93
const touches = [ ] ;
89
94
const data = { type : event . type , touches } ;
90
95
for ( let i = 0 ; i < event . touches . length ; ++ i ) {
93
98
touches . push ( {
94
99
pageX : touch . pageX ,
95
100
pageY : touch . pageY ,
101
+ clientX : touch . clientX ,
102
+ clientY : touch . clientY ,
96
103
} ) ;
97
104
98
105
}
Original file line number Diff line number Diff line change @@ -767,6 +767,7 @@ <h1>のOffscreenCanvas</h1>
767
767
'pointerType',
768
768
'clientX',
769
769
'clientY',
770
+ 'pointerId',
770
771
'pageX',
771
772
'pageY',
772
773
]);
@@ -805,13 +806,19 @@ <h1>のOffscreenCanvas</h1>
805
806
}
806
807
807
808
function touchEventHandler(event, sendFn) {
809
+ // preventDefault() fixes mousemove, mouseup and mousedown
810
+ // firing when doing a simple touchup touchdown
811
+ // Happens only at offscreen canvas
812
+ event.preventDefault();
808
813
const touches = [];
809
814
const data = {type: event.type, touches};
810
815
for (let i = 0; i < event.touches.length; ++i) {
811
816
const touch = event.touches[i];
812
817
touches.push({
813
818
pageX: touch.pageX,
814
819
pageY: touch.pageY,
820
+ clientX: touch.clientX,
821
+ clientY: touch.clientY,
815
822
});
816
823
}
817
824
sendFn(data);
Original file line number Diff line number Diff line change @@ -717,6 +717,7 @@ <h1>OffscreenCanvas</h1>
717
717
'pointerType',
718
718
'clientX',
719
719
'clientY',
720
+ 'pointerId',
720
721
'pageX',
721
722
'pageY',
722
723
]);
@@ -755,13 +756,19 @@ <h1>OffscreenCanvas</h1>
755
756
}
756
757
757
758
function touchEventHandler(event, sendFn) {
759
+ // preventDefault() fixes mousemove, mouseup and mousedown
760
+ // firing when doing a simple touchup touchdown
761
+ // Happens only at offscreen canvas
762
+ event.preventDefault();
758
763
const touches = [];
759
764
const data = { type: event.type, touches };
760
765
for (let i = 0; i < event.touches.length; ++i) {
761
766
const touch = event.touches[i];
762
767
touches.push({
763
768
pageX: touch.pageX,
764
769
pageY: touch.pageY,
770
+ clientX: touch.clientX,
771
+ clientY: touch.clientY,
765
772
});
766
773
}
767
774
sendFn(data);
Original file line number Diff line number Diff line change @@ -748,6 +748,7 @@ <h1>OffscreenCanvas</h1>
748
748
'pointerType',
749
749
'clientX',
750
750
'clientY',
751
+ 'pointerId',
751
752
'pageX',
752
753
'pageY',
753
754
]);
@@ -786,13 +787,19 @@ <h1>OffscreenCanvas</h1>
786
787
}
787
788
788
789
function touchEventHandler(event, sendFn) {
790
+ // preventDefault() fixes mousemove, mouseup and mousedown
791
+ // firing when doing a simple touchup touchdown
792
+ // Happens only at offscreen canvas
793
+ event.preventDefault();
789
794
const touches = [];
790
795
const data = {type: event.type, touches};
791
796
for (let i = 0; i < event.touches.length; ++i) {
792
797
const touch = event.touches[i];
793
798
touches.push({
794
799
pageX: touch.pageX,
795
800
pageY: touch.pageY,
801
+ clientX: touch.clientX,
802
+ clientY: touch.clientY,
796
803
});
797
804
}
798
805
sendFn(data);
You can’t perform that action at this time.
0 commit comments