Merge pull request #6361 from tchandelle/canvas-margin

Remove "margin" at the bottom of the canvas
This commit is contained in:
Andreas Hocevar
2017-02-06 14:47:16 +01:00
committed by GitHub
3 changed files with 47 additions and 0 deletions

View File

@@ -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);

View File

@@ -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);

View File

@@ -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);