dsh-mpkg-wallpaper 3.13.5 → 3.13.6
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/lib/client.js +34 -3
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -5725,7 +5725,9 @@ function mpwThumbFail(el, why) {
|
|
|
5725
5725
|
const c2 = canvas.getContext("2d");
|
|
5726
5726
|
if (!c2) return;
|
|
5727
5727
|
const layers = manifest.layers || [];
|
|
5728
|
-
|
|
5728
|
+
/* ①(P-184) 清单里一层都没有:也落一次**0 层**戳 —— 否则会留着上一份同 key 清单的旧戳,
|
|
5729
|
+
慢判就会把"这份清单没画面"误读成"画出来了"(与"所有层加载失败"同一条口径:如实判没画出来)。 */
|
|
5730
|
+
if (!layers.length) { mpwScenePaintStamp(canvas, manifest.key, 0); return; }
|
|
5729
5731
|
sceneImgs = layers.map(() => null);
|
|
5730
5732
|
let pending = layers.length;
|
|
5731
5733
|
const draw = () => {
|
|
@@ -5738,13 +5740,18 @@ function mpwThumbFail(el, why) {
|
|
|
5738
5740
|
// 图层定位:清单坐标是场景包围盒内偏移([0,W]×[0,H]),
|
|
5739
5741
|
// 场景中心 = (W/2, H/2) 对齐屏幕中心。
|
|
5740
5742
|
const offX = manifest.w / 2, offY = manifest.h / 2;
|
|
5743
|
+
let drawn = 0;
|
|
5741
5744
|
for (let i = 0; i < layers.length; i++) {
|
|
5742
5745
|
const im = sceneImgs[i];
|
|
5743
5746
|
const l = layers[i];
|
|
5744
5747
|
if (!im || !im.width || !im.height) continue;
|
|
5745
5748
|
const w = l.w * scale, h = l.h * scale;
|
|
5746
5749
|
c2.drawImage(im, cx + (l.x - offX) * scale - w / 2, cy + (l.y - offY) * scale - h / 2, w, h);
|
|
5750
|
+
drawn++;
|
|
5747
5751
|
}
|
|
5752
|
+
/* ①(2026-09-25 P-184) 落**画过戳**:只认"真的画了几层 + 画的是哪一份清单"(见
|
|
5753
|
+
`mpwScenePaintStamp` 的注释)。0 层 ⇒ 戳为 0 ⇒ 慢判如实判"没画出来"并补一次 + 告警。 */
|
|
5754
|
+
mpwScenePaintStamp(canvas, manifest.key, drawn);
|
|
5748
5755
|
};
|
|
5749
5756
|
layers.forEach((l, i) => {
|
|
5750
5757
|
const im = new Image();
|
|
@@ -5858,12 +5865,36 @@ function mpwThumbFail(el, why) {
|
|
|
5858
5865
|
· 慢判(12s):有 src 但**一直没有画面** ⇒ 强制重挂一次(同签名只做一次)。
|
|
5859
5866
|
诚实边界:转码档(host 正在转)不判死 —— 它有自己的超时回退(见 showVideoEl 后面的
|
|
5860
5867
|
`__mpwTransLoadingTimeout`),在后面推它只会把转码重来一遍。 */
|
|
5868
|
+
/* ①(2026-09-25 P-184) 场景合成的"画过"戳:**逐层计数**(`mpwScenePaintStamp`/`mpwScenePainted`)。
|
|
5869
|
+
为什么必须换成戳:慢判(12s"有 src 但一直没有画面 ⇒ 强制重挂一次")原来对 scene 档用的判据是
|
|
5870
|
+
`canvas.width > 0` —— 而 `draw()` **一开始**就按视口设宽高、`clearRect` 之后逐层 `drawImage`,
|
|
5871
|
+
**所有图层都加载失败时**(真机:图层 URL 404 / token 失效 / 清单里全是坏 url)宽高照样被设上
|
|
5872
|
+
⇒ 判据退化成"元素存在",慢判恒为"画出来了"、自愈永不触发,用户看到的是**永久空白且无自愈**。
|
|
5873
|
+
现在只有**真的 `drawImage` 过 ≥1 层、且那一次画的正是当前 sceneKey** 才算"画出来了"。
|
|
5874
|
+
(抽成两个只用 canvas 普通字段的小函数,是为了让门禁能单独切出来跑真实现:
|
|
5875
|
+
`tools/bgpaint-heal-test.mjs`;也便于宿主/探针读同一处口径。) */
|
|
5876
|
+
function mpwScenePaintStamp(canvas, key, drawn) {
|
|
5877
|
+
try {
|
|
5878
|
+
if (!canvas) return 0;
|
|
5879
|
+
canvas.__mpwBgDrawnLayers = Number(drawn) || 0;
|
|
5880
|
+
canvas.__mpwBgDrawnKey = String(key == null ? "" : key);
|
|
5881
|
+
canvas.__mpwBgDrawnAt = (typeof Date !== "undefined" && Date.now) ? Date.now() : 0;
|
|
5882
|
+
return canvas.__mpwBgDrawnLayers;
|
|
5883
|
+
} catch { return 0 }
|
|
5884
|
+
}
|
|
5885
|
+
function mpwScenePainted(canvas, key) {
|
|
5886
|
+
try {
|
|
5887
|
+
if (!canvas) return false;
|
|
5888
|
+
if (!((Number(canvas.__mpwBgDrawnLayers) || 0) > 0)) return false;
|
|
5889
|
+
return String(canvas.__mpwBgDrawnKey || "") === String(key == null ? "" : key);
|
|
5890
|
+
} catch { return false }
|
|
5891
|
+
}
|
|
5861
5892
|
function mpwBgPaintedNow(section) {
|
|
5862
5893
|
try {
|
|
5863
5894
|
const { img, video, canvas, wrap } = bgElements();
|
|
5864
5895
|
if (!wrap) return true;
|
|
5865
5896
|
if (section.webUrl) return true; // 帧内画面看不见,不越权判死
|
|
5866
|
-
if (section.converted === "scene" && section.sceneKey) return
|
|
5897
|
+
if (section.converted === "scene" && section.sceneKey) return mpwScenePainted(canvas, section.sceneKey);
|
|
5867
5898
|
if (section.converted === "mp4") {
|
|
5868
5899
|
if (!video) return true;
|
|
5869
5900
|
let st = "";
|
|
@@ -5937,7 +5968,7 @@ function mpwThumbFail(el, why) {
|
|
|
5937
5968
|
}
|
|
5938
5969
|
try { applyFromStorageInner() } catch (e) { mpwErr("壁纸源补挂", e) }
|
|
5939
5970
|
}
|
|
5940
|
-
try { window.__mpwBgWrapState = () => ({ fixOn: mpwBgWrapFixOn(), heal: (() => { try { return window.__mpwBgSrcHeal || 0 } catch { return -1 } })(), last: __mpwBgHeal, paintedNow: (() => { try { return mpwBgPaintedNow(normalizeSection(readSection())) } catch { return null } })() }) } catch {}
|
|
5971
|
+
try { window.__mpwBgWrapState = () => ({ fixOn: mpwBgWrapFixOn(), heal: (() => { try { return window.__mpwBgSrcHeal || 0 } catch { return -1 } })(), last: __mpwBgHeal, paintedNow: (() => { try { return mpwBgPaintedNow(normalizeSection(readSection())) } catch { return null } })(), drawn: (() => { try { const c = bgElements().canvas; return c ? { layers: Number(c.__mpwBgDrawnLayers) || 0, key: String(c.__mpwBgDrawnKey || ""), at: Number(c.__mpwBgDrawnAt) || 0 } : null } catch { return null } })() }) } catch {}
|
|
5941
5972
|
/* ═══ ①(2026-09-16 根治) 设置归一化:**必须是模块级函数** ═══
|
|
5942
5973
|
历史 bug("标题栏磨砂一直没有效果"的真根因,真机 diag 实锤):
|
|
5943
5974
|
`__asStr` / `normalizeSection` 原本定义在 `applyFromStorageInner()` **函数体内**
|
package/package.json
CHANGED