Ticket #3138 (closed bug: fixed)

Opened 2 years ago

Last modified 2 years ago

Restricted extends don't work anymore

Reported by: sbrunner Owned by: ahocevar
Priority: critical Milestone: 2.11 Release
Component: general Version: 2.10
Keywords: Cc: courriel@…
State: Commit

Description

The restricted extends don't work anymore, in this example:  http://dev.openlayers.org/sandbox/sbrunner/restricted-extent/examples/restricted-extent.html

We can't drag the map left-right when we are on zoom level 3 and higher...

Attachments

openlayers-3138.patch Download (3.7 KB) - added by ahocevar 2 years ago.

Change History

Changed 2 years ago by sbrunner

  • cc courriel@… added
  • type changed from feature to bug

Changed 2 years ago by ahocevar

  • state changed from Needs More Work to Awaiting User Feedback

Works for me on trunk. Can you please verify by trying http://openlayers.org/dev/examples/restricted-extent.html and close the ticket when it works?

Changed 2 years ago by sbrunner

Hello,

This example effectively work, I think it's because the restricted extends is to big or almost the sans than the projection extent.

In the sandbox I just reduce it to produce the bug...

CU, Stéphane

Changed 2 years ago by ahocevar

  • state Awaiting User Feedback deleted

You are right, I can see the wrong behavior now also on the spherical-mercator example. Are you working on a fix, or should I look into it?

Changed 2 years ago by sbrunner

I just Have a look, and it seem that there is a problem with the new minpx introduce with your great patch #3062, I think that there is a problem in Map.js near line 1820. I'd like that you have a look.

CU, Stéphane

Changed 2 years ago by ahocevar

  • owner set to ahocevar
  • status changed from new to assigned

You are right. The problem is that minPx and maxPx has to be the maxExtent, not the restrictedExtent. Patch to come in a few minutes.

Changed 2 years ago by ahocevar

Changed 2 years ago by ahocevar

  • state set to Review

There were actually two issues:

  • Now that we use restrictedExtent for Map.minPx and Map.maxPx calculation, we also need the restrictedExtent in Layer.getLonLatFromViewPortPx.
  • The valid extent check in Map::moveByPx only worked when baseLayer.wrapDateLine was false. I rewrote this check a bit to make it simpler, and added proper wrapDateLine handling.

Tests still pass, and examples work as expected. Thanks for any review.

Changed 2 years ago by bartvde

  • state changed from Review to Commit

This looks good to me, I've confirmed tests pass in FF 3.6 and Safari 5.

Another issue came up during testing but this is addressed in a new ticket:3144

Please commit.

Changed 2 years ago by ahocevar

  • status changed from assigned to closed
  • resolution set to fixed

(In [11607]) fixing restrictedExtent check in moveByPx. r=bartvde (closes #3138)

Note: See TracTickets for help on using tickets.