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:
@@ -1,6 +1,7 @@
|
||||
/**
|
||||
* @module ol/transform
|
||||
*/
|
||||
import {WORKER_OFFSCREEN_CANVAS} from './has.js';
|
||||
import {assert} from './asserts.js';
|
||||
|
||||
/**
|
||||
@@ -265,11 +266,24 @@ export function determinant(mat) {
|
||||
}
|
||||
|
||||
/**
|
||||
* A string version of the transform. This can be used
|
||||
* @type {HTMLElement}
|
||||
* @private
|
||||
*/
|
||||
let transformStringDiv;
|
||||
|
||||
/**
|
||||
* A rounded string version of the transform. This can be used
|
||||
* for CSS transforms.
|
||||
* @param {!Transform} mat Matrix.
|
||||
* @return {string} The transform as a string.
|
||||
*/
|
||||
export function toString(mat) {
|
||||
return 'matrix(' + mat.join(', ') + ')';
|
||||
const transformString = 'matrix(' + mat.join(', ') + ')';
|
||||
if (WORKER_OFFSCREEN_CANVAS) {
|
||||
return transformString;
|
||||
}
|
||||
const node =
|
||||
transformStringDiv || (transformStringDiv = document.createElement('div'));
|
||||
node.style.transform = transformString;
|
||||
return node.style.transform;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user