From afecf46652ead60f1261cb63e849b13cc2843958 Mon Sep 17 00:00:00 2001 From: euzuro Date: Fri, 22 Aug 2008 13:23:16 +0000 Subject: [PATCH] Small patch to allow an 'id' property to be custom-set on controls -- without being overrided by the default random id generator. Thanks to Stephen I for the bug report. r=elemoine (Closes #1687) git-svn-id: http://svn.openlayers.org/trunk/openlayers@7829 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Control.js | 4 +++- tests/Control.html | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/OpenLayers/Control.js b/lib/OpenLayers/Control.js index ce6ec13345..fb6c98ceb4 100644 --- a/lib/OpenLayers/Control.js +++ b/lib/OpenLayers/Control.js @@ -176,7 +176,9 @@ OpenLayers.Control = OpenLayers.Class({ if(this.eventListeners instanceof Object) { this.events.on(this.eventListeners); } - this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_"); + if (this.id == null) { + this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_"); + } }, /** diff --git a/tests/Control.html b/tests/Control.html index 72814511ab..6bf6966258 100644 --- a/tests/Control.html +++ b/tests/Control.html @@ -3,12 +3,17 @@