The map appeares in it's default view. If I try to navigate, or click on a pin placed on the map, it automatically jumps a bit towards Southwest and the navigation gets stuck there, not possible to move back. However, if I use the zoom first (or after it gets stuck), the problem will not show until I reload the page.
I use "restrict extent", have a default location and zoom level set up. There are two layers on the base map, and the issue appears regardless of which base map I use. I have the following behaviours enabled:

  • Cluster features
  • geofield
  • layer switcher
  • Mouse drag pan
  • Pop up for Features
  • Full screen
  • Zoom control

Is it a known bug? Any workaround or solution? Thank you in advance!

Comments

nod_’s picture

Can you track down which one is causing the bug ?

I'd try disabling popup and/or cluster.

thlor’s picture

Component: OL API » OL UI

I turned off/on each behaviour separately and checked. Then I turned everything but "Pop Up for Features" off (I left it on so I can click on something to reproduce the bug). None of these solved the problem. Even when no navigation by mouse, keyboard or nav icons was enabled, the map still got "dislocated" the same way, when I clicked to open a popup.
Still, if I hit the zoom button, the navigation goes back to normal, however I can not close those popus I opened when it got stuck.
Further details:

  • drupal 7.10
  • chaos tools 7.x-1.0-rc1
  • views 7.x-3.0
  • openlayers 7.x-2.0-beta1 (as noted)

Thanks a lot in advance, I really don't know where to go here.

thlor’s picture

Update:
Restrict extent it is. I took a fresh clone of the default Geofield Widget Map, changed nothing but added mouse navigation, the layers, set up a restrict extent rectangle and an initial map view (zoomed well inside the restrict extent boundries, obviously). With only these changes, the same issue appears. If I disable the extent restriction, it works fine.
For comparison with the vanilla Geofield Widget Map, here is the export of the foul version of it: http://pastebin.com/KEQDxfEc

nod_’s picture

Sweet! thanks for testing that'll save me some time.

I'll be using restrict extent very soon (tomorrow in fact) so i'll very likely bump into this. I'll get working on it then.

thlor’s picture

Lucky me! :) Please let us know if it happens to you too. Thanks!

FeBus982’s picture

I have same issue.

Don't know if it can help but there's something wrong about calculating coordinates on maps when restricted extent is active.

If i activate Behavior that shows mouse coordinates on a map showing full italy country ( Lon 6->18, Lat 37->47 ) i got Longitude going from 180 to 194 (ouch!) and Latitude going from -4 to +4.

After zooming coordinates are correctly computed.

I am using custom WMS Layers, projection 4326

FeBus982’s picture

Status: Active » Needs review

FIXED:
Something's wrong about setting Restricted Extent after zooming to the initial view.
modify file js/openlayers.js from line 196

    // Zoom & center
    if (map.center.initial) {
      var center = OpenLayers.LonLat.fromString(map.center.initial.centerpoint).transform(
            new OpenLayers.Projection('EPSG:4326'),
            new OpenLayers.Projection('EPSG:' + map.projection));
      var zoom = parseInt(map.center.initial.zoom, 10);
      openlayers.setCenter(center, zoom, false, false);
    }

    // Set the restricted extent if wanted.
    // Prevents the map from being panned outside of a specfic bounding box.
    if (typeof map.center.restrict !== 'undefined' && map.center.restrict.restrictextent) {
      openlayers.restrictedExtent = OpenLayers.Bounds.fromString(
          map.center.restrict.restrictedExtent);
    }

Invert the order so Restricted Extent is applied before zooming to initial view.

    // Set the restricted extent if wanted.
    // Prevents the map from being panned outside of a specfic bounding box.
    if (typeof map.center.restrict !== 'undefined' && map.center.restrict.restrictextent) {
      openlayers.restrictedExtent = OpenLayers.Bounds.fromString(
          map.center.restrict.restrictedExtent);
    }

    // Zoom & center
    if (map.center.initial) {
      var center = OpenLayers.LonLat.fromString(map.center.initial.centerpoint).transform(
            new OpenLayers.Projection('EPSG:4326'),
            new OpenLayers.Projection('EPSG:' + map.projection));
      var zoom = parseInt(map.center.initial.zoom, 10);
      openlayers.setCenter(center, zoom, false, false);
    }

Now this is going right. I'm on holyday (or I should be....) and can't produce a patch file here, hope someone will do it :P

mgifford’s picture

@FeBus982 Hope you had a great break. Also hoping you can roll up the patch as I assume you're back. Thanks!

zzolo’s picture

Status: Needs review » Fixed

Committed. Would be nice to get some further testing on this.

http://drupalcode.org/project/openlayers.git/commit/e6dfc41

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.