Changeset 7920
- Timestamp:
- 09/02/08 03:30:34 (3 months ago)
- Files:
-
- sandbox/camptocamp/unhcr/examples/popupMatrix.html (modified) (1 diff)
- sandbox/camptocamp/unhcr/examples/wfs-reprojection.html (modified) (1 diff)
- sandbox/camptocamp/unhcr/lib/OpenLayers/BaseTypes/Element.js (modified) (1 diff)
- sandbox/camptocamp/unhcr/lib/OpenLayers/Control/Permalink.js (modified) (7 diffs)
- sandbox/camptocamp/unhcr/lib/OpenLayers/Geometry/Collection.js (modified) (1 diff)
- sandbox/camptocamp/unhcr/lib/OpenLayers/Geometry/LinearRing.js (modified) (1 diff)
- sandbox/camptocamp/unhcr/lib/OpenLayers/Geometry/Point.js (modified) (1 diff)
- sandbox/camptocamp/unhcr/lib/OpenLayers/Map.js (modified) (4 diffs)
- sandbox/camptocamp/unhcr/lib/OpenLayers/Popup.js (modified) (11 diffs)
- sandbox/camptocamp/unhcr/lib/OpenLayers/Popup/Anchored.js (modified) (4 diffs)
- sandbox/camptocamp/unhcr/lib/OpenLayers/Popup/AnchoredBubble.js (modified) (3 diffs)
- sandbox/camptocamp/unhcr/lib/OpenLayers/Popup/Framed.js (modified) (4 diffs)
- sandbox/camptocamp/unhcr/lib/OpenLayers/Popup/FramedCloud.js (modified) (2 diffs)
- sandbox/camptocamp/unhcr/lib/OpenLayers/Renderer/Canvas.js (modified) (3 diffs)
- sandbox/camptocamp/unhcr/lib/OpenLayers/Renderer/Elements.js (modified) (1 diff)
- sandbox/camptocamp/unhcr/lib/OpenLayers/Util.js (modified) (1 diff)
- sandbox/camptocamp/unhcr/tests/BaseTypes/Element.html (modified) (2 diffs)
- sandbox/camptocamp/unhcr/tests/Control/Permalink.html (modified) (1 diff)
- sandbox/camptocamp/unhcr/tests/Control/SelectFeature.html (modified) (1 diff)
- sandbox/camptocamp/unhcr/tests/Geometry/Collection.html (modified) (1 diff)
- sandbox/camptocamp/unhcr/tests/Geometry/Point.html (modified) (1 diff)
- sandbox/camptocamp/unhcr/tests/Geometry/Polygon.html (modified) (1 diff)
- sandbox/camptocamp/unhcr/tests/Layer/WFS.html (modified) (1 diff)
- sandbox/camptocamp/unhcr/tests/Map.html (modified) (1 diff)
- sandbox/camptocamp/unhcr/tests/Popup.html (modified) (2 diffs)
- sandbox/camptocamp/unhcr/tests/Popup/Anchored.html (modified) (1 diff)
- sandbox/camptocamp/unhcr/tests/Renderer/Elements.html (modified) (5 diffs)
- sandbox/camptocamp/unhcr/tests/manual/vector-layer-zindex.html (modified) (2 props)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
sandbox/camptocamp/unhcr/examples/popupMatrix.html
r7241 r7920 880 880 881 881 <!-- preloading these images so the autosize will work correctly --> 882 <img src="small.jpg" style="position:absolute; top:-5000px; left: -5000px"></img>883 882 <img src="wideshort.jpg" style="position:absolute; top:-5000px; left: -5000px"></img> 884 883 <img src="widelong.jpg" style="position:absolute; top:-5000px; left: -5000px"></img> 885 884 <img src="thinlong.jpg" style="position:absolute; top:-5000px; left: -5000px"></img> 885 886 <p> All of the images in this file a pre-cached, meaning they are 887 loaded immediately when you load the page (they are just placed 888 far offscreen, that's why you don't see them). 889 </p> 890 <br> 891 <p> The only image that is *not* preloaded is small.jpg, the brazilian 892 flag. We do this in order to test out to make sure that our auto-sizing 893 code does in fact activate itself as the images load. To verify 894 this, clear your cache and reload this example page. Click on 895 any of the markers in the 'AutoSize' row. If the popup autosizes 896 to correctly contain the entire flag: golden. If the popup is 897 tiny and you can only see a corner of it, then this code is broken. 898 </p> 886 899 887 900 <br/> sandbox/camptocamp/unhcr/examples/wfs-reprojection.html
r7875 r7920 9 9 10 10 var map, layer, styleMap; 11 OpenLayers.ProxyHost = "/ cgi-bin/proxy.cgi?url=";11 OpenLayers.ProxyHost = "/proxy/?url="; 12 12 function init(){ 13 13 sandbox/camptocamp/unhcr/lib/OpenLayers/BaseTypes/Element.js
r7785 r7920 216 216 getStyle: function(element, style) { 217 217 element = OpenLayers.Util.getElement(element); 218 var value = element.style[OpenLayers.String.camelize(style)]; 219 if (!value) { 220 if (document.defaultView && 221 document.defaultView.getComputedStyle) { 222 223 var css = document.defaultView.getComputedStyle(element, null); 224 value = css ? css.getPropertyValue(style) : null; 225 } else if (element.currentStyle) { 226 value = element.currentStyle[OpenLayers.String.camelize(style)]; 218 219 var value = null; 220 if (element && element.style) { 221 value = element.style[OpenLayers.String.camelize(style)]; 222 if (!value) { 223 if (document.defaultView && 224 document.defaultView.getComputedStyle) { 225 226 var css = document.defaultView.getComputedStyle(element, null); 227 value = css ? css.getPropertyValue(style) : null; 228 } else if (element.currentStyle) { 229 value = element.currentStyle[OpenLayers.String.camelize(style)]; 230 } 227 231 } 228 }229 230 var positions = ['left', 'top', 'right', 'bottom'];231 if (window.opera&&232 (OpenLayers.Util.indexOf(positions,style) != -1) &&233 (OpenLayers.Element.getStyle(element, 'position') == 'static')) {234 value = 'auto';232 233 var positions = ['left', 'top', 'right', 'bottom']; 234 if (window.opera && 235 (OpenLayers.Util.indexOf(positions,style) != -1) && 236 (OpenLayers.Element.getStyle(element, 'position') == 'static')) { 237 value = 'auto'; 238 } 235 239 } 236 240 sandbox/camptocamp/unhcr/lib/OpenLayers/Control/Permalink.js
r7785 r7920 16 16 */ 17 17 OpenLayers.Control.Permalink = OpenLayers.Class(OpenLayers.Control, { 18 19 /** 20 * APIProperty: argParserClass 21 * {Class} The ArgParser control class (not instance) to use with this 22 * control. 23 */ 24 argParserClass: OpenLayers.Control.ArgParser, 18 25 19 26 /** … … 82 89 for(var i=0, len=this.map.controls.length; i<len; i++) { 83 90 var control = this.map.controls[i]; 84 if (control.CLASS_NAME == "OpenLayers.Control.ArgParser") {91 if (control.CLASS_NAME == this.argParserClass.CLASS_NAME) { 85 92 86 93 // If a permalink is added to the map, and an ArgParser already … … 95 102 } 96 103 if (i == this.map.controls.length) { 97 this.map.addControl(new OpenLayers.Control.ArgParser(104 this.map.addControl(new this.argParserClass( 98 105 { 'displayProjection': this.displayProjection })); 99 106 } … … 111 118 112 119 if (!this.element) { 120 this.div.className = this.displayClass; 113 121 this.element = document.createElement("a"); 114 122 this.element.innerHTML = OpenLayers.i18n("permalink"); … … 122 130 scope: this 123 131 }); 132 133 // Make it so there is at least a link even though the map may not have 134 // moved yet. 135 this.updateLink(); 136 124 137 return this.div; 125 138 }, … … 129 142 */ 130 143 updateLink: function() { 131 var center = this.map.getCenter();132 133 // Map not initialized yet. Break out of this function.134 if (!center) {135 return;136 }137 138 var params = OpenLayers.Util.getParameters(this.base);139 140 params.zoom = this.map.getZoom();141 var lat = center.lat;142 var lon = center.lon;143 144 if (this.displayProjection) {145 var mapPosition = OpenLayers.Projection.transform(146 { x: lon, y: lat },147 this.map.getProjectionObject(),148 this.displayProjection );149 lon = mapPosition.x;150 lat = mapPosition.y;151 }152 params.lat = Math.round(lat*100000)/100000;153 params.lon = Math.round(lon*100000)/100000;154 155 params.layers = '';156 for (var i=0, len=this.map.layers.length; i<len; i++) {157 var layer = this.map.layers[i];158 159 if (layer.isBaseLayer) {160 params.layers += (layer == this.map.baseLayer) ? "B" : "0";161 } else {162 params.layers += (layer.getVisibility()) ? "T" : "F";163 }164 }165 166 144 var href = this.base; 167 145 if (href.indexOf('?') != -1) { … … 169 147 } 170 148 171 href += '?' + OpenLayers.Util.getParameterString( params);149 href += '?' + OpenLayers.Util.getParameterString(this.createParams()); 172 150 this.element.href = href; 173 151 }, 152 153 /** 154 * APIMethod: createParams 155 * Creates the parameters that need to be encoded into the permalink url. 156 * 157 * Parameters: 158 * center - {<OpenLayers.LonLat>} center to encode in the permalink. 159 * Defaults to the current map center. 160 * zoom - {Integer} zoom level to encode in the permalink. Defaults to the 161 * current map zoom level. 162 * layers - {Array(<OpenLayers.Layer>)} layers to encode in the permalink. 163 * Defaults to the current map layers. 164 * 165 * Returns: 166 * {Object} Hash of parameters that will be url-encoded into the 167 * permalink. 168 */ 169 createParams: function(center, zoom, layers) { 170 center = center || this.map.getCenter(); 171 zoom = zoom || this.map.getZoom(); 172 layers = layers || this.map.layers; 173 174 var params = OpenLayers.Util.getParameters(this.base); 175 176 // If there's still no center, map is not initialized yet. 177 // Break out of this function, and simply return the params from the 178 // base link. 179 if (center) { 180 181 params.zoom = this.map.getZoom(); 182 var lat = center.lat; 183 var lon = center.lon; 184 185 if (this.displayProjection) { 186 var mapPosition = OpenLayers.Projection.transform( 187 { x: lon, y: lat }, 188 this.map.getProjectionObject(), 189 this.displayProjection ); 190 lon = mapPosition.x; 191 lat = mapPosition.y; 192 } 193 params.lat = Math.round(lat*100000)/100000; 194 params.lon = Math.round(lon*100000)/100000; 195 196 params.layers = ''; 197 for (var i=0, len=this.map.layers.length; i<len; i++) { 198 var layer = this.map.layers[i]; 199 200 if (layer.isBaseLayer) { 201 params.layers += (layer == this.map.baseLayer) ? "B" : "0"; 202 } else { 203 params.layers += (layer.getVisibility()) ? "T" : "F"; 204 } 205 } 206 } 207 208 return params; 209 }, 174 210 175 211 CLASS_NAME: "OpenLayers.Control.Permalink" sandbox/camptocamp/unhcr/lib/OpenLayers/Geometry/Collection.js
r7785 r7920 326 326 component.transform(source, dest); 327 327 } 328 } 328 this.bounds = null; 329 } 329 330 return this; 330 331 }, sandbox/camptocamp/unhcr/lib/OpenLayers/Geometry/LinearRing.js
r7785 r7920 173 173 component.transform(source, dest); 174 174 } 175 this.bounds = null; 175 176 } 176 177 return this; sandbox/camptocamp/unhcr/lib/OpenLayers/Geometry/Point.js
r7785 r7920 207 207 OpenLayers.Projection.transform( 208 208 this, source, dest); 209 this.bounds = null; 209 210 } 210 211 return this; sandbox/camptocamp/unhcr/lib/OpenLayers/Map.js
r7878 r7920 1941 1941 * Parameters: 1942 1942 * bounds - {<OpenLayers.Bounds>} 1943 */ 1944 zoomToExtent: function(bounds) { 1943 * closest - {Boolean} Find the zoom level that most closely fits the 1944 * specified bounds. Note that this may result in a zoom that does 1945 * not exactly contain the entire extent. 1946 * Default is false. 1947 * 1948 */ 1949 zoomToExtent: function(bounds, closest) { 1945 1950 var center = bounds.getCenterLonLat(); 1946 1951 if (this.baseLayer.wrapDateLine) { … … 1966 1971 center = bounds.getCenterLonLat().wrapDateLine(maxExtent); 1967 1972 } 1968 this.setCenter(center, this.getZoomForExtent(bounds ));1973 this.setCenter(center, this.getZoomForExtent(bounds, closest)); 1969 1974 }, 1970 1975 … … 1996 2001 * Parameters: 1997 2002 * scale - {float} 1998 */ 1999 zoomToScale: function(scale) { 2003 * closest - {Boolean} Find the zoom level that most closely fits the 2004 * specified scale. Note that this may result in a zoom that does 2005 * not exactly contain the entire extent. 2006 * Default is false. 2007 * 2008 */ 2009 zoomToScale: function(scale, closest) { 2000 2010 var res = OpenLayers.Util.getResolutionFromScale(scale, 2001 2011 this.baseLayer.units); … … 2009 2019 center.lon + w_deg / 2, 2010 2020 center.lat + h_deg / 2); 2011 this.zoomToExtent(extent );2021 this.zoomToExtent(extent, closest); 2012 2022 }, 2013 2023 sandbox/camptocamp/unhcr/lib/OpenLayers/Popup.js
r7785 r7920 49 49 50 50 /** 51 * Property: contentSize 52 * {<OpenLayers.Size>} the width and height of the content. 53 */ 54 contentSize: null, 55 56 /** 51 57 * Property: size 52 58 * {<OpenLayers.Size>} the width and height of the popup. … … 56 62 /** 57 63 * Property: contentHTML 58 * {String} The HTML that this popup displays.59 */ 60 contentHTML: "",64 * {String} An HTML string for this popup to display. 65 */ 66 contentHTML: null, 61 67 62 68 /** … … 184 190 * lonlat - {<OpenLayers.LonLat>} The position on the map the popup will 185 191 * be shown. 186 * size - {<OpenLayers.Size>} The size of the popup.187 * contentHTML - {String} The HTML content to display inside the192 * contentSize - {<OpenLayers.Size>} The size of the content. 193 * contentHTML - {String} An HTML string to display inside the 188 194 * popup. 189 195 * closeBox - {Boolean} Whether to display a close box inside … … 191 197 * closeBoxCallback - {Function} Function to be called on closeBox click. 192 198 */ 193 initialize:function(id, lonlat, size, contentHTML, closeBox, closeBoxCallback) {199 initialize:function(id, lonlat, contentSize, contentHTML, closeBox, closeBoxCallback) { 194 200 if (id == null) { 195 201 id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_"); … … 198 204 this.id = id; 199 205 this.lonlat = lonlat; 200 this.size = (size != null) ? size 206 207 this.contentSize = (contentSize != null) ? contentSize 201 208 : new OpenLayers.Size( 202 209 OpenLayers.Popup.WIDTH, … … 219 226 220 227 var id = this.div.id + "_contentDiv"; 221 this.contentDiv = OpenLayers.Util.createDiv(id, null, this. size.clone(),228 this.contentDiv = OpenLayers.Util.createDiv(id, null, this.contentSize.clone(), 222 229 null, "relative"); 223 230 this.contentDiv.className = this.contentDisplayClass; … … 311 318 312 319 this.moveTo(px); 313 if (!this.autoSize ) {314 this.setSize(this. size);320 if (!this.autoSize && !this.size) { 321 this.setSize(this.contentSize); 315 322 } 316 323 this.setBackgroundColor(); … … 400 407 * 401 408 * Parameters: 402 * size - {<OpenLayers.Size>} the new size of the popup's contents div 403 * (in pixels). 404 */ 405 setSize:function(size) { 406 this.size = size; 407 408 var contentSize = this.size.clone(); 409 * contentSize - {<OpenLayers.Size>} the new size for the popup's 410 * contents div (in pixels). 411 */ 412 setSize:function(contentSize) { 413 this.size = contentSize.clone(); 409 414 410 415 // if our contentDiv has a css 'padding' set on it by a stylesheet, we … … 434 439 // me want to shoot someone, but so it goes. 435 440 if (OpenLayers.Util.getBrowserName() == "msie") { 436 contentSize.w += contentDivPadding.left + contentDivPadding.right; 437 contentSize.h += contentDivPadding.bottom + contentDivPadding.top; 441 this.contentSize.w += 442 contentDivPadding.left + contentDivPadding.right; 443 this.contentSize.h += 444 contentDivPadding.bottom + contentDivPadding.top; 438 445 } 439 446 … … 449 456 450 457 /** 458 * APIMethod: updateSize 459 * Auto size the popup so that it precisely fits its contents (as 460 * determined by this.contentDiv.innerHTML). Popup size will, of 461 * course, be limited by the available space on the current map 462 */ 463 updateSize: function() { 464 465 // determine actual render dimensions of the contents by putting its 466 // contents into a fake contentDiv (for the CSS) and then measuring it 467 var preparedHTML = "<div class='" + this.contentDisplayClass+ "'>" + 468 this.contentDiv.innerHTML + 469 "<div>"; 470 var realSize = OpenLayers.Util.getRenderedDimensions( 471 preparedHTML, null, { displayClass: this.displayClass } 472 ); 473 474 // is the "real" size of the div is safe to display in our map? 475 var safeSize = this.getSafeContentSize(realSize); 476 477 var newSize = null; 478 if (safeSize.equals(realSize)) { 479 //real size of content is small enough to fit on the map, 480 // so we use real size. 481 newSize = realSize; 482 483 } else { 484 485 //make a new OL.Size object with the clipped dimensions 486 // set or null if not clipped. 487 var fixedSize = new OpenLayers.Size(); 488 fixedSize.w = (safeSize.w < realSize.w) ? safeSize.w : null; 489 fixedSize.h = (safeSize.h < realSize.h) ? safeSize.h : null; 490 491 if (fixedSize.w && fixedSize.h) { 492 //content is too big in both directions, so we will use 493 // max popup size (safeSize), knowing well that it will 494 // overflow both ways. 495 newSize = safeSize; 496 } else { 497 //content is clipped in only one direction, so we need to 498 // run getRenderedDimensions() again with a fixed dimension 499 var clippedSize = OpenLayers.Util.getRenderedDimensions( 500 preparedHTML, fixedSize, 501 { displayClass: this.contentDisplayClass } 502 ); 503 504 //if the clipped size is still the same as the safeSize, 505 // that means that our content must be fixed in the 506 // offending direction. If overflow is 'auto', this means 507 // we are going to have a scrollbar for sure, so we must 508 // adjust for that. 509 // 510 var currentOverflow = OpenLayers.Element.getStyle( 511 this.contentDiv, "overflow" 512 ); 513 if ( (currentOverflow != "hidden") && 514 (clippedSize.equals(safeSize)) ) { 515 var scrollBar = OpenLayers.Util.getScrollbarWidth(); 516 if (fixedSize.w) { 517 clippedSize.h += scrollBar; 518 } else { 519 clippedSize.w += scrollBar; 520 } 521 } 522 523 newSize = this.getSafeContentSize(clippedSize); 524 } 525 } 526 this.setSize(newSize); 527 }, 528 529 /** 451 530 * Method: setBackgroundColor 452 531 * Sets the background color of the popup. … … 512 591 setContentHTML:function(contentHTML) { 513 592 514 var preparedHTML;515 593 if (contentHTML != null) { 516 594 this.contentHTML = contentHTML; 517 595 } 518 596 519 if (this.autoSize) { 520 //fake the contentDiv for the CSS context 521 preparedHTML = "<div class='" + this.contentDisplayClass+ "'>" + this.contentHTML + "<div>"; 522 523 // determine actual render dimensions of the contents 524 var realSize = 525 OpenLayers.Util.getRenderedDimensions(preparedHTML, null, 526 { displayClass: this.displayClass }); 527 528 // is the "real" size of the div is safe to display in our map? 529 var safeSize = this.getSafeContentSize(realSize); 530 531 var newSize = null; 532 533 if (safeSize.equals(realSize)) { 534 //real size of content is small enough to fit on the map, 535 // so we use real size. 536 newSize = realSize; 537 538 } else { 539 540 //make a new OL.Size object with the clipped dimensions 541 // set or null if not clipped. 542 var fixedSize = new OpenLayers.Size(); 543 fixedSize.w = (safeSize.w < realSize.w) ? safeSize.w : null; 544 fixedSize.h = (safeSize.h < realSize.h) ? safeSize.h : null; 597 if ((this.contentDiv != null) && 598 (this.contentHTML != null) && 599 (this.contentHTML != this.contentDiv.innerHTML)) { 600 601 this.contentDiv.innerHTML = this.contentHTML; 602 603 if (this.autoSize) { 604 605 //if popup has images, listen for when they finish 606 // loading and resize accordingly 607 this.registerImageListeners(); 608 609 //auto size the popup to its current contents 610 this.updateSize(); 611 } 612 } 613 614 }, 615 616 /** 617 * Method: registerImageListeners 618 * Called when an image contained by the popup loaded. this function 619 * updates the popup size, then unregisters the image load listener. 620 */ 621 registerImageListeners: function() { 622 623 // As the images load, this function will call updateSize() to 624 // resize the popup to fit the content div (which presumably is now 625 // bigger than when the image was not loaded). 626 // 627 // If the 'panMapIfOutOfView' property is set, we will pan the newly 628 // resized popup back into view. 629 // 630 // Note that this function, when called, will have 'popup' and 631 // 'img' properties in the context. 632 // 633 var onImgLoad = function() { 545 634 546 if (fixedSize.w && fixedSize.h) { 547 //content is too big in both directions, so we will use 548 // max popup size (safeSize), knowing well that it will 549 // overflow both ways. 550 newSize = safeSize; 551 } else { 552 //content is clipped in only one direction, so we need to 553 // run getRenderedDimensions() again with a fixed dimension 554 var clippedSize = OpenLayers.Util.getRenderedDimensions( 555 preparedHTML, fixedSize, 556 { displayClass: this.contentDisplayClass } 557 ); 558 559 //if the clipped size is still the same as the safeSize, 560 // that means that our content must be fixed in the 561 // offending direction. If overflow is 'auto', this means 562 // we are going to have a scrollbar for sure, so we must 563 // adjust for that. 564 // 565 var currentOverflow = OpenLayers.Element.getStyle( 566 this.contentDiv, "overflow" 567 ); 568 if ( (currentOverflow != "hidden") && 569 (clippedSize.equals(safeSize)) ) { 570 var scrollBar = OpenLayers.Util.getScrollbarWidth(); 571 if (fixedSize.w) { 572 clippedSize.h += scrollBar; 573 } else { 574 clippedSize.w += scrollBar; 575 } 576 } 577 578 newSize = this.getSafeContentSize(clippedSize); 579 } 580 } 581 this.setSize(newSize); 582 } 583 584 if (this.contentDiv != null) { 585 this.contentDiv.innerHTML = this.contentHTML; 586 } 587 }, 588 635 this.popup.updateSize(); 636 637 if ( this.popup.visible() && this.popup.panMapIfOutOfView ) { 638 this.popup.panIntoView(); 639 } 640 641 OpenLayers.Event.stopObserving( 642 this.img, "load", this.img._onImageLoad 643 ); 644 645 }; 646 647 //cycle through the images and if their size is 0x0, that means that 648 // they haven't been loaded yet, so we attach the listener, which 649 // will fire when the images finish loading and will resize the 650 // popup accordingly to its new size. 651 var images = this.contentDiv.getElementsByTagName("img"); 652 for (var i = 0, len = images.length; i < len; i++) { 653 var img = images[i]; 654 if (img.width == 0 || img.height == 0) { 655 656 var context = { 657 'popup': this, 658 'img': img 659 }; 660 661 //expando this function to the image itself before registering 662 // it. This way we can easily and properly unregister it. 663 img._onImgLoad = OpenLayers.Function.bind(onImgLoad, context); 664 665 OpenLayers.Event.observe(img, 'load', img._onImgLoad); 666 } 667 } 668 }, 589 669 590 670 /** sandbox/camptocamp/unhcr/lib/OpenLayers/Popup/Anchored.js
r7052 r7920 36 36 * id - {String} 37 37 * lonlat - {<OpenLayers.LonLat>} 38 * size - {<OpenLayers.Size>}38 * contentSize - {<OpenLayers.Size>} 39 39 * contentHTML - {String} 40 40 * anchor - {Object} Object which must expose a 'size' <OpenLayers.Size> … … 43 43 * closeBoxCallback - {Function} Function to be called on closeBox click. 44 44 */ 45 initialize:function(id, lonlat, size, contentHTML, anchor, closeBox,45 initialize:function(id, lonlat, contentSize, contentHTML, anchor, closeBox, 46 46 closeBoxCallback) { 47 var newArguments = new Array(id, lonlat, size, contentHTML, closeBox, 48 closeBoxCallback); 47 var newArguments = [ 48 id, lonlat, contentSize, contentHTML, closeBox, closeBoxCallback 49 ]; 49 50 OpenLayers.Popup.prototype.initialize.apply(this, newArguments); 50 51 … … 109 110 * 110 111 * Parameters: 111 * size - {<OpenLayers.Size>} 112 * contentSize - {<OpenLayers.Size>} the new size for the popup's 113 * contents div (in pixels). 112 114 */ 113 setSize:function( size) {115 setSize:function(contentSize) { 114 116 OpenLayers.Popup.prototype.setSize.apply(this, arguments); 115 117 … … 165 167 calculateNewPx:function(px) { 166 168 var newPx = px.offset(this.anchor.offset); 169 170 //use contentSize if size is not already set 171 var size = this.size || this.contentSize; 167 172 168 173 var top = (this.relativePosition.charAt(0) == 't'); 169 newPx.y += (top) ? - this.size.h : this.anchor.size.h;174 newPx.y += (top) ? -size.h : this.anchor.size.h; 170 175 171 176 var left = (this.relativePosition.charAt(1) == 'l'); 172 newPx.x += (left) ? - this.size.w : this.anchor.size.w;177 newPx.x += (left) ? -size.w : this.anchor.size.w; 173 178 174 179 return newPx; sandbox/camptocamp/unhcr/lib/OpenLayers/Popup/AnchoredBubble.js
r6718 r7920 29 29 * id - {String} 30 30 * lonlat - {<OpenLayers.LonLat>} 31 * size - {<OpenLayers.Size>}31 * contentSize - {<OpenLayers.Size>} 32 32 * contentHTML - {String} 33 33 * anchor - {Object} Object to which we'll anchor the popup. Must expose … … 37 37 * closeBoxCallback - {Function} Function to be called on closeBox click. 38 38 */ 39 initialize:function(id, lonlat, size, contentHTML, anchor, closeBox,39 initialize:function(id, lonlat, contentSize, contentHTML, anchor, closeBox, 40 40 closeBoxCallback) { 41 41 … … 82 82 * 83 83 * Parameters: 84 * size - {<OpenLayers.Size>} 84 * contentSize - {<OpenLayers.Size>} the new size for the popup's 85 * contents div (in pixels). 85 86 */ 86 setSize:function( size) {87 setSize:function(contentSize) { 87 88 OpenLayers.Popup.Anchored.prototype.setSize.apply(this, arguments); 88 89 sandbox/camptocamp/unhcr/lib/OpenLayers/Popup/Framed.js
r6800 r7920 86 86 * id - {String} 87 87 * lonlat - {<OpenLayers.LonLat>} 88 * size - {<OpenLayers.Size>}88 * contentSize - {<OpenLayers.Size>} 89 89 * contentHTML - {String} 90 90 * anchor - {Object} Object to which we'll anchor the popup. Must expose … … 94 94 * closeBoxCallback - {Function} Function to be called on closeBox click. 95 95 */ 96 initialize:function(id, lonlat, size, contentHTML, anchor, closeBox,96 initialize:function(id, lonlat, contentSize, contentHTML, anchor, closeBox, 97 97 closeBoxCallback) { 98 98 … … 189 189 * 190 190 * Parameters: 191 * size - {<OpenLayers.Size>} 192 */ 193 setSize:function(size) { 191 * contentSize - {<OpenLayers.Size>} the new size for the popup's 192 * contents div (in pixels). 193 */ 194 setSize:function(contentSize) { 194 195 OpenLayers.Popup.Anchored.prototype.setSize.apply(this, arguments); 195 196 … … 297 298 } 298 299 299 if (this. relativePosition) {300 if (this.size && this.relativePosition) { 300 301 var position = this.positionBlocks[this.relativePosition]; 301 302 for (var i = 0; i < position.blocks.length; i++) { sandbox/camptocamp/unhcr/lib/OpenLayers/Popup/FramedCloud.js
r7785 r7920 204 204 * id - {String} 205 205 * lonlat - {<OpenLayers.LonLat>} 206 * size - {<OpenLayers.Size>}206 * contentSize - {<OpenLayers.Size>} 207 207 * contentHTML - {String} 208 208 * anchor - {Object} Object to which we'll anchor the popup. Must expose … … 212 212 * closeBoxCallback - {Function} Function to be called on closeBox click. 213 213 */ 214 initialize:function(id, lonlat, size, contentHTML, anchor, closeBox,214 initialize:function(id, lonlat, contentSize, contentHTML, anchor, closeBox, 215 215 closeBoxCallback) { 216 216 sandbox/camptocamp/unhcr/lib/OpenLayers/Renderer/Canvas.js
r7875 r7920 4 4 5 5 /** 6 * @requires OpenLayers/Renderer.js 7 */ 8 9 /** 6 10 * Class: OpenLayers.Renderer.Canvas 7 11 * A renderer based on the 2D 'canvas' drawing element.element 8 * 12 * 13 * Inherits: 14 * - <OpenLayers.Renderer> 9 15 */ 10 16 OpenLayers.Renderer.Canvas = OpenLayers.Class(OpenLayers.Renderer, { … … 37 43 38 44 /** 39 * Constructor: OpenLayers.Renderer 45 * Constructor: OpenLayers.Renderer.Canvas 40 46 * 41 47 * Parameters: … … 398 404 delete this.features[features[i].id]; 399 405 } 400 if (!this.locked) { 401 this.redraw(); 402 } 406 this.redraw(); 403 407 }, 404 408 sandbox/camptocamp/unhcr/lib/OpenLayers/Renderer/Elements.js
r7785 r7920 464 464 }; 465 465 466 //467 if (style.backgroundGraphic) {468 this.redrawBackgroundNode(geometry.id, geometry, style, featureId);469 }470 471 466 if (style.display != "none") { 472 this.redrawNode(geometry.id, geometry, style, featureId); 467 if (style.backgroundGraphic) { 468 this.redrawBackgroundNode(geometry.id, geometry, style, featureId); 469 } 470 this.redrawNode(geometry.id, geometry, style, featureId); 473 471 } else { 474 472 var node = OpenLayers.Util.getElement(geometry.id); 475 473 if (node) {
