diff options
author | RaindropsSys <contact@minteck.org> | 2023-09-01 14:54:08 +0200 |
---|---|---|
committer | RaindropsSys <contact@minteck.org> | 2023-09-01 14:54:08 +0200 |
commit | c2f1ed6a85c3895483d36af0f64e2829c3fa3263 (patch) | |
tree | 6f6a8efbe62db8576a1abf5409569b37ccf261be /src/zoom.py | |
parent | 03afd42fdcd52e4a827016828c4ad286de320078 (diff) | |
download | blocks-c2f1ed6a85c3895483d36af0f64e2829c3fa3263.tar.gz blocks-c2f1ed6a85c3895483d36af0f64e2829c3fa3263.tar.bz2 blocks-c2f1ed6a85c3895483d36af0f64e2829c3fa3263.zip |
Updated 11 files and added 2 files (automated)
Diffstat (limited to 'src/zoom.py')
-rw-r--r-- | src/zoom.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/zoom.py b/src/zoom.py index 2f993a3..1e57d56 100644 --- a/src/zoom.py +++ b/src/zoom.py @@ -1,3 +1,5 @@ +offset_limit = 200 + def zoom_in(zoom): if zoom[0] > 128: zoom = (zoom[0] / 1.5, zoom[1] / 1.5) @@ -8,23 +10,27 @@ def zoom_out(zoom): zoom = (zoom[0] * 1.5, zoom[1] * 1.5) return zoom -def zoom_reset(zoom, offset): +def zoom_reset(): zoom = (1280.0, 720.0) offset = (0, 0) return zoom, offset def offset_up(offset): - offset = (offset[0], offset[1] - 10) + if offset[1] - 10 > -offset_limit: + offset = (offset[0], offset[1] - 10) return offset def offset_down(offset): - offset = (offset[0], offset[1] + 10) + if offset[1] + 10 < offset_limit: + offset = (offset[0], offset[1] + 10) return offset def offset_left(offset): - offset = (offset[0] - 10, offset[1]) + if offset[0] - 10 > -(offset_limit * 16/9): + offset = (offset[0] - 10, offset[1]) return offset def offset_right(offset): - offset = (offset[0] + 10, offset[1]) + if offset[0] + 10 < offset_limit * 16/9: + offset = (offset[0] + 10, offset[1]) return offset
\ No newline at end of file |