ScanSlicer/scanslicer/canvas.py
dan 426a18f342 chore: prune boilerplate and refresh stale docs
- Remove 257 redundant per-definition comment stubs across the package
- Drop dead nonlocal declarations in autoslicer_detection.py
- Document the swapped flag and swap_left_right in architecture docs
- Remove unsupported 'legacy override' claims from autotune/runtime docs
2026-09-11 23:07:30 +02:00

37 lines
1.2 KiB
Python

from PySide6.QtCore import QPointF, Signal
from PySide6.QtGui import QColor
from PySide6.QtWidgets import QWidget
from .canvas_interaction import CanvasInteractionMixin
from .canvas_render import CanvasRenderMixin
from .canvas_state import CanvasStateMixin
class QtSlicingCanvas(CanvasInteractionMixin, CanvasRenderMixin, CanvasStateMixin, QWidget):
AUTO_FIT_SCALE = 0.95
OFF_CANVAS_COLOR = QColor(38, 38, 38)
CORNER_HANDLE_HIT_RADIUS = 12.0
SIDE_HANDLE_HIT_RADIUS = 14.0
SIDE_HANDLE_SIZE_ACTIVE = 11.0
SIDE_HANDLE_SIZE_INACTIVE = 9.0
active_slice_changed = Signal(int)
def __init__(self, parent=None):
super().__init__(parent)
self.setMouseTracking(True)
self.setMinimumSize(640, 480)
self.zoom = 1.0
self.image = None
self.pan_offset = QPointF(0.0, 0.0)
self.slices = []
self.active_slice_index = None
self.corner_dragging = None
self.side_dragging = None
self.rotation_dragging = None
self.box_dragging = None
self.rotate_handles_mode = False
self.panning = False
self.last_mouse_pos = QPointF(0.0, 0.0)
self.user_transformed_view = False