Apply context options in handleImageChange

update tests
add new tests
This commit is contained in:
mike-000
2020-07-31 22:25:33 +01:00
parent 302bc662af
commit 95e506cf36
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,