Ticket #1061: patch-close-popup-A1.diff
| File patch-close-popup-A1.diff, 3.3 kB (added by elemoine, 1 year ago) |
|---|
-
lib/OpenLayers/Popup/AnchoredBubble.js
old new 32 32 * a 'size' (<OpenLayers.Size>) and 'offset' (<OpenLayers.Pixel>) 33 33 * (Note that this is generally an <OpenLayers.Icon>). 34 34 * closeBox - {Boolean} 35 * closeBoxCallback - {Function} Function to be called on closeBox click. 35 36 */ 36 initialize:function(id, lonlat, size, contentHTML, anchor, closeBox) { 37 initialize:function(id, lonlat, size, contentHTML, anchor, closeBox, 38 closeBoxCallback) { 37 39 OpenLayers.Popup.Anchored.prototype.initialize.apply(this, arguments); 38 40 }, 39 41 -
lib/OpenLayers/Popup/Anchored.js
old new 38 38 * anchor - {Object} Object which must expose a 'size' <OpenLayers.Size> 39 39 * and 'offset' <OpenLayers.Pixel> (generally an <OpenLayers.Icon>). 40 40 * closeBox - {Boolean} 41 * closeBoxCallback - {Function} Function to be called on closeBox click. 41 42 */ 42 initialize:function(id, lonlat, size, contentHTML, anchor, closeBox) { 43 var newArguments = new Array(id, lonlat, size, contentHTML, closeBox); 43 initialize:function(id, lonlat, size, contentHTML, anchor, closeBox, 44 closeBoxCallback) { 45 var newArguments = new Array(id, lonlat, size, contentHTML, closeBox, 46 closeBoxCallback); 44 47 OpenLayers.Popup.prototype.initialize.apply(this, newArguments); 45 48 46 49 this.anchor = (anchor != null) ? anchor -
lib/OpenLayers/Popup.js
old new 117 117 * contentHTML - {String} The HTML content to display inside the 118 118 * popup. 119 119 * closeBox - {Boolean} Whether to display a close box inside 120 * the popup. 120 * the popup. 121 * closeBoxCallback - {Function} Function to be called on closeBox click. 121 122 */ 122 initialize:function(id, lonlat, size, contentHTML, closeBox ) {123 initialize:function(id, lonlat, size, contentHTML, closeBox, closeBoxCallback) { 123 124 if (id == null) { 124 125 id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_"); 125 126 } … … 165 166 closeImg.style.top = this.padding + "px"; 166 167 this.groupDiv.appendChild(closeImg); 167 168 168 var closePopup = function(e) { 169 this.hide(); 170 OpenLayers.Event.stop(e); 169 var callback = closeBoxCallback; 170 if (!callback) { 171 callback = function(e) { 172 this.hide(); 173 OpenLayers.Event.stop(e); 174 }; 171 175 } 172 176 OpenLayers.Event.observe(closeImg, "click", 173 OpenLayers.Function.bindAsEventListener(c losePopup, this));177 OpenLayers.Function.bindAsEventListener(callback, this)); 174 178 175 179 } 176 180
