Creates a custom pane to hold map elements. Behavior is as in https://leafletjs.com/examples/map-panes/ Parameters ---------- name: string Name of the custom pane. Other map elements can be added to the pane by specifying the 'pane' kwarg when constructing
| 750 | |
| 751 | |
| 752 | class CustomPane(MacroElement): |
| 753 | """ |
| 754 | Creates a custom pane to hold map elements. |
| 755 | |
| 756 | Behavior is as in https://leafletjs.com/examples/map-panes/ |
| 757 | |
| 758 | Parameters |
| 759 | ---------- |
| 760 | name: string |
| 761 | Name of the custom pane. Other map elements can be added |
| 762 | to the pane by specifying the 'pane' kwarg when constructing |
| 763 | them. |
| 764 | z_index: int or string, default 625 |
| 765 | The z-index that will be associated with the pane, and will |
| 766 | determine which map elements lie over/under it. The default |
| 767 | (625) corresponds to between markers and tooltips. Default |
| 768 | panes and z-indexes can be found at |
| 769 | https://leafletjs.com/reference.html#map-pane |
| 770 | pointer_events: bool, default False |
| 771 | Whether or not layers in the pane should interact with the |
| 772 | cursor. Setting to False will prevent interfering with |
| 773 | pointer events associated with lower layers. |
| 774 | """ |
| 775 | |
| 776 | _template = Template( |
| 777 | """ |
| 778 | {% macro script(this, kwargs) %} |
| 779 | var {{ this.get_name() }} = {{ this._parent.get_name() }}.createPane( |
| 780 | {{ this.name|tojson }}); |
| 781 | {{ this.get_name() }}.style.zIndex = {{ this.z_index|tojson }}; |
| 782 | {% if not this.pointer_events %} |
| 783 | {{ this.get_name() }}.style.pointerEvents = 'none'; |
| 784 | {% endif %} |
| 785 | {% endmacro %} |
| 786 | """ |
| 787 | ) |
| 788 | |
| 789 | def __init__( |
| 790 | self, |
| 791 | name: str, |
| 792 | z_index: Union[int, str] = 625, |
| 793 | pointer_events: bool = False, |
| 794 | ): |
| 795 | super().__init__() |
| 796 | self._name = "Pane" |
| 797 | self.name = name |
| 798 | self.z_index = z_index |
| 799 | self.pointer_events = pointer_events |
searching dependent graphs…