Merge branch '2.12'
This commit is contained in:
@@ -57,6 +57,7 @@ function init() {
|
||||
|
||||
// create the select feature control
|
||||
var selector = new OpenLayers.Control.SelectFeature(vector,{
|
||||
hover:true,
|
||||
autoActivate:true
|
||||
});
|
||||
|
||||
|
||||
@@ -414,4 +414,4 @@
|
||||
/**
|
||||
* Constant: VERSION_NUMBER
|
||||
*/
|
||||
OpenLayers.VERSION_NUMBER="Release 2.12-rc1";
|
||||
OpenLayers.VERSION_NUMBER="Release 2.12-rc2";
|
||||
|
||||
@@ -1292,6 +1292,11 @@ OpenLayers.Layer = OpenLayers.Class({
|
||||
var childNodes = this.div.childNodes;
|
||||
for(var i = 0, len = childNodes.length; i < len; ++i) {
|
||||
var element = childNodes[i].firstChild || childNodes[i];
|
||||
var lastChild = childNodes[i].lastChild;
|
||||
//TODO de-uglify this
|
||||
if (lastChild && lastChild.nodeName.toLowerCase() === "iframe") {
|
||||
element = lastChild.parentNode;
|
||||
}
|
||||
OpenLayers.Util.modifyDOMElement(element, null, null, null,
|
||||
null, null, null, opacity);
|
||||
}
|
||||
|
||||
@@ -1634,8 +1634,10 @@ OpenLayers.Map = OpenLayers.Class({
|
||||
this.panTo(newCenterLonLat);
|
||||
} else {
|
||||
this.moveTo(newCenterLonLat);
|
||||
this.dragging = false;
|
||||
this.events.triggerEvent("moveend");
|
||||
if(this.dragging) {
|
||||
this.dragging = false;
|
||||
this.events.triggerEvent("moveend");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ var OpenLayers = {
|
||||
/**
|
||||
* Constant: VERSION_NUMBER
|
||||
*/
|
||||
VERSION_NUMBER: "Release 2.12-rc1",
|
||||
VERSION_NUMBER: "Release 2.12-rc2",
|
||||
|
||||
/**
|
||||
* Constant: singleFile
|
||||
|
||||
@@ -211,7 +211,8 @@ OpenLayers.Tile.Image = OpenLayers.Class(OpenLayers.Tile, {
|
||||
*/
|
||||
positionTile: function() {
|
||||
var style = this.getTile().style,
|
||||
size = this.layer.getImageSize(this.bounds);
|
||||
size = this.frame ? this.size :
|
||||
this.layer.getImageSize(this.bounds);
|
||||
style.left = this.position.x + "%";
|
||||
style.top = this.position.y + "%";
|
||||
style.width = size.w + "%";
|
||||
@@ -254,11 +255,16 @@ OpenLayers.Tile.Image = OpenLayers.Class(OpenLayers.Tile, {
|
||||
this.imgDiv.galleryImg = "no";
|
||||
|
||||
var style = this.imgDiv.style;
|
||||
if (this.layer.gutter) {
|
||||
var left = this.layer.gutter / this.layer.tileSize.w * 100;
|
||||
var top = this.layer.gutter / this.layer.tileSize.h * 100;
|
||||
if (this.frame) {
|
||||
var left = 0, top = 0;
|
||||
if (this.layer.gutter) {
|
||||
left = this.layer.gutter / this.layer.tileSize.w * 100;
|
||||
top = this.layer.gutter / this.layer.tileSize.h * 100;
|
||||
}
|
||||
style.left = -left + "%";
|
||||
style.top = -top + "%";
|
||||
style.width = (2 * left + 100) + "%";
|
||||
style.height = (2 * top + 100) + "%";
|
||||
}
|
||||
style.visibility = "hidden";
|
||||
style.opacity = 0;
|
||||
@@ -275,8 +281,6 @@ OpenLayers.Tile.Image = OpenLayers.Class(OpenLayers.Tile, {
|
||||
style.width = "100%";
|
||||
}
|
||||
if (this.frame) {
|
||||
style.width = "100%";
|
||||
style.height = "100%";
|
||||
this.frame.appendChild(this.imgDiv);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,6 +196,19 @@ OpenLayers.Tile.Image.IFrame = {
|
||||
OpenLayers.Tile.Image.prototype.setImgSrc.apply(this, arguments);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: onImageLoad
|
||||
* Handler for the image onload event
|
||||
*/
|
||||
onImageLoad: function() {
|
||||
//TODO de-uglify opacity handling
|
||||
OpenLayers.Tile.Image.prototype.onImageLoad.apply(this, arguments);
|
||||
if (this.useIFrame === true) {
|
||||
this.imgDiv.style.opacity = 1;
|
||||
this.frame.style.opacity = this.layer.opacity;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: createBackBuffer
|
||||
|
||||
@@ -1712,7 +1712,36 @@
|
||||
t.eq(log[1], "move", "followed by move,");
|
||||
t.eq(log[log.length-2], "move", "move again before we stop panning,");
|
||||
t.eq(log[log.length-1], "moveend", "and moveend when we're done.");
|
||||
|
||||
}
|
||||
|
||||
function test_pan_no_anim_event_sequence(t) {
|
||||
t.plan(4);
|
||||
|
||||
var log = [];
|
||||
var map = new OpenLayers.Map("map");
|
||||
map.addLayer(
|
||||
new OpenLayers.Layer(null, {isBaseLayer: true})
|
||||
);
|
||||
map.setCenter(new OpenLayers.LonLat(0, 0), 5);
|
||||
map.events.on({
|
||||
"movestart": function() {
|
||||
log.push("movestart");
|
||||
},
|
||||
"move": function() {
|
||||
log.push("move");
|
||||
},
|
||||
"moveend": function() {
|
||||
log.push("moveend");
|
||||
}
|
||||
});
|
||||
|
||||
map.pan(5,5, {animate: false});
|
||||
t.eq(log.length, 3, "no more than 3 events happen.");
|
||||
t.eq(log[0], "movestart", "pan sequence starts with movestart");
|
||||
t.eq(log[1], "move", "followed by move,");
|
||||
t.eq(log[2], "moveend", "and moveend when we're done.");
|
||||
|
||||
map.destroy();
|
||||
}
|
||||
|
||||
// test if we can call updateSize before document.body is ready. updateOk
|
||||
|
||||
@@ -399,6 +399,97 @@
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* A series of tests to verify the dimensions and positions
|
||||
* of the tile frame and img after draw.
|
||||
|
||||
* Written for https://github.com/openlayers/openlayers/issues/441
|
||||
*/
|
||||
function test_draw_without_gutter_without_frame(t) {
|
||||
t.plan(5);
|
||||
|
||||
var map = new OpenLayers.Map('map');
|
||||
var layer = new OpenLayers.Layer.WMS('blank',
|
||||
'../../img/blank.gif',
|
||||
{layers: 'fake'},
|
||||
{isBaseLayer: true});
|
||||
map.addLayer(layer);
|
||||
var tile = new OpenLayers.Tile.Image(
|
||||
layer,
|
||||
new OpenLayers.Pixel(6, 6),
|
||||
new OpenLayers.Bounds(5, 45, 6, 46),
|
||||
null,
|
||||
new OpenLayers.Size(256, 256));
|
||||
|
||||
tile.draw();
|
||||
t.eq(tile.frame, null, 'no frame');
|
||||
t.eq(parseInt(tile.imgDiv.style.left, 10), 6, 'correct tile img left');
|
||||
t.eq(parseInt(tile.imgDiv.style.top, 10), 6, 'correct tile img top');
|
||||
t.eq(parseInt(tile.imgDiv.style.width, 10), 256, 'correct tile img width');
|
||||
t.eq(parseInt(tile.imgDiv.style.height, 10), 256, 'correct tile img height');
|
||||
|
||||
map.destroy();
|
||||
}
|
||||
function test_draw_without_gutter_with_frame(t) {
|
||||
t.plan(8);
|
||||
|
||||
var map = new OpenLayers.Map('map');
|
||||
var layer = new OpenLayers.Layer.WMS('blank',
|
||||
'../../img/blank.gif',
|
||||
{layers: 'fake'},
|
||||
{isBaseLayer: true});
|
||||
map.addLayer(layer);
|
||||
layer.gutter = 1; // this is just for a frame to be created for
|
||||
// the tile
|
||||
var tile = new OpenLayers.Tile.Image(
|
||||
layer,
|
||||
new OpenLayers.Pixel(6, 6),
|
||||
new OpenLayers.Bounds(5, 45, 6, 46),
|
||||
null,
|
||||
new OpenLayers.Size(256, 256));
|
||||
layer.gutter = null;
|
||||
|
||||
tile.draw();
|
||||
t.eq(parseInt(tile.frame.style.left, 10), 6, 'correct tile frame left');
|
||||
t.eq(parseInt(tile.frame.style.top, 10), 6, 'correct tile frame top');
|
||||
t.eq(parseInt(tile.frame.style.width, 10), 256, 'correct tile frame width');
|
||||
t.eq(parseInt(tile.frame.style.height, 10), 256, 'correct tile frame height');
|
||||
t.eq(parseInt(tile.imgDiv.style.left, 10), 0, 'correct tile img left');
|
||||
t.eq(parseInt(tile.imgDiv.style.top, 10), 0, 'correct tile img top');
|
||||
t.eq(parseInt(tile.imgDiv.style.width, 10), 100, 'correct tile img width');
|
||||
t.eq(parseInt(tile.imgDiv.style.height, 10), 100, 'correct tile img height');
|
||||
|
||||
map.destroy();
|
||||
}
|
||||
function test_draw_with_gutter(t) {
|
||||
t.plan(8);
|
||||
|
||||
var map = new OpenLayers.Map('map');
|
||||
var layer = new OpenLayers.Layer.WMS('blank',
|
||||
'../../img/blank.gif',
|
||||
{layers: 'fake'},
|
||||
{isBaseLayer: true, gutter: 15});
|
||||
map.addLayer(layer);
|
||||
var tile = new OpenLayers.Tile.Image(
|
||||
layer,
|
||||
new OpenLayers.Pixel(6, 6),
|
||||
new OpenLayers.Bounds(5, 45, 6, 46),
|
||||
null,
|
||||
new OpenLayers.Size(256, 256));
|
||||
|
||||
tile.draw();
|
||||
t.eq(parseInt(tile.frame.style.left, 10), 6, 'correct tile frame left');
|
||||
t.eq(parseInt(tile.frame.style.top, 10), 6, 'correct tile frame top');
|
||||
t.eq(parseInt(tile.frame.style.width, 10), 256, 'correct tile frame width');
|
||||
t.eq(parseInt(tile.frame.style.height, 10), 256, 'correct tile frame height');
|
||||
t.eq(parseInt(tile.imgDiv.style.left, 10), -5, 'correct tile img left');
|
||||
t.eq(parseInt(tile.imgDiv.style.top, 10), -5, 'correct tile img top');
|
||||
t.eq(parseInt(tile.imgDiv.style.width, 10), 111, 'correct tile img width');
|
||||
t.eq(parseInt(tile.imgDiv.style.height, 10), 111, 'correct tile img height');
|
||||
|
||||
map.destroy();
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
Reference in New Issue
Block a user