@@ -202,12 +202,10 @@ export class Wheel extends Plugin
202202 }
203203 else
204204 {
205- this . parent . parent . toLocal (
206- oldPoint as PointData ,
207- this . parent ,
208- oldPoint
209- ) ;
210- const comparePoint = this . parent . parent . toLocal ( point as PointData ) ;
205+ const targetParent = this . parent . parent || this . parent ;
206+
207+ targetParent . toLocal ( oldPoint as PointData , this . parent , oldPoint ) ;
208+ const comparePoint = targetParent . toLocal ( point as PointData ) ;
211209
212210 this . parent . x += comparePoint . x - ( oldPoint as PointData ) . x ;
213211 this . parent . y += comparePoint . y - ( oldPoint as PointData ) . y ;
@@ -265,8 +263,10 @@ export class Wheel extends Plugin
265263 }
266264 else
267265 {
268- this . parent . parent . toLocal ( oldPoint as PointData , this . parent , oldPoint ) ;
269- const comparePoint = this . parent . parent . toLocal ( point as PointData ) ;
266+ const targetParent = this . parent . parent || this . parent ;
267+
268+ targetParent . toLocal ( oldPoint as PointData , this . parent , oldPoint ) ;
269+ const comparePoint = targetParent . toLocal ( point as PointData ) ;
270270
271271 this . parent . x += comparePoint . x - ( oldPoint as PointData ) . x ;
272272 this . parent . y += comparePoint . y - ( oldPoint as PointData ) . y ;
@@ -355,12 +355,10 @@ export class Wheel extends Plugin
355355 }
356356 else
357357 {
358- this . parent . parent . toLocal (
359- oldPoint as PointData ,
360- this . parent ,
361- oldPoint
362- ) ;
363- const comparePoint = this . parent . parent . toLocal ( point as PointData ) ;
358+ const targetParent = this . parent . parent || this . parent ;
359+
360+ targetParent . toLocal ( oldPoint as PointData , this . parent , oldPoint ) ;
361+ const comparePoint = targetParent . toLocal ( point as PointData ) ;
364362
365363 this . parent . x += comparePoint . x - ( oldPoint as PointData ) . x ;
366364 this . parent . y += comparePoint . y - ( oldPoint as PointData ) . y ;
0 commit comments