question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Openlayers6 cannot drag/scroll map

See original GitHub issue

https://codesandbox.io/s/open-layers-drag-fix-2prs0?file=/src/Map.js

Note that you cannot drag/scroll map with mouse or trackpad.

I found that if you unset position: absolute from class=ol-unselectable ol-layers (the first div under the viewport div) it’ll become draggable.

Is this a bug in the way the map is set up? Is there a way to override that style if necessary? Or am I doing something wrong?

[Edit] it seems that if you remove position: absolute from any of the child divs of class=ol-viewport it’ll become draggable

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
jeroenvheelcommented, Jun 29, 2020

@orpheus I don’t know why we need to add it.is saw this issue a few times in the issues after v6.2.1 and the maintainers said they needed to add the ol.css.

1reaction
ahocevarcommented, Jun 29, 2020

In the examples we import ol.css as first line in index.js:

import 'ol/ol.css';

That said, including ol.css will be optional again in the upcoming 6.4 release. See #10932, which this issue is a duplicate of.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Openlayers unable to vertically scroll page when touch and ...
However, I would like to be able to vertically scroll the browser page down by pressing & dragging the map so the user...
Read more >
Panning and page scrolling - OpenLayers
Shows a map that allows page scrolling unless two fingers or Cmd/Ctrl are used to pan the map. This example shows a common...
Read more >
Problem with mouse zoom in Open Layers 6
But with mouse wheel it behaves strange, the map is zoomed out (despite restrictions) and when you stop it comes back to its...
Read more >
Openlayers draggable popups - musings of Aamir Afridi
Problem: Recently I have been working on Openlayers, vector features where the user can draw different vector features on the Openlayers map and...
Read more >
OpenLayers Plugin | JavaScript Maps SDK 1.2 Developer Guide
OpenLayers Version Support The ALK Maps plugin is tested with version 4.6.4 of OpenLayers. Support for other versions of OpenLayers cannot be guaranteed....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found