make axis length configurable
This commit is contained in:
parent
3d002eebf8
commit
594a5c5359
@ -16,8 +16,9 @@ class SketchWidget:
|
|||||||
self.size = (1, 1)
|
self.size = (1, 1)
|
||||||
|
|
||||||
# Configuration parameters
|
# Configuration parameters
|
||||||
self.line_size = 0.8
|
self.line_width = 0.8
|
||||||
self.axis_size = 1.8
|
self.axis_width = 1.8
|
||||||
|
self.axis_length = 50
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# try double-buffered
|
# try double-buffered
|
||||||
@ -86,9 +87,9 @@ class SketchWidget:
|
|||||||
|
|
||||||
for shape in self.sketch:
|
for shape in self.sketch:
|
||||||
if isinstance(shape, Line):
|
if isinstance(shape, Line):
|
||||||
self.drawLine(shape, self.line_size)
|
self.drawLine(shape, self.line_width)
|
||||||
elif isinstance(shape, Circle):
|
elif isinstance(shape, Circle):
|
||||||
self.drawCircle(shape, self.line_size)
|
self.drawCircle(shape, self.line_width)
|
||||||
|
|
||||||
if gldrawable.is_double_buffered():
|
if gldrawable.is_double_buffered():
|
||||||
gldrawable.swap_buffers()
|
gldrawable.swap_buffers()
|
||||||
@ -171,6 +172,8 @@ class SketchWidget:
|
|||||||
glPushAttrib(GL_CURRENT_BIT)
|
glPushAttrib(GL_CURRENT_BIT)
|
||||||
glColor(1.0, 0.4, 0.4, 1.0)
|
glColor(1.0, 0.4, 0.4, 1.0)
|
||||||
cx, cy = self.ptToScreenPt((0, 0))
|
cx, cy = self.ptToScreenPt((0, 0))
|
||||||
self.drawFilledLine(cx - 25, cy, cx + 25, cy, self.axis_size)
|
self.drawFilledLine(cx - self.axis_length, cy,
|
||||||
self.drawFilledLine(cx, cy - 25, cx, cy + 25, self.axis_size)
|
cx + self.axis_length, cy, self.axis_width)
|
||||||
|
self.drawFilledLine(cx, cy - self.axis_length,
|
||||||
|
cx, cy + self.axis_length, self.axis_width)
|
||||||
glPopAttrib()
|
glPopAttrib()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user