- 拆分:tools/split.js 重切新版(1347 模块 / 126 代码模块),主文件 main.7cfa4058.js,语法验证通过 - 修复 split.js 内自动刷新拦截的 \\n 转义:它在模板字符串里,必须写 \\\\n,否则生成的主文件字符串断行、语法报错 - 符号映射:map_symbols.js 对齐旧→新(qyr→ryz、w187→c18o、z4t→jtn、vgt→rkt、Bmt→Ezt、Qjt→Fjt、txt→Gjt、k15b→s15n、azi_1→vzr_1…) - 移植 7 处针对性修改:炮塔摆头不回弹(vSt.ryz)、摆头不过冲(case 0)、精准跟手(case 1/2)、悬浮底盘 raw 两级(Ezt.n36 + Zmt 实际速度)、电磁炮蓄力时长(jtn.c18o) - 重新打包 unpacked.pack.json(127 文件 / 版本 96833eb2b0cf8909)
71 lines
2.3 KiB
JavaScript
71 lines
2.3 KiB
JavaScript
// ============================================================
|
|
// Module ID: 15330
|
|
// ============================================================
|
|
;(window.__modules__ = window.__modules__ || {})[15330] = (t, n) => {
|
|
function i(t) {
|
|
if (("number" == typeof t && (t = t.toString()), "string" != typeof t))
|
|
throw new Error("Color should be defined as hex string");
|
|
let n = t.slice().replace("#", "").split("");
|
|
if (n.length < 3 || 5 === n.length || n.length > 8) throw new Error("Invalid hex color: " + t);
|
|
((3 !== n.length && 4 !== n.length) ||
|
|
(n = Array.prototype.concat.apply(
|
|
[],
|
|
n.map(function (t) {
|
|
return [t, t];
|
|
}),
|
|
)),
|
|
6 === n.length && n.push("F", "F"));
|
|
const i = parseInt(n.join(""), 16);
|
|
return {
|
|
r: (i >> 24) & 255,
|
|
g: (i >> 16) & 255,
|
|
b: (i >> 8) & 255,
|
|
a: 255 & i,
|
|
hex: "#" + n.slice(0, 6).join(""),
|
|
};
|
|
}
|
|
((n.getOptions = function (t) {
|
|
(t || (t = {}), t.color || (t.color = {}));
|
|
const n = void 0 === t.margin || null === t.margin || t.margin < 0 ? 4 : t.margin,
|
|
r = t.width && t.width >= 21 ? t.width : void 0,
|
|
e = t.scale || 4;
|
|
return {
|
|
width: r,
|
|
scale: r ? 4 : e,
|
|
margin: n,
|
|
color: { dark: i(t.color.dark || "#000000ff"), light: i(t.color.light || "#ffffffff") },
|
|
type: t.type,
|
|
rendererOpts: t.rendererOpts || {},
|
|
};
|
|
}),
|
|
(n.getScale = function (t, n) {
|
|
return n.width && n.width >= t + 2 * n.margin ? n.width / (t + 2 * n.margin) : n.scale;
|
|
}),
|
|
(n.getImageWidth = function (t, i) {
|
|
const r = n.getScale(t, i);
|
|
return Math.floor((t + 2 * i.margin) * r);
|
|
}),
|
|
(n.qrToImageData = function (t, i, r) {
|
|
const e = i.modules.size,
|
|
u = i.modules.data,
|
|
s = n.getScale(e, r),
|
|
o = Math.floor((e + 2 * r.margin) * s),
|
|
_ = r.margin * s,
|
|
a = [r.color.light, r.color.dark];
|
|
for (let n = 0; n < o; n++)
|
|
for (let i = 0; i < o; i++) {
|
|
let h = 4 * (n * o + i),
|
|
c = r.color.light;
|
|
(n >= _ &&
|
|
i >= _ &&
|
|
n < o - _ &&
|
|
i < o - _ &&
|
|
(c = a[u[Math.floor((n - _) / s) * e + Math.floor((i - _) / s)] ? 1 : 0]),
|
|
(t[h++] = c.r),
|
|
(t[h++] = c.g),
|
|
(t[h++] = c.b),
|
|
(t[h] = c.a));
|
|
}
|
|
}));
|
|
};
|