@@ -121,26 +121,33 @@ export class ControllerClass {
121121
122122 private _touchmove = ( event : TouchEvent ) => {
123123 event . preventDefault ( ) ;
124+ this . onePointTouchMoveLocation = new Vector (
125+ event . touches [ event . touches . length - 1 ] . clientX ,
126+ event . touches [ event . touches . length - 1 ] . clientY ,
127+ ) ;
124128 const touch = {
125129 ...( event . touches [ event . touches . length - 1 ] as unknown as MouseEvent ) ,
126130 button : 0 , // 通过对象展开实现相对安全的属性合并
127131
128132 // 尝试修复华为触摸屏的笔记本报错问题
129- clientX : event . touches [ event . touches . length - 1 ] . clientX ,
130- clientY : event . touches [ event . touches . length - 1 ] . clientY ,
133+ clientX : this . onePointTouchMoveLocation . x ,
134+ clientY : this . onePointTouchMoveLocation . y ,
131135 } as MouseEvent ;
132136 this . mousemove ( touch ) ;
133137 } ;
134138
139+ // 由于touchend事件没有位置检测,所以只能延用touchmove的位置
140+ private onePointTouchMoveLocation : Vector = Vector . getZero ( ) ;
141+
135142 private _touchend = ( event : TouchEvent ) => {
136143 event . preventDefault ( ) ;
137144 const touch = {
138145 ...( event . touches [ event . touches . length - 1 ] as unknown as MouseEvent ) ,
139146 button : 0 , // 通过对象展开实现相对安全的属性合并
140147
141148 // 尝试修复华为触摸屏的笔记本报错问题
142- clientX : event . touches [ event . touches . length - 1 ] . clientX ,
143- clientY : event . touches [ event . touches . length - 1 ] . clientY ,
149+ clientX : this . onePointTouchMoveLocation . x ,
150+ clientY : this . onePointTouchMoveLocation . y ,
144151 } as MouseEvent ;
145152 this . _mouseup ( touch ) ;
146153 } ;
0 commit comments