@@ -85,6 +85,12 @@ class Canvas(DOMWidget):
8585 #: Default to ``'miter'``
8686 line_join = Enum (['round' , 'bevel' , 'miter' ], default_value = 'miter' )
8787
88+ #: (float) Establishes a limit on the miter when two lines join at a sharp angle, to let you control how thick
89+ #: the junction becomes. Default to ``10.``.
90+ miter_limit = Float (10. )
91+
92+ _line_dash = List ()
93+
8894 def __init__ (self , * args , ** kwargs ):
8995 """Create a Canvas widget."""
9096 #: Whether commands should be cached or not
@@ -188,6 +194,19 @@ def stroke_text(self, text, x, y, max_width=None):
188194 """Stroke a given text at the given ``(x, y)`` position. Optionally with a maximum width to draw."""
189195 self ._send_canvas_command ('strokeText' , (text , x , y , max_width ))
190196
197+ # Line methods
198+ def get_line_dash (self ):
199+ """Return the current line dash pattern array containing an even number of non-negative numbers."""
200+ return self ._line_dash
201+
202+ def set_line_dash (self , segments ):
203+ """Set the current line dash pattern."""
204+ if len (segments ) % 2 :
205+ self ._line_dash = segments + segments
206+ else :
207+ self ._line_dash = segments
208+ self ._send_canvas_command ('setLineDash' , (self ._line_dash , ))
209+
191210 # Image methods
192211 def put_image_data (self , image_data , dx , dy ):
193212 """Draw an image on the Canvas.
@@ -280,7 +299,7 @@ def flush(self):
280299
281300 @observe ('fill_style' , 'stroke_style' , 'global_alpha' , 'font' , 'text_align' ,
282301 'text_baseline' , 'direction' , 'global_composite_operation' ,
283- 'line_width' , 'line_cap' , 'line_join' )
302+ 'line_width' , 'line_cap' , 'line_join' , 'miter_limit' )
284303 def _on_set_attr (self , change ):
285304 command = {
286305 'name' : 'set' ,
0 commit comments