Wiresheet: mouse wheel scrolls the sheet, Shift + wheel scrolls sideways
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -8,7 +8,7 @@ so later rebinding would only ever be seen by the module that did it.
|
|||||||
import configparser
|
import configparser
|
||||||
import os
|
import os
|
||||||
|
|
||||||
VERSION = "0.0.0.157"
|
VERSION = "0.0.0.158"
|
||||||
PROPERTIES_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), "editor.properties")
|
PROPERTIES_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), "editor.properties")
|
||||||
DEFAULT_GRID_SIZE = 10
|
DEFAULT_GRID_SIZE = 10
|
||||||
DEFAULT_ADD_TIMESTAMP = True
|
DEFAULT_ADD_TIMESTAMP = True
|
||||||
|
|||||||
@@ -903,6 +903,18 @@ def on_canvas_wheel_zoom(event):
|
|||||||
return "break"
|
return "break"
|
||||||
|
|
||||||
|
|
||||||
|
def on_canvas_wheel_scroll(event):
|
||||||
|
"""Plain wheel pans the sheet up and down, Shift + wheel pans it sideways."""
|
||||||
|
if not event.delta:
|
||||||
|
return "break"
|
||||||
|
units = -1 if event.delta > 0 else 1
|
||||||
|
if event.state & 0x0001:
|
||||||
|
canvas.xview_scroll(units, "units")
|
||||||
|
else:
|
||||||
|
canvas.yview_scroll(units, "units")
|
||||||
|
return "break"
|
||||||
|
|
||||||
|
|
||||||
# --- Event handlers ---
|
# --- Event handlers ---
|
||||||
|
|
||||||
def on_tree_select(event):
|
def on_tree_select(event):
|
||||||
@@ -3364,6 +3376,12 @@ canvas.bind("<Double-1>", on_canvas_double_click)
|
|||||||
canvas.bind("<Control-MouseWheel>", on_canvas_wheel_zoom)
|
canvas.bind("<Control-MouseWheel>", on_canvas_wheel_zoom)
|
||||||
canvas.bind("<Control-Button-4>", do_zoom_in)
|
canvas.bind("<Control-Button-4>", do_zoom_in)
|
||||||
canvas.bind("<Control-Button-5>", do_zoom_out)
|
canvas.bind("<Control-Button-5>", do_zoom_out)
|
||||||
|
canvas.bind("<MouseWheel>", on_canvas_wheel_scroll)
|
||||||
|
canvas.bind("<Shift-MouseWheel>", on_canvas_wheel_scroll)
|
||||||
|
canvas.bind("<Button-4>", lambda e: canvas.yview_scroll(-1, "units"))
|
||||||
|
canvas.bind("<Button-5>", lambda e: canvas.yview_scroll(1, "units"))
|
||||||
|
canvas.bind("<Shift-Button-4>", lambda e: canvas.xview_scroll(-1, "units"))
|
||||||
|
canvas.bind("<Shift-Button-5>", lambda e: canvas.xview_scroll(1, "units"))
|
||||||
|
|
||||||
paned_window.add(frame_editor, weight=3)
|
paned_window.add(frame_editor, weight=3)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user