@@ -362,8 +362,8 @@ def __init__(
362
362
widget : Widget | None ,
363
363
x : float ,
364
364
y : float ,
365
- delta_x : float ,
366
- delta_y : float ,
365
+ delta_x : int ,
366
+ delta_y : int ,
367
367
button : int ,
368
368
shift : bool ,
369
369
meta : bool ,
@@ -399,34 +399,54 @@ def __init__(
399
399
400
400
@property
401
401
def x (self ) -> int :
402
- """The relative X coordinate."""
402
+ """The relative X coordinate of the cell under the mouse ."""
403
403
return int (self ._x )
404
404
405
405
@property
406
406
def y (self ) -> int :
407
- """The relative Y coordinate."""
407
+ """The relative Y coordinate of the cell under the mouse ."""
408
408
return int (self ._y )
409
409
410
410
@property
411
411
def delta_x (self ) -> int :
412
412
"""Change in `x` since last message."""
413
- return int ( self ._delta_x )
413
+ return self ._delta_x
414
414
415
415
@property
416
416
def delta_y (self ) -> int :
417
417
"""Change in `y` since the last message."""
418
- return int ( self ._delta_y )
418
+ return self ._delta_y
419
419
420
420
@property
421
421
def screen_x (self ) -> int :
422
- """X coordinate relative to top left of screen."""
422
+ """X coordinate of the cell relative to top left of screen."""
423
423
return int (self ._screen_x )
424
424
425
425
@property
426
426
def screen_y (self ) -> int :
427
- """Y coordinate relative to top left of screen."""
427
+ """Y coordinate of the cell relative to top left of screen."""
428
428
return int (self ._screen_y )
429
429
430
+ @property
431
+ def pointer_x (self ) -> float :
432
+ """The relative X coordinate of the pointer."""
433
+ return self ._x
434
+
435
+ @property
436
+ def pointer_y (self ) -> float :
437
+ """The relative Y coordinate of the pointer."""
438
+ return self ._y
439
+
440
+ @property
441
+ def pointer_screen_x (self ) -> float :
442
+ """The X coordinate of the pointer relative to the screen."""
443
+ return self ._screen_x
444
+
445
+ @property
446
+ def pointer_screen_y (self ) -> float :
447
+ """The Y coordinate of the pointer relative to the screen."""
448
+ return self ._screen_y
449
+
430
450
@classmethod
431
451
def from_event (
432
452
cls : Type [MouseEventT ], widget : Widget , event : MouseEvent
@@ -449,10 +469,12 @@ def from_event(
449
469
450
470
def __rich_repr__ (self ) -> rich .repr .Result :
451
471
yield self .widget
452
- yield "x" , self ._x
453
- yield "y" , self ._y
454
- yield "delta_x" , self ._delta_x , 0
455
- yield "delta_y" , self ._delta_y , 0
472
+ yield "x" , self .x
473
+ yield "y" , self .y
474
+ yield "pointer_x" , self .pointer_x
475
+ yield "pointer_y" , self .pointer_y
476
+ yield "delta_x" , self .delta_x , 0
477
+ yield "delta_y" , self .delta_y , 0
456
478
if self .screen_x != self .x :
457
479
yield "screen_x" , self ._screen_x
458
480
if self .screen_y != self .y :
0 commit comments