Add a panDuration property to the map. This allows for a workaround for

VirtualEarth panning with markers which causes drift, using the 'novibrate'
example. Tests continue to pass. r=me (Closes #1947)


git-svn-id: http://svn.openlayers.org/trunk/openlayers@9130 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2009-03-24 21:38:57 +00:00
parent 807706219b
commit 05658f1231
2 changed files with 72 additions and 1 deletions

View File

@@ -0,0 +1,62 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>OpenLayers Virtual Earth Example</title>
<link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
<link rel="stylesheet" href="style.css" type="text/css" />
<script src='http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.1'></script>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript">
var map, velayer, layer;
function init(){
map = new OpenLayers.Map('map', {
controls: [new OpenLayers.Control.Navigation()],
panMethod: OpenLayers.Easing.Linear.easeOut,
panDuration: 10
});
velayer = new OpenLayers.Layer.VirtualEarth("VE", {
minZoomLevel: 2,
maxZoomLevel: 6,
type: VEMapStyle.Road
});
map.addLayer(velayer);
map.setCenter(new OpenLayers.LonLat(25, 25), 0);
map.addControl( new OpenLayers.Control.PanZoomBar() );
markers = new OpenLayers.Layer.Markers("markers");
map.addLayer(markers);
for(var i=0;i<100;i++){
var lat= Math.floor(Math.random()*50);
var lon= Math.floor(Math.random()*50);
var lonLat=new OpenLayers.LonLat(lon,lat);
var marker=new OpenLayers.Marker(lonLat);
markers.addMarker(marker);
}
}
</script>
</head>
<body onload="init()">
<h1 id="title">Virtual Earth Example</h1>
<div id="tags"></div>
<p id="shortdesc">
When using the PanZoom buttons with VirtualEarth, some 'drift' is
possible in markers. This page demonstrates how to use the
panMethod and panDuration properties to change the OpenLayers
settings to match VirtualEarth.
</p>
<div id="map" class="smallmap"></div>
</body>
</html>

View File

@@ -384,6 +384,15 @@ OpenLayers.Map = OpenLayers.Class({
*/
panMethod: OpenLayers.Easing.Expo.easeOut,
/**
* Property: panDuration
* {Integer} The number of steps to be passed to the
* OpenLayers.Tween.start() method when the map is
* panned.
* Default is 50.
*/
panDuration: 50,
/**
* Property: paddingForPopups
* {<OpenLayers.Bounds>} Outside margin of the popup. Used to prevent
@@ -1472,7 +1481,7 @@ OpenLayers.Map = OpenLayers.Class({
lon: lonlat.lon,
lat: lonlat.lat
};
this.panTween.start(from, to, 50, {
this.panTween.start(from, to, this.panDuration, {
callbacks: {
start: OpenLayers.Function.bind(function(lonlat) {
this.events.triggerEvent("movestart");