From f3593fc839c8f64216d91755bdcce0d6d37d01fb Mon Sep 17 00:00:00 2001 From: euzuro Date: Fri, 3 Aug 2007 19:27:39 +0000 Subject: [PATCH] fix for #677 -- making yahoo maps deal with size correctly (safari and general karma fix) git-svn-id: http://svn.openlayers.org/trunk/openlayers@3843 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Layer/Yahoo.js | 31 ++++++++- tests/Layer/test_Yahoo.html | 120 ++++++++++++++++++++++++++++++++++ tests/list-tests.html | 1 + 3 files changed, 150 insertions(+), 2 deletions(-) create mode 100755 tests/Layer/test_Yahoo.html diff --git a/lib/OpenLayers/Layer/Yahoo.js b/lib/OpenLayers/Layer/Yahoo.js index ab13d3ca47..689b7c3856 100644 --- a/lib/OpenLayers/Layer/Yahoo.js +++ b/lib/OpenLayers/Layer/Yahoo.js @@ -59,10 +59,22 @@ OpenLayers.Layer.Yahoo = OpenLayers.Class( */ loadMapObject:function() { try { //do not crash! - this.mapObject = new YMap(this.div, this.type); + var size = this.getMapObjectSizeFromOLSize(this.map.getSize()); + this.mapObject = new YMap(this.div, this.type, size); this.mapObject.disableKeyControls(); } catch(e) {} }, + + /** + * Method: onMapResize + * + */ + onMapResize: function() { + try { + var size = this.getMapObjectSizeFromOLSize(this.map.getSize()); + this.mapObject.resizeTo(size); + } catch(e) {} + }, /** @@ -336,6 +348,21 @@ OpenLayers.Layer.Yahoo = OpenLayers.Class( getMapObjectPixelFromXY: function(x, y) { return new YCoordPoint(x, y); }, - + + // Size + + /** + * APIMethod: getMapObjectSizeFromOLSize + * + * Parameters: + * olSize - {} + * + * Return: + * {Object} MapObject Size from olSize parameter + */ + getMapObjectSizeFromOLSize: function(olSize) { + return new YSize(olSize.w, olSize.h); + }, + CLASS_NAME: "OpenLayers.Layer.Yahoo" }); diff --git a/tests/Layer/test_Yahoo.html b/tests/Layer/test_Yahoo.html new file mode 100755 index 0000000000..5ec5978978 --- /dev/null +++ b/tests/Layer/test_Yahoo.html @@ -0,0 +1,120 @@ + + + + + + + +
+ + diff --git a/tests/list-tests.html b/tests/list-tests.html index aad909b016..c8fa8d7528 100644 --- a/tests/list-tests.html +++ b/tests/list-tests.html @@ -51,6 +51,7 @@
  • Layer/test_TMS.html
  • Layer/test_TileCache.html
  • Layer/test_Vector.html
  • +
  • Layer/test_Yahoo.html
  • Layer/test_GML.html
  • Layer/test_WrapDateLine.html
  • test_Tile.html