Merge pull request #6361 from tchandelle/canvas-margin
Remove "margin" at the bottom of the canvas
This commit is contained in:
@@ -41,6 +41,7 @@ ol.renderer.canvas.Map = function(container, map) {
|
||||
|
||||
this.canvas_.style.width = '100%';
|
||||
this.canvas_.style.height = '100%';
|
||||
this.canvas_.style.display = 'block';
|
||||
this.canvas_.className = ol.css.CLASS_UNSELECTABLE;
|
||||
container.insertBefore(this.canvas_, container.childNodes[0] || null);
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ if (ol.ENABLE_WEBGL) {
|
||||
(document.createElement('CANVAS'));
|
||||
this.canvas_.style.width = '100%';
|
||||
this.canvas_.style.height = '100%';
|
||||
this.canvas_.style.display = 'block';
|
||||
this.canvas_.className = ol.css.CLASS_UNSELECTABLE;
|
||||
container.insertBefore(this.canvas_, container.childNodes[0] || null);
|
||||
|
||||
|
||||
@@ -36,6 +36,51 @@ describe('ol.rendering.Map', function() {
|
||||
return map;
|
||||
}
|
||||
|
||||
describe('#updateSize()', function() {
|
||||
var map, target;
|
||||
|
||||
function createMap(renderer) {
|
||||
target = document.createElement('div');
|
||||
document.body.appendChild(target);
|
||||
map = new ol.Map({
|
||||
renderer: renderer,
|
||||
controls: [],
|
||||
target: target,
|
||||
view: new ol.View({
|
||||
center: [0, 0],
|
||||
zoom: 2
|
||||
})
|
||||
});
|
||||
return map;
|
||||
}
|
||||
|
||||
afterEach(function() {
|
||||
map.setTarget(null);
|
||||
document.body.removeChild(target);
|
||||
});
|
||||
|
||||
it('tests the canvas renderer', function(done) {
|
||||
map = createMap('canvas');
|
||||
map.once('postrender', function() {
|
||||
var initialSize = map.getSize();
|
||||
map.updateSize();
|
||||
expect(map.getSize()).to.eql(initialSize);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('tests the WebGL renderer', function(done) {
|
||||
assertWebGL();
|
||||
map = createMap('webgl');
|
||||
map.once('postrender', function() {
|
||||
var initialSize = map.getSize();
|
||||
map.updateSize();
|
||||
expect(map.getSize()).to.eql(initialSize);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('#render()', function() {
|
||||
afterEach(function() {
|
||||
disposeMap(map);
|
||||
|
||||
Reference in New Issue
Block a user