add smooth drag panning to yahoo layer. the trinity is united. killer props to cr5 for digging through and finding these. ladies and gentlemen, you now have *no*excuse* for not using openlayers. smooth and sexy GYM commercial layers. (Closes #1163)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@5230 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
<script src='http://maps.google.com/maps?file=api&v=2.82&key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhQtCjFYhdtNUZyqZQW2mFbq_dOIHBSGvjZ-C7_tXAXYdB-ehlOacmC_xA'></script>
|
<script src='http://maps.google.com/maps?file=api&v=2.82&key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhQtCjFYhdtNUZyqZQW2mFbq_dOIHBSGvjZ-C7_tXAXYdB-ehlOacmC_xA'></script>
|
||||||
<script src='http://dev.virtualearth.net/mapcontrol/v3/mapcontrol.js'></script>
|
<script src='http://dev.virtualearth.net/mapcontrol/v3/mapcontrol.js'></script>
|
||||||
|
<script src="http://api.maps.yahoo.com/ajaxymap?v=3.0&appid=euzuro-openlayers"></script>
|
||||||
|
|
||||||
<script src="../lib/OpenLayers.js"></script>
|
<script src="../lib/OpenLayers.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
@@ -49,6 +50,12 @@
|
|||||||
{'type': VEMapStyle.Road, 'sphericalMercator': true}
|
{'type': VEMapStyle.Road, 'sphericalMercator': true}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// create Yahoo layer
|
||||||
|
var yahoo = new OpenLayers.Layer.Yahoo(
|
||||||
|
"Yahoo Street",
|
||||||
|
{'sphericalMercator': true}
|
||||||
|
);
|
||||||
|
|
||||||
// create WMS layer
|
// create WMS layer
|
||||||
var wms = new OpenLayers.Layer.WMS(
|
var wms = new OpenLayers.Layer.WMS(
|
||||||
"World Map",
|
"World Map",
|
||||||
@@ -60,7 +67,7 @@
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
map.addLayers([gmap, wms, ve]);
|
map.addLayers([gmap, wms, ve, yahoo]);
|
||||||
map.addControl(new OpenLayers.Control.LayerSwitcher());
|
map.addControl(new OpenLayers.Control.LayerSwitcher());
|
||||||
map.zoomToMaxExtent()
|
map.zoomToMaxExtent()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,6 +92,13 @@ OpenLayers.Layer.Yahoo = OpenLayers.Class(
|
|||||||
this.mapObject = new YMap(this.div, this.type, size);
|
this.mapObject = new YMap(this.div, this.type, size);
|
||||||
this.mapObject.disableKeyControls();
|
this.mapObject.disableKeyControls();
|
||||||
this.mapObject.disableDragMap();
|
this.mapObject.disableDragMap();
|
||||||
|
|
||||||
|
//can we do smooth panning? (moveByXY is not an API function)
|
||||||
|
if ( !this.mapObject.moveByXY ||
|
||||||
|
(typeof this.mapObject.moveByXY != "function" ) ) {
|
||||||
|
|
||||||
|
this.dragPanMapObject = null;
|
||||||
|
}
|
||||||
} catch(e) {}
|
} catch(e) {}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -248,6 +255,20 @@ OpenLayers.Layer.Yahoo = OpenLayers.Class(
|
|||||||
return this.mapObject.getCenterLatLon();
|
return this.mapObject.getCenterLatLon();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APIMethod: dragPanMapObject
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* dX - {Integer}
|
||||||
|
* dY - {Integer}
|
||||||
|
*/
|
||||||
|
dragPanMapObject: function(dX, dY) {
|
||||||
|
this.mapObject.moveByXY({
|
||||||
|
'x': -dX,
|
||||||
|
'y': dY
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIMethod: getMapObjectZoom
|
* APIMethod: getMapObjectZoom
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user