|
8 | 8 |
|
9 | 9 | import numpy as np |
10 | 10 |
|
11 | | -from traitlets import Enum, Float, Instance, List, Tuple, Unicode, observe |
| 11 | +from traitlets import Enum, Float, Instance, List, Tuple, Unicode |
12 | 12 |
|
13 | 13 | from ipywidgets import CallbackDispatcher, Color, DOMWidget, Image, widget_serialization |
14 | 14 |
|
@@ -71,6 +71,22 @@ class Canvas(DOMWidget): |
71 | 71 | default_value='source-over' |
72 | 72 | ) |
73 | 73 |
|
| 74 | + #: (float) Indicates the horizontal distance the shadow should extend from the object. |
| 75 | + #: This value isn't affected by the transformation matrix. The default is 0. |
| 76 | + shadow_offset_x = Float(0.0) |
| 77 | + |
| 78 | + #: (float) Indicates the vertical distance the shadow should extend from the object. |
| 79 | + #: This value isn't affected by the transformation matrix. The default is 0. |
| 80 | + shadow_offset_y = Float(0.0) |
| 81 | + |
| 82 | + #: (float) Indicates the size of the blurring effect; this value doesn't correspond to a number of pixels |
| 83 | + #: and is not affected by the current transformation matrix. The default value is 0. |
| 84 | + shadow_blur = Float(0.0) |
| 85 | + |
| 86 | + #: (valid HTML color) A standard CSS color value indicating the color of the shadow effect; by default, |
| 87 | + #: it is fully-transparent black. |
| 88 | + shadow_color = Color('rgba(0, 0, 0, 0)') |
| 89 | + |
74 | 90 | #: (float) Sets the width of lines drawn in the future, must be a positive number. Default to ``1.0``. |
75 | 91 | line_width = Float(1.0) |
76 | 92 |
|
@@ -428,7 +444,8 @@ def __setattr__(self, name, value): |
428 | 444 |
|
429 | 445 | canvas_attrs = ['fill_style', 'stroke_style', 'global_alpha', 'font', 'text_align', |
430 | 446 | 'text_baseline', 'direction', 'global_composite_operation', |
431 | | - 'line_width', 'line_cap', 'line_join', 'miter_limit', 'line_dash_offset'] |
| 447 | + 'line_width', 'line_cap', 'line_join', 'miter_limit', 'line_dash_offset', |
| 448 | + 'shadow_offset_x', 'shadow_offset_y', 'shadow_blur', 'shadow_color'] |
432 | 449 | if name in canvas_attrs: |
433 | 450 | command = { |
434 | 451 | 'name': 'set', |
|
0 commit comments