maplibre-gl-js icon indicating copy to clipboard operation
maplibre-gl-js copied to clipboard

app pans north if css is not imported

Open cyrfer opened this issue 1 year ago • 4 comments

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

  1. 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.

cyrfer avatar Nov 02 '23 22:11 cyrfer

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 avatar Nov 03 '23 04:11 HarelM

@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?

cyrfer avatar Nov 03 '23 18:11 cyrfer

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.

neodescis avatar Nov 03 '23 19:11 neodescis

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...

HarelM avatar Nov 03 '23 20:11 HarelM