Skip to content

Commit 48a5b7c

Browse files
committed
AxisStyle line width now depends on actual given thickness
1 parent f27c9a9 commit 48a5b7c

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

mathics/builtin/graphics.py

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2654,14 +2654,30 @@ def to_axis_style(self):
26542654
return AxisStyle(self)
26552655

26562656

2657-
class AxisStyle(Style):
2657+
class AxisStyle(object):
2658+
# used exclusively for graphics generated inside GraphicsBox.create_axes().
2659+
# wraps a Style instance for graphics and does not operate on local but on
2660+
# screen space, i.e. has to apply "local_to_screen" to all widths, sizes, ...
2661+
26582662
def __init__(self, style):
2659-
super(AxisStyle, self).__init__(style.graphics, style.edge, style.face)
2660-
self.styles = style.styles
2661-
self.options = style.options
2663+
self.base = Style(style.graphics)
2664+
self.base.extend(style)
2665+
self.sx = style.graphics.local_to_screen.matrix[0][0]
2666+
2667+
def extend(self, style, pre=True):
2668+
self.base.extend(style.base, pre)
2669+
2670+
def clone(self):
2671+
return AxisStyle(self.base.clone())
2672+
2673+
def get_style(self, *args, **kwargs):
2674+
return self.base.get_style(*args, **kwargs)
2675+
2676+
def get_option(self, name):
2677+
return self.base.get_option(name)
26622678

26632679
def get_line_width(self, face_element=True):
2664-
return 0.5
2680+
return self.base.get_line_width(face_element) * self.sx
26652681

26662682

26672683
def _flatten(leaves):

0 commit comments

Comments
 (0)