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
This commit is contained in:
@@ -71,7 +71,7 @@ OpenLayers.Layer.Marker.prototype =
|
|||||||
*/
|
*/
|
||||||
drawMarker: function(marker) {
|
drawMarker: function(marker) {
|
||||||
var px = this.map.getPixelFromLonLat(marker.lonlat);
|
var px = this.map.getPixelFromLonLat(marker.lonlat);
|
||||||
var markerDiv = marker.generateMarker(px);
|
var markerDiv = marker.draw(px);
|
||||||
this.div.appendChild(markerDiv);
|
this.div.appendChild(markerDiv);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,9 @@ OpenLayers.Marker.prototype = {
|
|||||||
this.lonlat = lonlat;
|
this.lonlat = lonlat;
|
||||||
this.object = OpenLayers.Util.createImage(
|
this.object = OpenLayers.Util.createImage(
|
||||||
this.icon.url,
|
this.icon.url,
|
||||||
this.icon.size
|
this.icon.size,
|
||||||
|
null,
|
||||||
|
"absolute"
|
||||||
);
|
);
|
||||||
this.events = new OpenLayers.Events(this, this.object, null);
|
this.events = new OpenLayers.Events(this, this.object, null);
|
||||||
},
|
},
|
||||||
@@ -43,12 +45,9 @@ OpenLayers.Marker.prototype = {
|
|||||||
* location passed-in
|
* location passed-in
|
||||||
* @type DOMElement
|
* @type DOMElement
|
||||||
*/
|
*/
|
||||||
generateMarker: function(pixel) {
|
draw: function(pixel) {
|
||||||
// Create a div here, and set the location to the pixel above modified
|
this.object.style.top = (pixel.y + this.icon.offset.y) + "px"
|
||||||
// by the icon size.
|
this.object.style.left = (pixel.x + this.icon.offset.x) + "px";
|
||||||
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";
|
|
||||||
return this.object;
|
return this.object;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
t.eq( layer.markers[0].icon.url, 'http://boston.openguides.org/markers/ORANGE.png', "icon" );
|
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);
|
t.plan(5);
|
||||||
layer = new OpenLayers.Layer.Text('Test Layer', 'data_Layer_Text_textfile.txt');
|
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" );
|
t.ok( layer instanceof OpenLayers.Layer.Text, "new OpenLayers.Layer.Text returns object" );
|
||||||
|
|||||||
Reference in New Issue
Block a user