#529 give tiles gutters - all layers that use Tile.Image must now look after layer.imageSize and layer.imageOffset - this is handled by layer.setTileSize - for untiled layers, setTileSize must be defined by the subclass - gutters are currently supported in Layer.Mapserver and Layer.WMS
git-svn-id: http://svn.openlayers.org/trunk/openlayers@2979 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -15,6 +15,13 @@ OpenLayers.Tile.Image.prototype =
|
||||
/** @type DOMElement img */
|
||||
imgDiv: null,
|
||||
|
||||
/**
|
||||
* The image element is appended to the frame. Any gutter on the image
|
||||
* will be hidden behind the frame.
|
||||
*
|
||||
* @type DOMElement div */
|
||||
frame: null,
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*
|
||||
@@ -26,6 +33,9 @@ OpenLayers.Tile.Image.prototype =
|
||||
*/
|
||||
initialize: function(layer, position, bounds, url, size) {
|
||||
OpenLayers.Tile.prototype.initialize.apply(this, arguments);
|
||||
this.frame = document.createElement('div');
|
||||
this.frame.style.overflow = 'hidden';
|
||||
this.frame.style.position = 'absolute';
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -34,12 +44,16 @@ OpenLayers.Tile.Image.prototype =
|
||||
destroy: function() {
|
||||
if (this.imgDiv != null) {
|
||||
OpenLayers.Event.stopObservingElement(this.imgDiv.id);
|
||||
if (this.imgDiv.parentNode == this.layer.div) {
|
||||
this.layer.div.removeChild(this.imgDiv);
|
||||
if (this.imgDiv.parentNode == this.frame) {
|
||||
this.frame.removeChild(this.imgDiv);
|
||||
this.imgDiv.map = null;
|
||||
}
|
||||
}
|
||||
this.imgDiv = null;
|
||||
if ((this.frame != null) && (this.frame.parentNode == this.layer.div)) {
|
||||
this.layer.div.removeChild(this.frame);
|
||||
}
|
||||
this.frame = null;
|
||||
OpenLayers.Tile.prototype.destroy.apply(this, arguments);
|
||||
},
|
||||
|
||||
@@ -60,14 +74,17 @@ OpenLayers.Tile.Image.prototype =
|
||||
this.imgDiv.viewRequestID = this.layer.map.viewRequestID;
|
||||
|
||||
this.url = this.layer.getURL(this.bounds);
|
||||
|
||||
// position the frame
|
||||
OpenLayers.Util.modifyDOMElement(this.frame,
|
||||
null, this.position, this.size);
|
||||
|
||||
if (this.layer.alpha) {
|
||||
OpenLayers.Util.modifyAlphaImageDiv(this.imgDiv,
|
||||
null, this.position, this.size, this.url);
|
||||
null, null, this.layer.imageSize, this.url);
|
||||
} else {
|
||||
this.imgDiv.src = this.url;
|
||||
OpenLayers.Util.modifyDOMElement(this.imgDiv,
|
||||
null, this.position, this.size) ;
|
||||
null, null, this.layer.imageSize) ;
|
||||
}
|
||||
this.drawn = true;
|
||||
return true;
|
||||
@@ -102,20 +119,20 @@ OpenLayers.Tile.Image.prototype =
|
||||
initImgDiv: function() {
|
||||
if (this.layer.alpha) {
|
||||
this.imgDiv = OpenLayers.Util.createAlphaImageDiv(null,
|
||||
this.position,
|
||||
this.size,
|
||||
this.layer.imageOffset,
|
||||
this.layer.imageSize,
|
||||
null,
|
||||
"absolute",
|
||||
"relative",
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
true);
|
||||
} else {
|
||||
this.imgDiv = OpenLayers.Util.createImage(null,
|
||||
this.position,
|
||||
this.size,
|
||||
this.layer.imageOffset,
|
||||
this.layer.imageSize,
|
||||
null,
|
||||
"absolute",
|
||||
"relative",
|
||||
null,
|
||||
null,
|
||||
true);
|
||||
@@ -131,7 +148,9 @@ OpenLayers.Tile.Image.prototype =
|
||||
OpenLayers.Event.observe( this.imgDiv, "load",
|
||||
this.checkImgURL.bindAsEventListener(this) );
|
||||
*/
|
||||
this.layer.div.appendChild(this.imgDiv);
|
||||
this.frame.appendChild(this.imgDiv);
|
||||
this.layer.div.appendChild(this.frame);
|
||||
|
||||
if(this.layer.opacity != null) {
|
||||
|
||||
OpenLayers.Util.modifyDOMElement(this.imgDiv, null, null, null,
|
||||
|
||||
Reference in New Issue
Block a user