diff --git a/app/api/main.py b/app/api/main.py index f3cec47..4b9c1a4 100644 --- a/app/api/main.py +++ b/app/api/main.py @@ -24,7 +24,12 @@ async def homepage(request: Request): Splashpage. """ - return settings.templates.TemplateResponse("pages/index.html", {"request": request}) + centre = complex(0.0, 0.0) + zoom = 0.5 + + return settings.templates.TemplateResponse( + "pages/index.html", {"request": request, "centre": centre, "zoom": zoom} + ) class MandelbrotInput(BaseModel): @@ -42,14 +47,14 @@ async def sample_mandelbrot(input: MandelbrotInput): return mandelbrot(complex(input.real, input.imag), input.max_iter) -@app.get("/mandelbrot_image/{real}/{imag}/{zoom}") -async def sample_mandelbrot_area(real: float, imag: float, zoom: float): +@app.get("/mandelbrot_image/{real}/{imag}/{zoom}/{res}") +async def sample_mandelbrot_area(real: float, imag: float, zoom: float, res: int): """ Evaluate an area of complex numbers. """ center = complex(real, imag) - resolution = (512, 512) + resolution = (res, res) levels = 80 red = Color("red") diff --git a/app/templates/components/controls.html b/app/templates/components/controls.html new file mode 100644 index 0000000..acc94c5 --- /dev/null +++ b/app/templates/components/controls.html @@ -0,0 +1,32 @@ + + + + + + + + + + diff --git a/app/templates/components/display.html b/app/templates/components/display.html index ddb6ab9..83fa3e6 100644 --- a/app/templates/components/display.html +++ b/app/templates/components/display.html @@ -1,11 +1,6 @@ diff --git a/app/templates/pages/index.html b/app/templates/pages/index.html index 631a442..107271a 100644 --- a/app/templates/pages/index.html +++ b/app/templates/pages/index.html @@ -2,5 +2,14 @@

WebApp

{% include "components/display.html" %}
+
{% include "components/controls.html" %}
+
{% include "components/keybindings.html" %}
+ + {% endblock %}