mirror of
https://github.com/1j01/textual-paint.git
synced 2024-11-28 10:03:29 +03:00
Fix dragging windows
This was broken in "Fix a type checker error" e62064a307
where I just added `and self.offset_at_drag_start`.
The problem is that Offset defines __bool__ and are falsy when (0,0),
and the windows, despite starting out in the center, initially have an
offset of (0,0) FROM this center position.
This commit is contained in:
parent
769c7af339
commit
bf2b5ec94e
@ -141,7 +141,6 @@ cat file.ans
|
|||||||
- Large files can make the program very slow, as can magnifying the canvas.
|
- Large files can make the program very slow, as can magnifying the canvas.
|
||||||
- The program sometimes crashes or freezes randomly, and there's no auto-save feature.
|
- The program sometimes crashes or freezes randomly, and there's no auto-save feature.
|
||||||
- Saving/loading an ANSI file ends up with a white cell at the top left, which pushes the top row to the right. The top right cell gets pushed off and deleted.
|
- Saving/loading an ANSI file ends up with a white cell at the top left, which pushes the top row to the right. The top right cell gets pushed off and deleted.
|
||||||
- Dragging windows is broken; it used to work, but now does nothing.
|
|
||||||
- The Polygon/Curve tools aren't finalized when you switch tools.
|
- The Polygon/Curve tools aren't finalized when you switch tools.
|
||||||
- Saved ANSI files are unnecessarily large, because they include escape sequences for every cell, even if the colors match the previous cell.
|
- Saved ANSI files are unnecessarily large, because they include escape sequences for every cell, even if the colors match the previous cell.
|
||||||
|
|
||||||
|
@ -184,7 +184,7 @@ class Window(Container):
|
|||||||
|
|
||||||
def on_mouse_move(self, event: events.MouseMove) -> None:
|
def on_mouse_move(self, event: events.MouseMove) -> None:
|
||||||
"""Called when the user moves the mouse."""
|
"""Called when the user moves the mouse."""
|
||||||
if self.mouse_at_drag_start and self.offset_at_drag_start:
|
if self.mouse_at_drag_start is not None and self.offset_at_drag_start is not None:
|
||||||
self.styles.offset = (
|
self.styles.offset = (
|
||||||
self.offset_at_drag_start.x + event.screen_x - self.mouse_at_drag_start.x,
|
self.offset_at_drag_start.x + event.screen_x - self.mouse_at_drag_start.x,
|
||||||
self.offset_at_drag_start.y + event.screen_y - self.mouse_at_drag_start.y,
|
self.offset_at_drag_start.y + event.screen_y - self.mouse_at_drag_start.y,
|
||||||
|
Loading…
Reference in New Issue
Block a user