diff options
author | László Németh <laszlo.nemeth@collabora.com> | 2015-05-18 02:43:45 +0200 |
---|---|---|
committer | László Németh <laszlo.nemeth@collabora.com> | 2015-05-18 02:46:17 +0200 |
commit | 2ca7795a6a723c701f295323fcc3f6c52ad37976 (patch) | |
tree | 16ff0e55f08e4a529135ece3fea2459b0860ec32 /librelogo/source | |
parent | 1a2479c93a013ba2d67319849869693bd01cf1ad (diff) |
LibreLogo: CLOSE closes, FILL fills points, too
Example: drawing square within a circle:
PENUP
REPEAT 4 [
FORWARD 100
POINT
BACK 100
RIGHT 360/4
] FILL
CIRCLE 200
Change-Id: Ica3ce44306fc985717ff73e8a3dec5dddf69f19b
Diffstat (limited to 'librelogo/source')
-rw-r--r-- | librelogo/source/LibreLogo/LibreLogo.py | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/librelogo/source/LibreLogo/LibreLogo.py b/librelogo/source/LibreLogo/LibreLogo.py index 6229c15d66a6..327648c31eb6 100644 --- a/librelogo/source/LibreLogo/LibreLogo.py +++ b/librelogo/source/LibreLogo/LibreLogo.py @@ -103,6 +103,7 @@ class __Doc__: self.fontheight = 12 self.fontweight = 100 self.fontstyle = 0 + self.points = [] from math import pi, sin, cos, asin, sqrt, log10 @@ -930,6 +931,8 @@ def __go__(shapename, n, dot = False, preciseAngle = -1): return if not _.pen and not dot: return + if _.pen and not dot: + _.points = [] # new line drawing: forget the points shape = __draw__("PolyLineShape") shape.RotateAngle = 0 shape.PolyPolygon = tuple([tuple([__Point__(0, 0)])]) @@ -964,8 +967,21 @@ def __go__(shapename, n, dot = False, preciseAngle = -1): def __fillit__(filled = True): oldshape = __getshape__(__ACTUAL__) - if oldshape and oldshape.LineStartCenter: - __removeshape__(__ACTUAL__) # FIXME close dotted polyline + if (oldshape and oldshape.LineStartCenter) or _.points: + if oldshape: + __removeshape__(__ACTUAL__) # FIXME close dotted polyline + if _.points: + p = position() + h = heading() + for i in _.points: + position(i) + __pen__(1) + __checkhalt__() + _.points = [] + __fillit__(filled) + __pen__(0) + position(p) + heading(h) return if oldshape and "LineShape" in oldshape.ShapeType: shape = __draw__("PolyPolygonShape", False) @@ -1016,6 +1032,7 @@ def point(): oldstyle, _.linestyle = _.linestyle, __LineStyle_DOTTED__ __go__(__TURTLE__, 0, True) _.pen, _.linestyle = oldpen, oldstyle + _.points.append(position()) def __boxshape__(shapetype, l): turtle = __getshape__(__TURTLE__) |