Addressed Review comment
This commit is contained in:
@@ -36,8 +36,8 @@ var map = new ol.Map({
|
|||||||
document.getElementById('export-png').addEventListener('click', function() {
|
document.getElementById('export-png').addEventListener('click', function() {
|
||||||
map.once('postcompose', function(event) {
|
map.once('postcompose', function(event) {
|
||||||
var canvas = event.context.canvas;
|
var canvas = event.context.canvas;
|
||||||
if (isIE()) {
|
if (navigator.msSaveBlob) {
|
||||||
window.navigator.msSaveBlob(canvas.msToBlob(), 'map.png');
|
navigator.msSaveBlob(canvas.msToBlob(), 'map.png');
|
||||||
} else {
|
} else {
|
||||||
canvas.toBlob(function(blob) {
|
canvas.toBlob(function(blob) {
|
||||||
saveAs(blob, 'map.png');
|
saveAs(blob, 'map.png');
|
||||||
@@ -46,16 +46,3 @@ document.getElementById('export-png').addEventListener('click', function() {
|
|||||||
});
|
});
|
||||||
map.renderSync();
|
map.renderSync();
|
||||||
});
|
});
|
||||||
|
|
||||||
function isIE() {
|
|
||||||
var sAgent = window.navigator.userAgent;
|
|
||||||
var Idx = sAgent.indexOf('MSIE');
|
|
||||||
// If IE, return true.
|
|
||||||
if (Idx > 0)
|
|
||||||
return true;
|
|
||||||
// If IE 11 then look for Updated user agent string.
|
|
||||||
else if (navigator.userAgent.match(/Trident\/7\./))
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user