Skip to content

Commit

Permalink
Merge pull request #105 from Spiderpig02/develop
Browse files Browse the repository at this point in the history
fix: 🐛 Current dimensions of map are now displayed correctly.
  • Loading branch information
jmnorheim authored Sep 9, 2024
2 parents 9f23135 + 02ecc34 commit ce4e406
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion frontend/src/components/mapSizeSlider/MapSizeSlider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@ import "./MapSizeSlider.css";
import { mapSizeSliderSignal } from "../../pages/homePage/HomePage";
import { useSignal } from "@preact/signals-react";

const aspectRatio = 9 / 16;

const MapSizeSlider = () => {
const size = useSignal(mapSizeSliderSignal);
const height = Math.round(Number(size.value) * aspectRatio);

const handleSliderChange = (e: React.ChangeEvent<HTMLInputElement>) => {
mapSizeSliderSignal.value = parseInt(e.target.value);
Expand All @@ -13,7 +16,7 @@ const MapSizeSlider = () => {
return (
<div className="map-size-slider-container">
<label htmlFor="myRange" className="slider-label">
Adjust map size ({size.value}x{size.value})
Adjust map size ({size.value}x{height})
</label>
<input
type="range"
Expand Down

0 comments on commit ce4e406

Please sign in to comment.