File tree Expand file tree Collapse file tree 3 files changed +7
-4
lines changed
Expand file tree Collapse file tree 3 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ def __init__(
3030 layers : list [LayerT | LayerLike | dict ] = None ,
3131 controls : list [ControlT | dict ] = None ,
3232 ):
33- self ._initial_view = view
33+ self ._initial_view_state = view . to_dict ( exclude = "type" , exclude_none = True )
3434 self .calls = []
3535 if layers is None :
3636 layers = [TileLayer (id = "osm" , source = OSM ())]
@@ -40,8 +40,8 @@ def __init__(
4040 ).model_dump ()
4141
4242 @property
43- def initial_view (self ):
44- return self ._initial_view
43+ def initial_view_state (self ):
44+ return self ._initial_view_state
4545
4646 # 'apply_call_to_map'
4747 def add_call (self , method_name : str , * args : Any ) -> None :
Original file line number Diff line number Diff line change @@ -7,6 +7,9 @@ class OLBaseModel(BaseModel):
77 def model_dump (self , ** kwargs ) -> dict :
88 return super ().model_dump (exclude_none = True , by_alias = True , ** kwargs )
99
10+ def to_dict (self , * args , ** kwargs ) -> dict :
11+ return super ().model_dump (* args , ** kwargs )
12+
1013 @computed_field (alias = "@@type" )
1114 def type (self ) -> str :
1215 return type (self ).__name__
Original file line number Diff line number Diff line change @@ -13,4 +13,4 @@ def test_map() -> None:
1313 print (m .options )
1414 assert m .options ["view" ] == view .model_dump ()
1515
16- assert m .initial_view . center == (2 , 2 )
16+ assert m .initial_view_state [ " center" ] == (2 , 2 )
You can’t perform that action at this time.
0 commit comments