From 4b752fbe5c2206077306056ff9f1308cd4cc4e6d Mon Sep 17 00:00:00 2001 From: crschmidt Date: Sun, 22 Jul 2007 13:59:24 +0000 Subject: [PATCH] Add docs clarifying that you should clone() before passing icons into the marker constructor. git-svn-id: http://svn.openlayers.org/trunk/openlayers@3782 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Marker.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/OpenLayers/Marker.js b/lib/OpenLayers/Marker.js index b0ef31ee9d..cb5cc41a05 100644 --- a/lib/OpenLayers/Marker.js +++ b/lib/OpenLayers/Marker.js @@ -23,8 +23,14 @@ * var offset = new OpenLayers.Pixel(-(size.w/2), -size.h); * var icon = new OpenLayers.Icon('http://boston.openguides.org/markers/AQUA.png',size,offset); * markers.addMarker(new OpenLayers.Marker(new OpenLayers.LonLat(0,0),icon)); + * markers.addMarker(new OpenLayers.Marker(new OpenLayers.LonLat(0,0),icon.clone())); * * (end) + * + * Note that if you pass an icon into the Marker constructor, it will take + * that icon and use it. This means that you should not share icons between + * markers -- you use them once, but you should clone() for any additional + * markers using that same icon. */ OpenLayers.Marker = OpenLayers.Class({