from kivy.app import App
from kivy.clock import Clock
from kivy_garden.mapview import MapMarkerPopup

from treepopupmenu import TreePopupMenu

class TreeMarker(MapMarkerPopup):
    tree_data = []
        
    def on_release(self):
        # Center the map first
        forestmap = App.get_running_app().root.ids.forestmapview
        forestmap.center_on(self.lat, self.lon)
        
        # Open the TreePopupMenu
        menu = TreePopupMenu(self.tree_data)
        menu.size_hint = [.8, .9]
        Clock.schedule_once(menu.open, 1)

    def update_forestmap_position(self):
        print("] New Forest Map POSITION", self.lat, self.lon)
