Fix 'translate' in SvgToPdf
This commit is contained in:
parent
b4df711d37
commit
ee93c70867
1 changed files with 13 additions and 1 deletions
|
@ -67,12 +67,21 @@ class SvgToPdfInternals {
|
|||
if (t === null) {
|
||||
return null;
|
||||
}
|
||||
const scaleMatch = t.match(/scale\(([-0-9.]*)\)/)
|
||||
const scaleMatch = t.match(/scale\(([-0-9.]+)\)/)
|
||||
if (scaleMatch !== null) {
|
||||
const s = Number(scaleMatch[1])
|
||||
return SvgToPdfInternals.dummyDoc.Matrix(1 / s, 0, 0, 1 / s, 0, 0);
|
||||
}
|
||||
|
||||
const translateMatch = t.match(/translate\(([-0-9.]+), ?([-0-9.]*)\)/)
|
||||
if (translateMatch !== null) {
|
||||
const dx = Number(translateMatch[1])
|
||||
const dy = Number(translateMatch[2])
|
||||
console.log("Translating", dx, dy)
|
||||
return SvgToPdfInternals.dummyDoc.Matrix(1, 0, 0, 1, dx, dy);
|
||||
}
|
||||
|
||||
|
||||
const transformMatch = t.match(/matrix\(([-0-9.]*),([-0-9.]*),([-0-9.]*),([-0-9.]*),([-0-9.]*),([-0-9.]*)\)/)
|
||||
if (transformMatch !== null) {
|
||||
const vals = [1, 0, 0, 1, 0, 0]
|
||||
|
@ -449,6 +458,9 @@ class SvgToPdfInternals {
|
|||
}
|
||||
|
||||
public handleElement(element: SVGSVGElement | Element): void {
|
||||
if(element.id === "path15616"){
|
||||
console.log("Handling element", element)
|
||||
}
|
||||
const isTransformed = this.setTransform(element)
|
||||
try {
|
||||
|
||||
|
|
Loading…
Reference in a new issue