emf-converter 4.8.21 → 4.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.js +9 -7
- package/dist/browser.mjs +9 -7
- package/dist/index.js +9 -7
- package/dist/index.mjs +9 -7
- package/package.json +1 -1
package/dist/browser.js
CHANGED
|
@@ -29643,7 +29643,7 @@ var Outliner = class {
|
|
|
29643
29643
|
this.flush();
|
|
29644
29644
|
}
|
|
29645
29645
|
};
|
|
29646
|
-
function dashPieces(P, tangents, curveFlags, pattern, shorten, wholePixelVectors) {
|
|
29646
|
+
function dashPieces(P, tangents, curveFlags, pattern, shorten, wholePixelVectors, metric) {
|
|
29647
29647
|
const out = [];
|
|
29648
29648
|
const dashes = [];
|
|
29649
29649
|
for (let i = 0; i < pattern.length; i += 2) {
|
|
@@ -29663,8 +29663,8 @@ function dashPieces(P, tangents, curveFlags, pattern, shorten, wholePixelVectors
|
|
|
29663
29663
|
const [x0, y0] = P[i];
|
|
29664
29664
|
const [x1, y1] = P[i + 1];
|
|
29665
29665
|
const dir = [x1 - x0, y1 - y0];
|
|
29666
|
-
const real = Math.hypot(dir[0], dir[1]);
|
|
29667
|
-
const len = wholePixelVectors ? Math.hypot(Math.floor(dir[0] / 16), Math.floor(dir[1] / 16)) * 16 : Math.hypot(dir[0], dir[1]);
|
|
29666
|
+
const real = metric ? Math.hypot(dir[0] / metric[0], dir[1] / metric[1]) : Math.hypot(dir[0], dir[1]);
|
|
29667
|
+
const len = metric ? real : wholePixelVectors ? Math.hypot(Math.floor(dir[0] / 16), Math.floor(dir[1] / 16)) * 16 : Math.hypot(dir[0], dir[1]);
|
|
29668
29668
|
if (len === 0) {
|
|
29669
29669
|
if (on && cur) {
|
|
29670
29670
|
cur.pts.push(P[i + 1]);
|
|
@@ -29737,10 +29737,10 @@ function widenPath(path, opts) {
|
|
|
29737
29737
|
}
|
|
29738
29738
|
if (dashed) {
|
|
29739
29739
|
const run = closed ? [...P, P[0]] : P;
|
|
29740
|
-
const shorten = opts.cap === "flat" || opts.shortenDashes === false ? 0 : opts.width;
|
|
29740
|
+
const shorten = opts.cap === "flat" || opts.shortenDashes === false ? 0 : opts.dashMetric ? opts.width / opts.dashMetric[0] : opts.width;
|
|
29741
29741
|
const runTangents = closed ? [...dirs, void 0] : dirs;
|
|
29742
29742
|
const runCurves = closed ? [...curves, !!fig.roundWiden] : curves;
|
|
29743
|
-
for (const piece of dashPieces(run, runTangents, runCurves, opts.dashes, shorten, !!opts.wholePixelDashVectors)) {
|
|
29743
|
+
for (const piece of dashPieces(run, runTangents, runCurves, opts.dashes, shorten, !!opts.wholePixelDashVectors, opts.dashMetric)) {
|
|
29744
29744
|
const pts = [piece.pts[0]];
|
|
29745
29745
|
const pdirs = [];
|
|
29746
29746
|
const pdraws = [];
|
|
@@ -30007,8 +30007,9 @@ function penWidenOptions(rCtx, opts = {}) {
|
|
|
30007
30007
|
const widthPx = rCtx.wholeDevicePixels && (flags & 15) === 6 ? state.penWidth * Math.sqrt(Math.abs(matrix[0] * matrix[3] - matrix[1] * matrix[2])) : penDeviceWidth(rCtx);
|
|
30008
30008
|
const capBits = flags & 3840;
|
|
30009
30009
|
const joinBits = flags & 61440;
|
|
30010
|
-
const
|
|
30011
|
-
const
|
|
30010
|
+
const ellipse = !rCtx.wholeDevicePixels && state.penWidth * Math.abs(matrix[0]) * 16 >= 1 && state.penWidth * Math.abs(matrix[3]) * 16 >= 1 && Math.abs(matrix[1]) < 1e-6 && Math.abs(matrix[2]) < 1e-6 && Math.abs(Math.abs(matrix[0]) - Math.abs(matrix[3])) > 1e-6;
|
|
30011
|
+
const dashes = state.penExtended ? ellipse ? geometricStyle(flags, state.penWidth, state.penUserStyle, 1) : geometricStyle(flags, widthPx, state.penUserStyle, widthPx / (state.penWidth || 1)) : null;
|
|
30012
|
+
const dashMetric = ellipse && dashes ? [Math.abs(matrix[0]), Math.abs(matrix[3])] : void 0;
|
|
30012
30013
|
return {
|
|
30013
30014
|
width: Math.round((ellipse ? state.penWidth * Math.abs(matrix[0]) : widthPx) * 16),
|
|
30014
30015
|
...ellipse ? { height: Math.round(state.penWidth * Math.abs(matrix[3]) * 16) } : {},
|
|
@@ -30016,6 +30017,7 @@ function penWidenOptions(rCtx, opts = {}) {
|
|
|
30016
30017
|
join: opts.roundPen ? "round" : opts.rectangle && !state.penExtended ? "miter" : !state.penExtended || joinBits === 0 ? "round" : joinBits === 4096 ? "bevel" : "miter",
|
|
30017
30018
|
miterLimit: state.miterLimit ?? 10,
|
|
30018
30019
|
dashes: dashes ? dashes.map((v) => v * 16) : null,
|
|
30020
|
+
...dashMetric ? { dashMetric } : {},
|
|
30019
30021
|
shortenDashes: (flags & 15) !== 7,
|
|
30020
30022
|
// One logical unit per device pixel, unrotated: GDI measures dash
|
|
30021
30023
|
// segments in whole pixels.
|
package/dist/browser.mjs
CHANGED
|
@@ -29641,7 +29641,7 @@ var Outliner = class {
|
|
|
29641
29641
|
this.flush();
|
|
29642
29642
|
}
|
|
29643
29643
|
};
|
|
29644
|
-
function dashPieces(P, tangents, curveFlags, pattern, shorten, wholePixelVectors) {
|
|
29644
|
+
function dashPieces(P, tangents, curveFlags, pattern, shorten, wholePixelVectors, metric) {
|
|
29645
29645
|
const out = [];
|
|
29646
29646
|
const dashes = [];
|
|
29647
29647
|
for (let i = 0; i < pattern.length; i += 2) {
|
|
@@ -29661,8 +29661,8 @@ function dashPieces(P, tangents, curveFlags, pattern, shorten, wholePixelVectors
|
|
|
29661
29661
|
const [x0, y0] = P[i];
|
|
29662
29662
|
const [x1, y1] = P[i + 1];
|
|
29663
29663
|
const dir = [x1 - x0, y1 - y0];
|
|
29664
|
-
const real = Math.hypot(dir[0], dir[1]);
|
|
29665
|
-
const len = wholePixelVectors ? Math.hypot(Math.floor(dir[0] / 16), Math.floor(dir[1] / 16)) * 16 : Math.hypot(dir[0], dir[1]);
|
|
29664
|
+
const real = metric ? Math.hypot(dir[0] / metric[0], dir[1] / metric[1]) : Math.hypot(dir[0], dir[1]);
|
|
29665
|
+
const len = metric ? real : wholePixelVectors ? Math.hypot(Math.floor(dir[0] / 16), Math.floor(dir[1] / 16)) * 16 : Math.hypot(dir[0], dir[1]);
|
|
29666
29666
|
if (len === 0) {
|
|
29667
29667
|
if (on && cur) {
|
|
29668
29668
|
cur.pts.push(P[i + 1]);
|
|
@@ -29735,10 +29735,10 @@ function widenPath(path, opts) {
|
|
|
29735
29735
|
}
|
|
29736
29736
|
if (dashed) {
|
|
29737
29737
|
const run = closed ? [...P, P[0]] : P;
|
|
29738
|
-
const shorten = opts.cap === "flat" || opts.shortenDashes === false ? 0 : opts.width;
|
|
29738
|
+
const shorten = opts.cap === "flat" || opts.shortenDashes === false ? 0 : opts.dashMetric ? opts.width / opts.dashMetric[0] : opts.width;
|
|
29739
29739
|
const runTangents = closed ? [...dirs, void 0] : dirs;
|
|
29740
29740
|
const runCurves = closed ? [...curves, !!fig.roundWiden] : curves;
|
|
29741
|
-
for (const piece of dashPieces(run, runTangents, runCurves, opts.dashes, shorten, !!opts.wholePixelDashVectors)) {
|
|
29741
|
+
for (const piece of dashPieces(run, runTangents, runCurves, opts.dashes, shorten, !!opts.wholePixelDashVectors, opts.dashMetric)) {
|
|
29742
29742
|
const pts = [piece.pts[0]];
|
|
29743
29743
|
const pdirs = [];
|
|
29744
29744
|
const pdraws = [];
|
|
@@ -30005,8 +30005,9 @@ function penWidenOptions(rCtx, opts = {}) {
|
|
|
30005
30005
|
const widthPx = rCtx.wholeDevicePixels && (flags & 15) === 6 ? state.penWidth * Math.sqrt(Math.abs(matrix[0] * matrix[3] - matrix[1] * matrix[2])) : penDeviceWidth(rCtx);
|
|
30006
30006
|
const capBits = flags & 3840;
|
|
30007
30007
|
const joinBits = flags & 61440;
|
|
30008
|
-
const
|
|
30009
|
-
const
|
|
30008
|
+
const ellipse = !rCtx.wholeDevicePixels && state.penWidth * Math.abs(matrix[0]) * 16 >= 1 && state.penWidth * Math.abs(matrix[3]) * 16 >= 1 && Math.abs(matrix[1]) < 1e-6 && Math.abs(matrix[2]) < 1e-6 && Math.abs(Math.abs(matrix[0]) - Math.abs(matrix[3])) > 1e-6;
|
|
30009
|
+
const dashes = state.penExtended ? ellipse ? geometricStyle(flags, state.penWidth, state.penUserStyle, 1) : geometricStyle(flags, widthPx, state.penUserStyle, widthPx / (state.penWidth || 1)) : null;
|
|
30010
|
+
const dashMetric = ellipse && dashes ? [Math.abs(matrix[0]), Math.abs(matrix[3])] : void 0;
|
|
30010
30011
|
return {
|
|
30011
30012
|
width: Math.round((ellipse ? state.penWidth * Math.abs(matrix[0]) : widthPx) * 16),
|
|
30012
30013
|
...ellipse ? { height: Math.round(state.penWidth * Math.abs(matrix[3]) * 16) } : {},
|
|
@@ -30014,6 +30015,7 @@ function penWidenOptions(rCtx, opts = {}) {
|
|
|
30014
30015
|
join: opts.roundPen ? "round" : opts.rectangle && !state.penExtended ? "miter" : !state.penExtended || joinBits === 0 ? "round" : joinBits === 4096 ? "bevel" : "miter",
|
|
30015
30016
|
miterLimit: state.miterLimit ?? 10,
|
|
30016
30017
|
dashes: dashes ? dashes.map((v) => v * 16) : null,
|
|
30018
|
+
...dashMetric ? { dashMetric } : {},
|
|
30017
30019
|
shortenDashes: (flags & 15) !== 7,
|
|
30018
30020
|
// One logical unit per device pixel, unrotated: GDI measures dash
|
|
30019
30021
|
// segments in whole pixels.
|
package/dist/index.js
CHANGED
|
@@ -29644,7 +29644,7 @@ var Outliner = class {
|
|
|
29644
29644
|
this.flush();
|
|
29645
29645
|
}
|
|
29646
29646
|
};
|
|
29647
|
-
function dashPieces(P, tangents, curveFlags, pattern, shorten, wholePixelVectors) {
|
|
29647
|
+
function dashPieces(P, tangents, curveFlags, pattern, shorten, wholePixelVectors, metric) {
|
|
29648
29648
|
const out = [];
|
|
29649
29649
|
const dashes = [];
|
|
29650
29650
|
for (let i = 0; i < pattern.length; i += 2) {
|
|
@@ -29664,8 +29664,8 @@ function dashPieces(P, tangents, curveFlags, pattern, shorten, wholePixelVectors
|
|
|
29664
29664
|
const [x0, y0] = P[i];
|
|
29665
29665
|
const [x1, y1] = P[i + 1];
|
|
29666
29666
|
const dir = [x1 - x0, y1 - y0];
|
|
29667
|
-
const real = Math.hypot(dir[0], dir[1]);
|
|
29668
|
-
const len = wholePixelVectors ? Math.hypot(Math.floor(dir[0] / 16), Math.floor(dir[1] / 16)) * 16 : Math.hypot(dir[0], dir[1]);
|
|
29667
|
+
const real = metric ? Math.hypot(dir[0] / metric[0], dir[1] / metric[1]) : Math.hypot(dir[0], dir[1]);
|
|
29668
|
+
const len = metric ? real : wholePixelVectors ? Math.hypot(Math.floor(dir[0] / 16), Math.floor(dir[1] / 16)) * 16 : Math.hypot(dir[0], dir[1]);
|
|
29669
29669
|
if (len === 0) {
|
|
29670
29670
|
if (on && cur) {
|
|
29671
29671
|
cur.pts.push(P[i + 1]);
|
|
@@ -29738,10 +29738,10 @@ function widenPath(path, opts) {
|
|
|
29738
29738
|
}
|
|
29739
29739
|
if (dashed) {
|
|
29740
29740
|
const run = closed ? [...P, P[0]] : P;
|
|
29741
|
-
const shorten = opts.cap === "flat" || opts.shortenDashes === false ? 0 : opts.width;
|
|
29741
|
+
const shorten = opts.cap === "flat" || opts.shortenDashes === false ? 0 : opts.dashMetric ? opts.width / opts.dashMetric[0] : opts.width;
|
|
29742
29742
|
const runTangents = closed ? [...dirs, void 0] : dirs;
|
|
29743
29743
|
const runCurves = closed ? [...curves, !!fig.roundWiden] : curves;
|
|
29744
|
-
for (const piece of dashPieces(run, runTangents, runCurves, opts.dashes, shorten, !!opts.wholePixelDashVectors)) {
|
|
29744
|
+
for (const piece of dashPieces(run, runTangents, runCurves, opts.dashes, shorten, !!opts.wholePixelDashVectors, opts.dashMetric)) {
|
|
29745
29745
|
const pts = [piece.pts[0]];
|
|
29746
29746
|
const pdirs = [];
|
|
29747
29747
|
const pdraws = [];
|
|
@@ -30008,8 +30008,9 @@ function penWidenOptions(rCtx, opts = {}) {
|
|
|
30008
30008
|
const widthPx = rCtx.wholeDevicePixels && (flags & 15) === 6 ? state.penWidth * Math.sqrt(Math.abs(matrix[0] * matrix[3] - matrix[1] * matrix[2])) : penDeviceWidth(rCtx);
|
|
30009
30009
|
const capBits = flags & 3840;
|
|
30010
30010
|
const joinBits = flags & 61440;
|
|
30011
|
-
const
|
|
30012
|
-
const
|
|
30011
|
+
const ellipse = !rCtx.wholeDevicePixels && state.penWidth * Math.abs(matrix[0]) * 16 >= 1 && state.penWidth * Math.abs(matrix[3]) * 16 >= 1 && Math.abs(matrix[1]) < 1e-6 && Math.abs(matrix[2]) < 1e-6 && Math.abs(Math.abs(matrix[0]) - Math.abs(matrix[3])) > 1e-6;
|
|
30012
|
+
const dashes = state.penExtended ? ellipse ? geometricStyle(flags, state.penWidth, state.penUserStyle, 1) : geometricStyle(flags, widthPx, state.penUserStyle, widthPx / (state.penWidth || 1)) : null;
|
|
30013
|
+
const dashMetric = ellipse && dashes ? [Math.abs(matrix[0]), Math.abs(matrix[3])] : void 0;
|
|
30013
30014
|
return {
|
|
30014
30015
|
width: Math.round((ellipse ? state.penWidth * Math.abs(matrix[0]) : widthPx) * 16),
|
|
30015
30016
|
...ellipse ? { height: Math.round(state.penWidth * Math.abs(matrix[3]) * 16) } : {},
|
|
@@ -30017,6 +30018,7 @@ function penWidenOptions(rCtx, opts = {}) {
|
|
|
30017
30018
|
join: opts.roundPen ? "round" : opts.rectangle && !state.penExtended ? "miter" : !state.penExtended || joinBits === 0 ? "round" : joinBits === 4096 ? "bevel" : "miter",
|
|
30018
30019
|
miterLimit: state.miterLimit ?? 10,
|
|
30019
30020
|
dashes: dashes ? dashes.map((v) => v * 16) : null,
|
|
30021
|
+
...dashMetric ? { dashMetric } : {},
|
|
30020
30022
|
shortenDashes: (flags & 15) !== 7,
|
|
30021
30023
|
// One logical unit per device pixel, unrotated: GDI measures dash
|
|
30022
30024
|
// segments in whole pixels.
|
package/dist/index.mjs
CHANGED
|
@@ -29642,7 +29642,7 @@ var Outliner = class {
|
|
|
29642
29642
|
this.flush();
|
|
29643
29643
|
}
|
|
29644
29644
|
};
|
|
29645
|
-
function dashPieces(P, tangents, curveFlags, pattern, shorten, wholePixelVectors) {
|
|
29645
|
+
function dashPieces(P, tangents, curveFlags, pattern, shorten, wholePixelVectors, metric) {
|
|
29646
29646
|
const out = [];
|
|
29647
29647
|
const dashes = [];
|
|
29648
29648
|
for (let i = 0; i < pattern.length; i += 2) {
|
|
@@ -29662,8 +29662,8 @@ function dashPieces(P, tangents, curveFlags, pattern, shorten, wholePixelVectors
|
|
|
29662
29662
|
const [x0, y0] = P[i];
|
|
29663
29663
|
const [x1, y1] = P[i + 1];
|
|
29664
29664
|
const dir = [x1 - x0, y1 - y0];
|
|
29665
|
-
const real = Math.hypot(dir[0], dir[1]);
|
|
29666
|
-
const len = wholePixelVectors ? Math.hypot(Math.floor(dir[0] / 16), Math.floor(dir[1] / 16)) * 16 : Math.hypot(dir[0], dir[1]);
|
|
29665
|
+
const real = metric ? Math.hypot(dir[0] / metric[0], dir[1] / metric[1]) : Math.hypot(dir[0], dir[1]);
|
|
29666
|
+
const len = metric ? real : wholePixelVectors ? Math.hypot(Math.floor(dir[0] / 16), Math.floor(dir[1] / 16)) * 16 : Math.hypot(dir[0], dir[1]);
|
|
29667
29667
|
if (len === 0) {
|
|
29668
29668
|
if (on && cur) {
|
|
29669
29669
|
cur.pts.push(P[i + 1]);
|
|
@@ -29736,10 +29736,10 @@ function widenPath(path, opts) {
|
|
|
29736
29736
|
}
|
|
29737
29737
|
if (dashed) {
|
|
29738
29738
|
const run = closed ? [...P, P[0]] : P;
|
|
29739
|
-
const shorten = opts.cap === "flat" || opts.shortenDashes === false ? 0 : opts.width;
|
|
29739
|
+
const shorten = opts.cap === "flat" || opts.shortenDashes === false ? 0 : opts.dashMetric ? opts.width / opts.dashMetric[0] : opts.width;
|
|
29740
29740
|
const runTangents = closed ? [...dirs, void 0] : dirs;
|
|
29741
29741
|
const runCurves = closed ? [...curves, !!fig.roundWiden] : curves;
|
|
29742
|
-
for (const piece of dashPieces(run, runTangents, runCurves, opts.dashes, shorten, !!opts.wholePixelDashVectors)) {
|
|
29742
|
+
for (const piece of dashPieces(run, runTangents, runCurves, opts.dashes, shorten, !!opts.wholePixelDashVectors, opts.dashMetric)) {
|
|
29743
29743
|
const pts = [piece.pts[0]];
|
|
29744
29744
|
const pdirs = [];
|
|
29745
29745
|
const pdraws = [];
|
|
@@ -30006,8 +30006,9 @@ function penWidenOptions(rCtx, opts = {}) {
|
|
|
30006
30006
|
const widthPx = rCtx.wholeDevicePixels && (flags & 15) === 6 ? state.penWidth * Math.sqrt(Math.abs(matrix[0] * matrix[3] - matrix[1] * matrix[2])) : penDeviceWidth(rCtx);
|
|
30007
30007
|
const capBits = flags & 3840;
|
|
30008
30008
|
const joinBits = flags & 61440;
|
|
30009
|
-
const
|
|
30010
|
-
const
|
|
30009
|
+
const ellipse = !rCtx.wholeDevicePixels && state.penWidth * Math.abs(matrix[0]) * 16 >= 1 && state.penWidth * Math.abs(matrix[3]) * 16 >= 1 && Math.abs(matrix[1]) < 1e-6 && Math.abs(matrix[2]) < 1e-6 && Math.abs(Math.abs(matrix[0]) - Math.abs(matrix[3])) > 1e-6;
|
|
30010
|
+
const dashes = state.penExtended ? ellipse ? geometricStyle(flags, state.penWidth, state.penUserStyle, 1) : geometricStyle(flags, widthPx, state.penUserStyle, widthPx / (state.penWidth || 1)) : null;
|
|
30011
|
+
const dashMetric = ellipse && dashes ? [Math.abs(matrix[0]), Math.abs(matrix[3])] : void 0;
|
|
30011
30012
|
return {
|
|
30012
30013
|
width: Math.round((ellipse ? state.penWidth * Math.abs(matrix[0]) : widthPx) * 16),
|
|
30013
30014
|
...ellipse ? { height: Math.round(state.penWidth * Math.abs(matrix[3]) * 16) } : {},
|
|
@@ -30015,6 +30016,7 @@ function penWidenOptions(rCtx, opts = {}) {
|
|
|
30015
30016
|
join: opts.roundPen ? "round" : opts.rectangle && !state.penExtended ? "miter" : !state.penExtended || joinBits === 0 ? "round" : joinBits === 4096 ? "bevel" : "miter",
|
|
30016
30017
|
miterLimit: state.miterLimit ?? 10,
|
|
30017
30018
|
dashes: dashes ? dashes.map((v) => v * 16) : null,
|
|
30019
|
+
...dashMetric ? { dashMetric } : {},
|
|
30018
30020
|
shortenDashes: (flags & 15) !== 7,
|
|
30019
30021
|
// One logical unit per device pixel, unrotated: GDI measures dash
|
|
30020
30022
|
// segments in whole pixels.
|