Fix layer canvas reuse
If the scale values have more than 6 decimals they are rounded and can no longer be compared to the created transform string.
This commit is contained in:
@@ -7,7 +7,6 @@ import {WORKER_OFFSCREEN_CANVAS} from '../has.js';
|
||||
import {clear} from '../obj.js';
|
||||
import {createCanvasContext2D} from '../dom.js';
|
||||
import {getFontParameters} from '../css.js';
|
||||
import {toString} from '../transform.js';
|
||||
|
||||
/**
|
||||
* @typedef {Object} FillState
|
||||
@@ -489,25 +488,3 @@ function executeLabelInstructions(label, context) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @type {HTMLCanvasElement}
|
||||
* @private
|
||||
*/
|
||||
let createTransformStringCanvas = null;
|
||||
|
||||
/**
|
||||
* @param {import("../transform.js").Transform} transform Transform.
|
||||
* @return {string} CSS transform.
|
||||
*/
|
||||
export function createTransformString(transform) {
|
||||
if (WORKER_OFFSCREEN_CANVAS) {
|
||||
return toString(transform);
|
||||
} else {
|
||||
if (!createTransformStringCanvas) {
|
||||
createTransformStringCanvas = createCanvasContext2D(1, 1).canvas;
|
||||
}
|
||||
createTransformStringCanvas.style.transform = toString(transform);
|
||||
return createTransformStringCanvas.style.transform;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user