diff --git a/src/stitching_scanner.py b/src/stitching_scanner.py index f72e2a8..3aea232 100644 --- a/src/stitching_scanner.py +++ b/src/stitching_scanner.py @@ -517,12 +517,12 @@ class StitchingScanner: # stop_reason = 'min_dim' # break - if abs(total_x) >= self.config.max_mosaic_width: + if abs(total_x) >= self.config.max_mosaic_width or total_x <= 0: self.log(f"Max dimension reached ({self.config.max_mosaic_width}px)") if direction == ScanDirection.RIGHT: - self.state.current_x = self.state.max_mosaic_width - w # At right edge - elif direction == ScanDirection.LEFT: self.state.current_x = 0 + elif direction == ScanDirection.LEFT: + self.state.current_x = self.state.max_mosaic_width - w # At right edge self.log(f"Current X offset ({self.state.current_x}px)") stop_reason = 'max_dim' break