Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/TurtleArtActivity.py
diff options
context:
space:
mode:
authorWalter Bender <walter.bender@gmail.com>2011-03-08 03:55:04 (GMT)
committer Walter Bender <walter.bender@gmail.com>2011-03-08 03:55:04 (GMT)
commit3e898b8b42b8e930e7e33fcfd89d9a4fafcbd18a (patch)
treeef16e4b765b4fa8dcfa1e52656b5b01bbe76e2c6 /TurtleArtActivity.py
parentc7f797c6ba264c9ec0754da7406b62b176752e53 (diff)
force scaling to predefined constants to fix pixel alignment problems (#2442)
Diffstat (limited to 'TurtleArtActivity.py')
-rw-r--r--TurtleArtActivity.py19
1 files changed, 14 insertions, 5 deletions
diff --git a/TurtleArtActivity.py b/TurtleArtActivity.py
index 21a9480..3826e13 100644
--- a/TurtleArtActivity.py
+++ b/TurtleArtActivity.py
@@ -44,7 +44,7 @@ import os.path
import tarfile
from TurtleArt.tapalette import palette_names, help_strings
-from TurtleArt.taconstants import OVERLAY_LAYER, ICON_SIZE
+from TurtleArt.taconstants import OVERLAY_LAYER, ICON_SIZE, BLOCK_SCALE
from TurtleArt.taexporthtml import save_html
from TurtleArt.taexportlogo import save_logo
from TurtleArt.tautils import data_to_file, data_to_string, data_from_string, \
@@ -343,15 +343,24 @@ class TurtleArtActivity(activity.Activity):
def do_grow_blocks_cb(self, button):
""" Grow the blocks. """
- self.do_resize_blocks(1.5)
+ self.do_resize_blocks(1)
def do_shrink_blocks_cb(self, button):
""" Shrink the blocks. """
- self.do_resize_blocks(0.67)
+ self.do_resize_blocks(-1)
- def do_resize_blocks(self, scale_factor):
+ def do_resize_blocks(self, inc):
""" Scale the blocks. """
- self.tw.block_scale *= scale_factor
+ if self.tw.block_scale in BLOCK_SCALE:
+ i = BLOCK_SCALE.index(self.tw.block_scale) + inc
+ else:
+ i = 2.0
+ if i < 0:
+ self.tw.block_scale = BLOCK_SCALE[0]
+ elif i == len(BLOCK_SCALE):
+ self.tw.block_scale = BLOCK_SCALE[-1]
+ else:
+ self.tw.block_scale = BLOCK_SCALE[i]
self.tw.resize_blocks()
def do_cartesian_cb(self, button):