From 5cc29e2bce713c413b0c25f57e65f76b97b64bad Mon Sep 17 00:00:00 2001 From: JayTheBusinessGoose Date: Sat, 23 Dec 2023 09:58:05 -0700 Subject: [PATCH] Add zoom slider to the single room editor. --- .../vanilla_levels/vanilla_level_editor.py | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/modlunky2/ui/levels/vanilla_levels/vanilla_level_editor.py b/src/modlunky2/ui/levels/vanilla_levels/vanilla_level_editor.py index c06eea008..d5479e77e 100644 --- a/src/modlunky2/ui/levels/vanilla_levels/vanilla_level_editor.py +++ b/src/modlunky2/ui/levels/vanilla_levels/vanilla_level_editor.py @@ -368,6 +368,37 @@ def toggle_panel_hidden(): self.editor_tab.columnconfigure(7, minsize=50) self.editor_tab.columnconfigure(8, minsize=0) + self.current_zoom_value = tk.DoubleVar() + + def zoom_changed(_): + self.mag = int(self.current_zoom_value.get()) + for tile in self.tile_palette_ref_in_use: + tile_name = tile[0].split(" ", 2)[0] + tile[1] = ImageTk.PhotoImage( + self.texture_fetcher.get_texture( + tile_name, + self.lvl_biome, + self.lvl, + self.mag, + ) + ) + self.canvas.set_zoom(self.mag) + self.room_select(None) + + self.slider_zoom = tk.Scale( + self.editor_tab, + from_=2, + to=100, + length=300, + orient="horizontal", + variable=self.current_zoom_value, + command=zoom_changed, + showvalue=0, + width=17, + ) + self.slider_zoom.set(self.mag) + self.slider_zoom.grid(row=0, column=6, sticky="nw", padx=2) + self.level_settings_bar = LevelSettingsBar(self.editor_tab, self.setting_flip) self.level_settings_bar.grid(row=4, column=1, columnspan=8, sticky="news")