mirror of
https://github.com/1j01/textual-paint.git
synced 2024-11-28 01:34:42 +03:00
Scroll cursor into view when moving cursor
This commit is contained in:
parent
e8cc107f55
commit
62db73e328
@ -42,6 +42,7 @@ Header.-tall HeaderIcon {
|
||||
#canvas {
|
||||
width: auto;
|
||||
height: auto;
|
||||
/* Note: styles.margin is used in cursor position calculations (could be changed to use difference between absolute regions of parent and child or something...) */
|
||||
margin: 1 2;
|
||||
}
|
||||
|
||||
|
@ -3199,6 +3199,15 @@ Columns: {len(self.palette) // 2}
|
||||
self.image.selection.copy_from_document(self.image)
|
||||
self.canvas.refresh_scaled_region(select_region)
|
||||
|
||||
# Scroll the canvas area if needed.
|
||||
# TODO: prevent animation for small movements, maybe ideally preserving it for page up/down and home/end.
|
||||
self.editing_area.scroll_to_region(Region(
|
||||
x * self.magnification + self.canvas.styles.margin.left,
|
||||
y * self.magnification + self.canvas.styles.margin.top,
|
||||
self.magnification,
|
||||
self.magnification,
|
||||
))
|
||||
|
||||
self.canvas.refresh_scaled_region(textbox.region)
|
||||
|
||||
def on_paste(self, event: events.Paste) -> None:
|
||||
|
Loading…
Reference in New Issue
Block a user