[Bug] Scroll zoom stops short of maxZoom in controlled mode with MapLibre
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- Mezza giornata
- Idoneità per principianti
- 74/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- react, typescript
Direzione di ricerca
Start at the controlled viewState and onMove handling in the react-map-gl Map component, then trace how scroll zoom updates are passed back to MapLibre. Compare the controlled path with the uncontrolled behavior using the provided reproduction and check the final zoom against maxZoom. Done means both trackpad and wheel scrolling reach exactly 18 in controlled mode.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Description
With a controlled Map from react-map-gl/maplibre, using the {...viewState} / onMove={evt => setViewState(evt.viewState)} pattern from the state management docs, scrolling in never reaches maxZoom:
A continuous trackpad scroll stops at about maxZoom - 0.015 (17.984640764116154 with maxZoom: 18).
Mouse wheel scrolling stops at 17.999999999999996.
Because the zoom never reaches maxZoom, layers with minzoom equal to maxZoom never show, and layers with maxzoom equal to maxZoom never hide. For example, a heatmap that should switch to markers at the maximum zoom never switches.
The same map in uncontrolled mode (initialViewState), and plain MapLibre without react-map-gl, both reach exactly 18.
Expected Behavior
Scroll zoom reaches maxZoom exactly, the same as in uncontrolled mode and in plain MapLibre.
Steps to Reproduce
import { useState } from 'react';
import Map from 'react-map-gl/maplibre';
import 'maplibre-gl/dist/maplibre-gl.css';
const mapStyle = { version: 8, sources: {}, layers: [] };
export function Controlled() {
const [viewState, setViewState] = useState({
longitude: -3.16,
latitude: 51.5,
zoom: 15,
});
return (
<Map
{...viewState}
onMove={(evt) => setViewState(evt.viewState)}
maxZoom={18}
mapStyle={mapStyle}
style={{ width: 600, height: 400 }}
/>
);
}
export function Uncontrolled() {
return (
<Map
initialViewState={{ longitude: -3.16, latitude: 51.5, zoom: 15 }}
maxZoom={18}
mapStyle={mapStyle}
style={{ width: 600, height: 400 }}
/>
);
}
- Render
Controlled. - Scroll in continuously (two-finger trackpad scroll, or a mouse wheel) until the map stops zooming.
- Read
mapRef.current.getMap().getZoom(): it is below 18. - Repeat with
Uncontrolled: the zoom reaches exactly 18.
Results from scripted WheelEvents dispatched on the map canvas. "Trackpad" means 400 events of deltaY about −2.5 to −4, 16 ms apart, with no pause. "Wheel" means 60 events of deltaY: -100, 50 ms apart.
| Setup | Trackpad | Wheel |
|---|---|---|
| react-map-gl, controlled | 17.984640764116154 | 17.999999999999996 |
| react-map-gl, uncontrolled | 18 | 18 |
| maplibre-gl only, no react-map-gl | 18 | not run |
I see the same in an app with real ⌘ + two-finger trackpad scrolling. Lifting the fingers and scrolling again then reaches 18.
Environment
- Framework version: react-map-gl 8.1.3 (
@vis.gl/react-maplibre8.1.3), React 19.3.0 - Map library: maplibre-gl 6.15.0
- Browser: Chrome 156
- OS: macOS 27.2
Logs
No response
- Lingua principale
- TypeScript
- Stelle
- 8.5k
- Fork
- 1.3k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di visgl/react-map-gl
-
DEFAULT_SETTINGS.maxBounds in @vis.gl/react-maplibre has 360° longitude span, triggers maplibre-gl-js#6148 crash via _updateSettings fallbackForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
visgl/react-map-gl#2591 · 2 commenti ·
-
[Bug] Mapbox geocoder example crashes: "i is not a function"Forse già presa @yuiseki l’ha presa 20 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 35/100
visgl/react-map-gl#2628 ·
-
[Bug] reuseMaps: Mapbox.reuse() infinite-loops (tab freeze) when the recycled map's container is the mount containerForse già presa @mikeyfarina l’ha presa 82 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
visgl/react-map-gl#2613 ·
-
feature
Difficoltà 5/5 Più di una settimana Idoneità per principianti 42/100
visgl/react-map-gl#2603 · 1 reazione ·
-
[Bug] Prop `style` does not unset properties that become `undefined`Forse già presa @MohammadYusif l’ha presa 140 giorni fa. Apertabug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 66/100
visgl/react-map-gl#2595 · 3 commenti ·
Tutte le issue di visgl/react-map-gl
Issue simili
-
accessibility area:ci ci-test level:low priority:high type:test
Difficoltà 2/5 1-3 ore Idoneità per principianti 71/100
skytuhua-org/Gen-V1#3132 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
drmrd/vernacular#1238 ·
I maintainer di solito rispondono entro 1 giorno
-
question
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
enhancement migration-prioritized
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
Hudson-Pufferfish/local-party-console#136 ·
I maintainer di solito rispondono entro 1 giorno
-
priority:medium
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno