Adds a floating image in HTML canvas on top of the map. Parameters ---------- image: str Url to image location. Can also be an inline image using a data URI or a local file using `file://`. bottom: int, default 75 Vertical position from the bottom, as a perce
| 4 | |
| 5 | |
| 6 | class FloatImage(MacroElement): |
| 7 | """Adds a floating image in HTML canvas on top of the map. |
| 8 | |
| 9 | Parameters |
| 10 | ---------- |
| 11 | image: str |
| 12 | Url to image location. Can also be an inline image using a data URI |
| 13 | or a local file using `file://`. |
| 14 | bottom: int, default 75 |
| 15 | Vertical position from the bottom, as a percentage of screen height. |
| 16 | left: int, default 75 |
| 17 | Horizontal position from the left, as a percentage of screen width. |
| 18 | **kwargs |
| 19 | Additional keyword arguments are applied as CSS properties. |
| 20 | For example: `width='300px'`. |
| 21 | |
| 22 | """ |
| 23 | |
| 24 | _template = Template( |
| 25 | """ |
| 26 | {% macro header(this,kwargs) %} |
| 27 | <style> |
| 28 | #{{this.get_name()}} { |
| 29 | position: absolute; |
| 30 | bottom: {{this.bottom}}%; |
| 31 | left: {{this.left}}%; |
| 32 | {%- for property, value in this.css.items() %} |
| 33 | {{ property }}: {{ value }}; |
| 34 | {%- endfor %} |
| 35 | } |
| 36 | </style> |
| 37 | {% endmacro %} |
| 38 | |
| 39 | {% macro html(this,kwargs) %} |
| 40 | <img id="{{this.get_name()}}" alt="float_image" |
| 41 | src="{{ this.image }}" |
| 42 | style="z-index: 999999"> |
| 43 | </img> |
| 44 | {% endmacro %} |
| 45 | """ |
| 46 | ) |
| 47 | |
| 48 | def __init__(self, image, bottom=75, left=75, **kwargs): |
| 49 | super().__init__() |
| 50 | self._name = "FloatImage" |
| 51 | self.image = image |
| 52 | self.bottom = bottom |
| 53 | self.left = left |
| 54 | self.css = kwargs |
nothing calls this directly
no test coverage detected
searching dependent graphs…