OpenLayers OpenLayers

Ticket #228 (closed feature: fixed)

Opened 4 years ago

Last modified 3 years ago

limit panning to maxExtent

Reported by: tschaub Assigned to: euzuro
Priority: major Milestone: 2.2 Release
Component: general Version:
Keywords: Cc:
State:

Description

It seems to me that maxExtent should mean the maximum extent to which the map can be panned. Currently, only the center of the map has to fall within the maxExtent. I'll follow up with a patch that changes this behavior if a maxExtent is defined.

Also, I've added a couple methods that are part of my overarching plan to never have to deal with zoom ever again. Of course, they do nothing if you want to use zoom - but I'm hoping that I can put together a map in a zoom agnostic way (using resolution or scale instead). These methods are required by the above feature.

Don't anticipate you'll accept it wholesale, but I thought you'd consider it at least.

Attachments

limit_panning.patch (5.4 kB) - added by tschaub on 08/31/06 18:30:02.
patch to limit panning to maxExtent
limit_panning.2.patch (6.5 kB) - added by tschaub on 09/01/06 11:05:06.
patch to limit panning to maxExtent (replaces previous patch)
limit_panning.3.patch (6.4 kB) - added by tschaub on 09/05/06 12:33:59.
patch to limit panning to maxExtent (replaces previous patch)
calculatebounds.js (3.0 kB) - added by euzuro on 10/16/06 16:00:06.
calculatebounds.patch (3.0 kB) - added by euzuro on 10/16/06 16:05:23.
sorry. last one was .js instead of .patch

Change History

08/31/06 18:30:02 changed by tschaub

  • attachment limit_panning.patch added.

patch to limit panning to maxExtent

09/01/06 10:20:24 changed by tschaub

would that I could delete my own submitted patches - the one above does funky things when the map starts outside the maxExtent...

09/01/06 11:05:06 changed by tschaub

  • attachment limit_panning.2.patch added.

patch to limit panning to maxExtent (replaces previous patch)

09/01/06 17:48:26 changed by tschaub

example of panning limited by maxExtent: http://dev.geocartic.com/openlayers/examples/example.html (with 2nd patch above)

09/04/06 17:05:43 changed by tschaub

In case anybody tries to use this patch (the 2nd one) - note that the maxCenter definition (line 581 in the patch) should really appear after the check for maxExtent != null.

How's that for sloppy patching?

09/05/06 12:33:59 changed by tschaub

  • attachment limit_panning.3.patch added.

patch to limit panning to maxExtent (replaces previous patch)

09/05/06 12:36:31 changed by tschaub

Ok, don't know if I should keep creating patches. A better solution to the setCenter correction is in the third patch. This solves some jitter action in the previous patch.

09/14/06 10:11:57 changed by crschmidt

  • milestone changed from 2.1 Release to 2.2 Release.

10/02/06 11:01:21 changed by sderle

  • priority changed from minor to major.

10/06/06 14:21:33 changed by euzuro

  • owner set to euzuro.
  • status changed from new to assigned.

10/16/06 15:48:40 changed by openlayers

So I have reviewed this patch and I think there are a couple of things in here worth getting into the 2.2 release, if only so that tschaub doesnt have to keep patching things up to get the maxExtent behaviour he desires.

After brief discussion with the PSC, we have decided that the actual limiting of panning to respect maxExtent (as detailed in #340) should be allowed a more thorough discussion -- which we don't have time for right now -- and thus we are going to push that back into the 2.3 release milestone.

10/16/06 15:49:07 changed by openlayers

One feature I think is worth adding:

  • calculateBounds from center, resolution: Provide a method that allows a user to calculate an extent based on a center point and a resolution. This has nothing to do with layer, so I have moved it out of the getExtent() function in Layer.js and into Map.js as a function called 'calculateBounds()' as the only variable it ultimately depends on is the map size. Conveniently, we can now simplify OpenLayer.Layer.getExtent() to simply call calculateBounds() with no arguments (defaults are map's center & resolution)

patch forthcoming

10/16/06 16:00:06 changed by euzuro

  • attachment calculatebounds.js added.

10/16/06 16:05:23 changed by euzuro

  • attachment calculatebounds.patch added.

sorry. last one was .js instead of .patch

10/16/06 16:19:53 changed by euzuro

So originally I was also going to bring over the

getResolutionFromZoom() modification

which allows user to specify a zoom level.

I would like to offer this functionality, but at least right now, we cannot put that fix in, because not all baselayers can support this functionality. baselayers whose resolutions arrays we calculate can of course do this and without problem, but the whole idea behind the FixedZoomLevels functionality in use by 3rd party baselayers like google, ve, etc is that we *dont*know* the resolutions array and rather try to work around it.

if anyone has some comments on this, please chime in.

10/18/06 04:35:41 changed by euzuro

looks like the calculatebounds.patch went in at r1702

10/18/06 10:50:27 changed by crschmidt

  • milestone changed from 2.2 Release to 2.3 Release.

Yep. CalculateBounds went in in r1702, Which means the rest of this can be bumped to 2.3.

10/18/06 12:06:08 changed by euzuro

  • status changed from assigned to closed.
  • resolution set to fixed.
  • milestone changed from 2.3 Release to 2.2 Release.
  • i have made a new ticket #353 to handle the dangling getResolutionFromZoom() debate.
  • the maxExtent debate is (and has been) relegated to #340.
  • I am closing this ticket before it gets any nastier :-)