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.

Disable centering of overviewmap control

See original GitHub issue

Is your feature request related to a problem? Please describe.

I am trying to customize the OverviewMap control, such that the overviewmap remains fixed (i.e., doesn’t zoom, shift, or rotate) when a user interacts with the main map.

The constructor of OverviewMap provides the rotateWithView parameter to enable/disable rotation of the overviewmap. It’s also possible to prevent zooming of the overview map, by only providing a single layer via layers. However, it doesn’t seem to be possible to disable re-centering (OverviewMap.recenter_()].

Describe the solution you’d like

I propose adding a center parameter to the constructor of OverviewMap (true by default), which when set to false would disable centering of the overviewmap relative to the box. In other words, I would like the box to move and the overviewmap to remain static.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
MoonEcommented, Sep 6, 2022

Unfortunately, I ran into another issue when trying it with my application, which uses WebGLTile and DataTileSource. If I provide a single resolution resolutions: [res], tile rendering fails here

@hackermd Please open a new issue for this. A short self-contained example would be helpful to reproduce this.

1reaction
MoonEcommented, Oct 14, 2021

Does this work?

new OverviewMap({
  view: new View({
    constrainOnlyCenter: true, 
    extent: [0, 0, 0, 0],
  },
})

Not tested.

Read more comments on GitHub >

github_iconTop Results From Across the Web

OpenLayers v7.1.0 API - Class: OverviewMap
Create a new control with a map acting as an overview map for another defined map. ... Remove the control from its current...
Read more >
Change the size of an OpenLayers.Control.OverviewMap
This seems to work: var ovMapControl = map.getControlsBy("CLASS_NAME", "OpenLayers.Control.OverviewMap")[0]; map.
Read more >
Overview Map to show always whole map - Stack Overflow
Specifying a overview map view with a single resolution and extent (i.e. center constraint) will work as long as the main map isn't...
Read more >
Disabling the Default UI | Maps JavaScript API
This example creates a map with the default UI controls disabled (for example, it has no zoom controls or Street View ... center:...
Read more >
Managing map's controls | OpenLayers Cookbook
OpenLayers comes with lots of controls to interact with the map: pan, zoom, show overview map, ... Add some layers to the map...
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