Skip to content

Commit 8b7c4fd

Browse files
committed
SmoothWheelZoomプラグインを導入
1 parent 6f7b9dc commit 8b7c4fd

3 files changed

Lines changed: 13 additions & 0 deletions

File tree

package-lock.json

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
},
3131
"dependencies": {
3232
"leaflet": "^1.9.4",
33+
"leaflet-smooth-zoom": "github:mutsuyuki/Leaflet.SmoothWheelZoom",
3334
"react": "^19.2.4",
3435
"react-dom": "^19.2.4",
3536
"react-leaflet": "^5.0.0",

src/pages/MapPage.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import {
2222
} from "../markers";
2323
import { searchItems, type SearchableItem } from "../search";
2424
import { getBuildingCenter } from "../buildings";
25+
import "leaflet-smooth-zoom/SmoothWheelZoom.js";
2526

2627
const imgWidth = 4000;
2728
const imgHeight = 2800;
@@ -226,6 +227,11 @@ export function MapPage() {
226227
center={[imgHeight / 2, imgWidth / 2]}
227228
zoom={-1}
228229
className="w-full h-full"
230+
scrollWheelZoom={false}
231+
// @ts-expect-error https://github.com/mutsuyuki/Leaflet.SmoothWheelZoom プラグインで提供されるオプション
232+
smoothWheelZoom={true}
233+
smoothSensitivity={5}
234+
zoomSnap={0}
229235
>
230236
<ImageOverlay url={Komabamap} bounds={bounds} />
231237
<MapController

0 commit comments

Comments
 (0)