Merge pull request #13907 from MoonE/remove-ms-image-smoothing-enabled

Remove IE fallbacks
This commit is contained in:
MoonE
2022-07-30 23:58:55 +02:00
committed by GitHub
17 changed files with 24 additions and 94 deletions

View File

@@ -172,7 +172,6 @@ li {
}
.navigation li.item .title {
cursor: pointer;
display: -ms-flexbox;
display: flex;
font-size: 0.85em;
}

View File

@@ -139,14 +139,9 @@ function download(fullpath, filename) {
return response.blob();
})
.then(function (blob) {
if (navigator.msSaveBlob) {
// link download attribute does not work on MS browsers
navigator.msSaveBlob(blob, filename);
} else {
link.href = URL.createObjectURL(blob);
link.download = filename;
link.click();
}
link.href = URL.createObjectURL(blob);
link.download = filename;
link.click();
});
}

View File

@@ -107,14 +107,9 @@ function download(fullpath, filename) {
return response.blob();
})
.then(function (blob) {
if (navigator.msSaveBlob) {
// link download attribute does not work on MS browsers
navigator.msSaveBlob(blob, filename);
} else {
link.href = URL.createObjectURL(blob);
link.download = filename;
link.click();
}
link.href = URL.createObjectURL(blob);
link.download = filename;
link.click();
});
}

View File

@@ -101,14 +101,9 @@ function download(fullpath, filename) {
return response.blob();
})
.then(function (blob) {
if (navigator.msSaveBlob) {
// link download attribute does not work on MS browsers
navigator.msSaveBlob(blob, filename);
} else {
link.href = URL.createObjectURL(blob);
link.download = filename;
link.click();
}
link.href = URL.createObjectURL(blob);
link.download = filename;
link.click();
});
}

View File

@@ -99,14 +99,9 @@ document.getElementById('export-png').addEventListener('click', function () {
}
);
mapContext.globalAlpha = 1;
if (navigator.msSaveBlob) {
// link download attribute does not work on MS browsers
navigator.msSaveBlob(mapCanvas.msToBlob(), 'map.png');
} else {
const link = document.getElementById('image-download');
link.href = mapCanvas.toDataURL();
link.click();
}
const link = document.getElementById('image-download');
link.href = mapCanvas.toDataURL();
link.click();
});
map.renderSync();
});

View File

@@ -2,9 +2,6 @@
height: 100%;
margin: 0;
}
.map:-ms-fullscreen {
height: 100%;
}
.map:fullscreen {
height: 100%;
}

View File

@@ -2,9 +2,6 @@
height: 100%;
margin: 0;
}
.fullscreen:-ms-fullscreen {
height: 100%;
}
.fullscreen:fullscreen {
height: 100%;

View File

@@ -2,9 +2,6 @@
height: 100%;
margin: 0;
}
.map:-ms-fullscreen {
height: 100%;
}
.map:fullscreen {
height: 100%;
}

View File

@@ -8,9 +8,6 @@
height: 100%;
margin: 0;
}
.map:-ms-fullscreen {
height: 100%;
}
.map:fullscreen {
height: 100%;
}

View File

