Files
discord-decomp/_bundle/extractStroke.js
T
2026-11-01 12:12:55 +02:00

71 lines
2.1 KiB
JavaScript

// Metro module 8551 (f8552).
import extractBrush from "./extractBrush";
import extractOpacity from "./extractOpacity";
import extractLengthList from "./extractLengthList";
let c5482_2 = {
butt: 0,
square: 2,
round: 1
};
let c5482_3 = {
miter: 0,
bevel: 2,
round: 1
};
let c5482_4 = {
none: 0,
default: 0,
nonScalingStroke: 1,
"non-scaling-stroke": 1,
inherit: 2,
uri: 3
};
export default function extractStroke(a0, { stroke, strokeOpacity, strokeLinecap, strokeLinejoin, strokeDasharray, strokeWidth, strokeDashoffset, strokeMiterlimit, vectorEffect }, a2) {
if (stroke != null) {
a2.push("stroke");
a0.stroke = extractBrush(stroke);
}
if (strokeWidth != null) {
a2.push("strokeWidth");
a0.strokeWidth = strokeWidth;
}
if (strokeOpacity != null) {
a2.push("strokeOpacity");
a0.strokeOpacity = extractOpacity(strokeOpacity);
}
if (strokeDasharray != null) {
a2.push("strokeDasharray");
const r40 = strokeDasharray ? strokeDasharray !== "none" ? extractLengthList(strokeDasharray) : null : null;
a0.strokeDasharray = r40 ? r40.length % 2 === 1 ? r40.concat(r40) : r40 : r40;
}
if (strokeDashoffset != null) {
a2.push("strokeDashoffset");
a0.strokeDashoffset = strokeDasharray ? strokeDashoffset ? +strokeDashoffset || 0 : null : null;
}
if (strokeLinecap != null) {
a2.push("strokeLinecap");
a0.strokeLinecap = strokeLinecap && c5482_2[strokeLinecap] || 0;
}
if (strokeLinejoin != null) {
a2.push("strokeLinejoin");
a0.strokeLinejoin = strokeLinejoin && c5482_3[strokeLinejoin] || 0;
}
if (strokeMiterlimit != null) {
a2.push("strokeMiterlimit");
let strokeMiterlimit2 = strokeMiterlimit;
if (strokeMiterlimit) {
strokeMiterlimit2 = strokeMiterlimit;
if (typeof strokeMiterlimit2 !== "number") {
strokeMiterlimit2 = parseFloat(strokeMiterlimit);
}
}
if (!strokeMiterlimit2) {
strokeMiterlimit2 = 4;
}
a0.strokeMiterlimit = strokeMiterlimit2;
}
if (vectorEffect != null) {
a0.vectorEffect = vectorEffect && c5482_4[vectorEffect] || 0;
}
};