Skip to content

Commit ebafe4b

Browse files
Fix dimension selector (#1208)
If the player was not in the default default dimension the selector would show an incorrect value.
1 parent 7d4f0c8 commit ebafe4b

File tree

1 file changed

+4
-2
lines changed
  • amulet_map_editor/programs/edit/api/ui

1 file changed

+4
-2
lines changed

amulet_map_editor/programs/edit/api/ui/file.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def set_speed(evt):
8282
self._dim_options = SimpleChoiceAny(canvas)
8383
self._dim_options.SetToolTip(lang.get("program_3d_edit.file_ui.dim_tooltip"))
8484
self._dim_options.SetItems(level.level_wrapper.dimensions)
85-
self._dim_options.SetValue(level.level_wrapper.dimensions[0])
85+
self._set_dimension(canvas.dimension)
8686
self._dim_options.Bind(wx.EVT_CHOICE, self._on_dimension_change)
8787

8888
self.Add(self._dim_options, 0, wx.TOP | wx.BOTTOM | wx.RIGHT | wx.CENTER, 5)
@@ -172,7 +172,9 @@ def _change_dimension(self, evt: DimensionChangeEvent):
172172
"""Run when the dimension attribute in the canvas is changed.
173173
This is run when the user changes the attribute and when it is changed manually in code.
174174
"""
175-
dimension = evt.dimension
175+
self._set_dimension(evt.dimension)
176+
177+
def _set_dimension(self, dimension: str) -> None:
176178
index = self._dim_options.FindString(dimension)
177179
if not (index == wx.NOT_FOUND or index == self._dim_options.GetSelection()):
178180
self._dim_options.SetSelection(index)

0 commit comments

Comments
 (0)