From 7f11d01e8783e83c9f06df7566bcb72df8a6ea3c Mon Sep 17 00:00:00 2001 From: euzuro Date: Mon, 22 May 2006 10:50:35 +0000 Subject: [PATCH] changing function name from generateMarker to draw() to remain consistent with other areas of the code. (specifically OpenLayers.Control, whouses the draw() function to render the control and return a link to the div) git-svn-id: http://svn.openlayers.org/trunk/openlayers@249 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Layer/Marker.js | 2 +- lib/OpenLayers/Marker.js | 13 ++++++------- tests/test_Layer_Text.html | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/lib/OpenLayers/Layer/Marker.js b/lib/OpenLayers/Layer/Marker.js index 47f7d5a176..2f1d63402e 100644 --- a/lib/OpenLayers/Layer/Marker.js +++ b/lib/OpenLayers/Layer/Marker.js @@ -71,7 +71,7 @@ OpenLayers.Layer.Marker.prototype = */ drawMarker: function(marker) { var px = this.map.getPixelFromLonLat(marker.lonlat); - var markerDiv = marker.generateMarker(px); + var markerDiv = marker.draw(px); this.div.appendChild(markerDiv); }, diff --git a/lib/OpenLayers/Marker.js b/lib/OpenLayers/Marker.js index 2c14c4f8c4..472308c3d6 100644 --- a/lib/OpenLayers/Marker.js +++ b/lib/OpenLayers/Marker.js @@ -31,7 +31,9 @@ OpenLayers.Marker.prototype = { this.lonlat = lonlat; this.object = OpenLayers.Util.createImage( this.icon.url, - this.icon.size + this.icon.size, + null, + "absolute" ); this.events = new OpenLayers.Events(this, this.object, null); }, @@ -43,12 +45,9 @@ OpenLayers.Marker.prototype = { * location passed-in * @type DOMElement */ - generateMarker: function(pixel) { - // Create a div here, and set the location to the pixel above modified - // by the icon size. - this.object.style.top = (pixel.y+this.icon.offset.y) + "px" - this.object.style.left = (pixel.x+this.icon.offset.x) + "px"; - this.object.style.position = "absolute"; + draw: function(pixel) { + this.object.style.top = (pixel.y + this.icon.offset.y) + "px" + this.object.style.left = (pixel.x + this.icon.offset.x) + "px"; return this.object; }, diff --git a/tests/test_Layer_Text.html b/tests/test_Layer_Text.html index cfd614f063..aab9176fc3 100644 --- a/tests/test_Layer_Text.html +++ b/tests/test_Layer_Text.html @@ -18,7 +18,7 @@ t.eq( layer.markers[0].icon.url, 'http://boston.openguides.org/markers/ORANGE.png', "icon" ); } ); } - function test_02_Layer_Text_generateMarker (t) { + function test_02_Layer_Text_draw (t) { t.plan(5); layer = new OpenLayers.Layer.Text('Test Layer', 'data_Layer_Text_textfile.txt'); t.ok( layer instanceof OpenLayers.Layer.Text, "new OpenLayers.Layer.Text returns object" );