Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -108,6 +108,16 @@ if st.session_state["layout_image"] is None:
|
|
108 |
st.session_state["layout_image"] = layout_image
|
109 |
st.session_state["canvas"] = canvas
|
110 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
# Sidebar Controls
|
112 |
st.sidebar.title("Map Controls")
|
113 |
if st.sidebar.button("💾 Save Map"):
|
@@ -124,29 +134,14 @@ if st.sidebar.button("🗺️ Regenerate Map"):
|
|
124 |
st.session_state["canvas"] = canvas
|
125 |
st.rerun()
|
126 |
|
127 |
-
# Zoom
|
128 |
st.sidebar.title("Zoom")
|
129 |
-
show_zoomed = st.sidebar.checkbox("Show Zoomed Version")
|
130 |
zoom_level = st.sidebar.slider("Zoom Level", min_value=0.5, max_value=2.0, value=1.0, step=0.1)
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
buffer.seek(0)
|
140 |
-
st.image(
|
141 |
-
buffer,
|
142 |
-
caption=f"Zoomed Dungeon Map Layout (Zoom Level: {zoom_level}x)",
|
143 |
-
use_container_width=False,
|
144 |
-
output_format="PNG",
|
145 |
-
)
|
146 |
-
else:
|
147 |
-
st.image(
|
148 |
-
st.session_state["layout_image"],
|
149 |
-
caption="Generated Dungeon Map Layout",
|
150 |
-
use_container_width=True,
|
151 |
-
output_format="PNG",
|
152 |
-
)
|
|
|
108 |
st.session_state["layout_image"] = layout_image
|
109 |
st.session_state["canvas"] = canvas
|
110 |
|
111 |
+
# Display map with scroll and zoom controls
|
112 |
+
if st.session_state["layout_image"] is not None:
|
113 |
+
st.image(
|
114 |
+
st.session_state["layout_image"],
|
115 |
+
caption="Generated Dungeon Map Layout",
|
116 |
+
use_container_width=True,
|
117 |
+
output_format="PNG",
|
118 |
+
clamp=True,
|
119 |
+
)
|
120 |
+
|
121 |
# Sidebar Controls
|
122 |
st.sidebar.title("Map Controls")
|
123 |
if st.sidebar.button("💾 Save Map"):
|
|
|
134 |
st.session_state["canvas"] = canvas
|
135 |
st.rerun()
|
136 |
|
137 |
+
# Zoom controls
|
138 |
st.sidebar.title("Zoom")
|
|
|
139 |
zoom_level = st.sidebar.slider("Zoom Level", min_value=0.5, max_value=2.0, value=1.0, step=0.1)
|
140 |
+
st.image(
|
141 |
+
st.session_state["layout_image"],
|
142 |
+
caption="Zoomed Dungeon Map Layout",
|
143 |
+
use_container_width=False,
|
144 |
+
output_format="PNG",
|
145 |
+
clamp=True,
|
146 |
+
width=int(canvas_size * zoom_level),
|
147 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|