Merge pull request #11378 from mike-000/patch-7

Fix imageSmoothing: false when ImageStatic is stretched to fit extent
This commit is contained in:
Andreas Hocevar
2020-08-02 21:35:24 +02:00
committed by GitHub
11 changed files with 63 additions and 2 deletions

View File

@@ -6,6 +6,7 @@ import EventType from '../events/EventType.js';
import ImageSource, {defaultImageLoadFunction} from './Image.js';
import ImageState from '../ImageState.js';
import ImageWrapper from '../Image.js';
import {assign} from '../obj.js';
import {createCanvasContext2D} from '../dom.js';
import {getHeight, getWidth, intersects} from '../extent.js';
import {get as getProjection} from '../proj.js';
@@ -138,6 +139,7 @@ class Static extends ImageSource {
const targetWidth = Math.ceil(getWidth(imageExtent) / resolution);
if (targetWidth != imageWidth) {
const context = createCanvasContext2D(targetWidth, imageHeight);
assign(context, this.getContextOptions());
const canvas = context.canvas;
context.drawImage(
image,