maplibre-gl-js
maplibre-gl-js copied to clipboard
app pans north if css is not imported
I wanted to understand what the CSS import affects.
If I don't import the CSS module, I see a map, but it pans north uncontrollably. Is that expected?
// comment to see an issue
import 'maplibre-gl/dist/maplibre-gl.css'
maplibre-gl-js version: 3.5.2
browser: OSX Chrome Version 118.0.5993.11
OS: Mac OSX Apple Silicon M1 Pro 13.5.2 (22G91)
Steps to Trigger Behavior
- do not import the CSS
Link to Demonstration
Here is a demo https://stackblitz.com/edit/react-maplibre-layer-issue-hm51f8?file=src%2FApp.tsx
and a repo to execute locally https://github.com/cyrfer-demos/react-maplibre-demo/blob/main/src/App.tsx#L7
Expected Behavior
The map does not pan north.
Actual Behavior
The map pans north.
CSS is an integral part of this library, it is unexpected what will happen if you don't load it. I'm not sure I understand why this is considered an issue...?
@HarelM I don't mean to cause a stir. Is there another forum where I can get answers to questions?
CSS, while integral to any web app, surprises me that it is required for appropriate pan behavior. I think most developers would be surprised to learn that CSS causes the pan feature to behave the way it does.
Can you explain what CSS has to do with panning?
I think what @HarelM means is that the CSS is an integral part of MapLibre. I would not necessarily expect the map to start panning when the CSS is not there, but it's also not really a "bug" or "issue" since running the map without the CSS isn't something that's supported.
I can say that I have run MapLibre before without the CSS (accidentally really), and I did not see it pan like that. It was some number of versions ago though. If you would like to investigate and create a pull request, we would be happy to review it for inclusion.
Is there another forum where I can get answers to questions?
You can use the discussions or the slack channel.
I'm not 100% familiar with all the CSS definitions, but there are some transform related stuff which I believe are relevant to panning if I needed to guess. Also markers stuff, which are html elements on top of the canvas need the CSS desperately...