@@ -36,12 +36,11 @@
codepenButton.href = form.action;
codepenButton.addEventListener('click', function (event) {
event.preventDefault();
const innerText = document.documentMode ? 'textContent' : 'innerText';
const html = document.getElementById('example-html-source')[innerText];
const js = document.getElementById('example-js-source')[innerText];
const html = document.getElementById('example-html-source').innerText;
const js = document.getElementById('example-js-source').innerText;
const workerContainer = document.getElementById('example-worker-source');
const worker = workerContainer ? workerContainer[innerText] : undefined;
const pkgJson = document.getElementById('example-pkg-source')[innerText];
const worker = workerContainer ? workerContainer.innerText : undefined;
const pkgJson = document.getElementById('example-pkg-source').innerText;
const unique = new Set();
const localResources = (js.match(/'(\.\/)?data\/[^']*/g) || [])

View File

@@ -345,7 +345,6 @@ function isFullScreenSupported(doc) {
const body = doc.body;
return !!(
body['webkitRequestFullscreen'] ||
(body['msRequestFullscreen'] && doc['msFullscreenEnabled']) ||
(body.requestFullscreen && doc.fullscreenEnabled)
);
}
@@ -355,11 +354,7 @@ function isFullScreenSupported(doc) {
* @return {boolean} Element is currently in fullscreen.
*/
function isFullScreen(doc) {
return !!(
doc['webkitIsFullScreen'] ||
doc['msFullscreenElement'] ||
doc.fullscreenElement
);
return !!(doc['webkitIsFullScreen'] || doc.fullscreenElement);
}
/**
@@ -369,8 +364,6 @@ function isFullScreen(doc) {
function requestFullScreen(element) {
if (element.requestFullscreen) {
element.requestFullscreen();
} else if (element['msRequestFullscreen']) {
element['msRequestFullscreen']();
} else if (element['webkitRequestFullscreen']) {
element['webkitRequestFullscreen']();
}
@@ -395,8 +388,6 @@ function requestFullScreenWithKeys(element) {
function exitFullScreen(doc) {
if (doc.exitFullscreen) {
doc.exitFullscreen();
} else if (doc['msExitFullscreen']) {
doc['msExitFullscreen']();
} else if (doc['webkitExitFullscreen']) {
doc['webkitExitFullscreen']();
}

View File

@@ -78,7 +78,6 @@
-webkit-touch-callout: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
-webkit-tap-highlight-color: rgba(0,0,0,0);
}
@@ -89,7 +88,6 @@
-webkit-touch-callout: default;
-webkit-user-select: text;
-moz-user-select: text;
-ms-user-select: text;
user-select: text;
}
.ol-grabbing {

View File

@@ -5,7 +5,6 @@ import CanvasLayerRenderer from './Layer.js';
import ImageState from '../../ImageState.js';
import ViewHint from '../../ViewHint.js';
import {ENABLE_RASTER_REPROJECTION} from '../../reproj/common.js';
import {IMAGE_SMOOTHING_DISABLED, IMAGE_SMOOTHING_ENABLED} from './common.js';
import {
apply as applyTransform,
compose as composeTransform,
@@ -238,7 +237,7 @@ class CanvasImageLayerRenderer extends CanvasLayerRenderer {
const dh = img.height * transform[3];
if (!this.getLayer().getSource().getInterpolate()) {
Object.assign(context, IMAGE_SMOOTHING_DISABLED);
context.imageSmoothingEnabled = false;
}
this.preRender(context, frameState);
@@ -261,7 +260,7 @@ class CanvasImageLayerRenderer extends CanvasLayerRenderer {
if (clipped) {
context.restore();
}
Object.assign(context, IMAGE_SMOOTHING_ENABLED);
context.imageSmoothingEnabled = true;
if (canvasTransform !== canvas.style.transform) {
canvas.style.transform = canvasTransform;

View File

@@ -6,7 +6,6 @@ import ImageTile from '../../ImageTile.js';
import ReprojTile from '../../reproj/Tile.js';
import TileRange from '../../TileRange.js';
import TileState from '../../TileState.js';
import {IMAGE_SMOOTHING_DISABLED, IMAGE_SMOOTHING_ENABLED} from './common.js';
import {
apply as applyTransform,
compose as composeTransform,
@@ -410,7 +409,7 @@ class CanvasTileLayerRenderer extends CanvasLayerRenderer {
}
if (!tileSource.getInterpolate()) {
Object.assign(context, IMAGE_SMOOTHING_DISABLED);
context.imageSmoothingEnabled = false;
}
this.preRender(context, frameState);
@@ -561,7 +560,7 @@ class CanvasTileLayerRenderer extends CanvasLayerRenderer {
if (layerState.extent) {
context.restore();
}
Object.assign(context, IMAGE_SMOOTHING_ENABLED);
context.imageSmoothingEnabled = true;
if (canvasTransform !== canvas.style.transform) {
canvas.style.transform = canvasTransform;

View File

@@ -1,21 +0,0 @@
/**
* @module ol/renderer/canvas/common
*/
/**
* Context options to disable image smoothing.
* @type {Object}
*/
export const IMAGE_SMOOTHING_DISABLED = {
imageSmoothingEnabled: false,
msImageSmoothingEnabled: false,
};
/**
* Context options to enable image smoothing.
* @type {Object}
*/
export const IMAGE_SMOOTHING_ENABLED = {
imageSmoothingEnabled: true,
msImageSmoothingEnabled: true,
};

View File

@@ -1,7 +1,6 @@
/**
* @module ol/reproj
*/
import {IMAGE_SMOOTHING_DISABLED} from './renderer/canvas/common.js';
import {
containsCoordinate,
createEmpty,
@@ -226,7 +225,7 @@ export function render(
);
if (!opt_interpolate) {
Object.assign(context, IMAGE_SMOOTHING_DISABLED);
context.imageSmoothingEnabled = false;
}
if (sources.length === 0) {
@@ -254,7 +253,7 @@ export function render(
);
if (!opt_interpolate) {
Object.assign(stitchContext, IMAGE_SMOOTHING_DISABLED);
stitchContext.imageSmoothingEnabled = false;
}
const stitchScale = pixelRatio / sourceResolution;

View File

@@ -6,7 +6,6 @@ import EventType from '../events/EventType.js';
import ImageSource, {defaultImageLoadFunction} from './Image.js';
import ImageState from '../ImageState.js';
import ImageWrapper from '../Image.js';
import {IMAGE_SMOOTHING_DISABLED} from '../renderer/canvas/common.js';
import {createCanvasContext2D} from '../dom.js';
import {getHeight, getWidth, intersects} from '../extent.js';
import {get as getProjection} from '../proj.js';
@@ -157,7 +156,7 @@ class Static extends ImageSource {
if (targetWidth !== imageWidth || targetHeight !== imageHeight) {
const context = createCanvasContext2D(targetWidth, targetHeight);
if (!this.getInterpolate()) {
Object.assign(context, IMAGE_SMOOTHING_DISABLED);
context.imageSmoothingEnabled = false;
}
const canvas = context.canvas;
context.drawImage(