Skip to content

Commit 5352c58

Browse files
committed
quicker math
1 parent c12f804 commit 5352c58

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/textual/_xterm_parser.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,10 @@ def parse_mouse_code(self, code: str) -> Message | None:
8383
and self.terminal_pixel_size is not None
8484
and self.terminal_size is not None
8585
):
86-
x_ratio = self.terminal_pixel_size[0] / self.terminal_size[0]
87-
y_ratio = self.terminal_pixel_size[1] / self.terminal_size[1]
86+
pixel_width, pixel_height = self.terminal_pixel_size
87+
width, height = self.terminal_size
88+
x_ratio = pixel_width / width
89+
y_ratio = pixel_height / height
8890
x /= x_ratio
8991
y /= y_ratio
9092

@@ -121,7 +123,6 @@ def parse_mouse_code(self, code: str) -> Message | None:
121123
screen_x=x,
122124
screen_y=y,
123125
)
124-
print(event)
125126
return event
126127
return None
127128

0 commit comments

Comments
 (0)