Use the DOMSVGFactory, rather than manually creating the SVG-element, in createMatrix (PR 13361 follow-up)

Generally, in the `src/display/` folder, we utilize `DOMSVGFactory` rather than manually creating an SVG-element; hence let's do the same thing in `src/display/pattern_helper.js` as well.
This commit is contained in:
Jonas Jenwald 2021-06-07 10:07:19 +02:00
parent 2b63d97b9d
commit 9e632ee323

View File

@ -20,6 +20,7 @@ import {
unreachable,
Util,
} from "../shared/util.js";
import { DOMSVGFactory } from "./display_utils.js";
let svgElement;
@ -29,7 +30,8 @@ function createMatrix(matrix) {
return new DOMMatrix(matrix);
}
if (!svgElement) {
svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg");
const svgFactory = new DOMSVGFactory();
svgElement = svgFactory.createElement("svg");
}
return svgElement.createSVGMatrix(matrix);
}