Spaces:
Running
Running
fix(post-image-designer): pass opts to _pidDrawTextWrapped so text renders on bg
Browse filesThe v19 'remove blur band behind text' change made _pidDrawTextWrapped read
opts._deepBand, but opts was not a parameter of that function. Under
'use strict' this raised a ReferenceError that was swallowed by the
try/catch in _pidRenderSlide, so only the background drew and the text
never appeared on the ảnh nền.
Fix: add opts as the 9th param and pass it at all 8 call sites. Bumped
cache-buster in index_v2.html.
- README.md +10 -0
- static/index_v2.html +1 -1
- static/post_image_designer.js +10 -10
README.md
CHANGED
|
@@ -13,6 +13,16 @@ tags:
|
|
| 13 |
|
| 14 |
**v19 - AI ảnh nền SenseNova-U1.5 + text overlay overhaul**
|
| 15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
## 🔧 Changes in v19 (2026-09-06)
|
| 17 |
- **AI ảnh nền**: upgraded to **SenseNova-U1.5-8B-MoT** (same model family as
|
| 18 |
the official `hugging-apps/sensenova-sensenova-u1-5-8b-mot` demo) with the
|
|
|
|
| 13 |
|
| 14 |
**v19 - AI ảnh nền SenseNova-U1.5 + text overlay overhaul**
|
| 15 |
|
| 16 |
+
## 🔧 Hotfix (2026-09-07) — chữ không hiện trên ảnh nền
|
| 17 |
+
|
| 18 |
+
"🖼️ Tạo Ảnh Bài Viết" modal: khi tính fi "High contrast, no blur" (loái bỏ nền
|
| 19 |
+
mờ/foggy band) đã giới thiệu, text overlay silently sp qué không vẽ — only the
|
| 20 |
+
background image rendered and the chữ disappeared. Root cause:
|
| 21 |
+
`_pidDrawTextWrapped` referenced `opts._deepBand` but `opts` was NOT a parameter
|
| 22 |
+
of that function (under `'use strict'` this raised a ReferenceError that was
|
| 23 |
+
swallowed by the try/catch in `_pidRenderSlide`). Fix: pass `opts` as the last
|
| 24 |
+
argument through all 8 call sites.
|
| 25 |
+
|
| 26 |
## 🔧 Changes in v19 (2026-09-06)
|
| 27 |
- **AI ảnh nền**: upgraded to **SenseNova-U1.5-8B-MoT** (same model family as
|
| 28 |
the official `hugging-apps/sensenova-sensenova-u1-5-8b-mot` demo) with the
|
static/index_v2.html
CHANGED
|
@@ -89,7 +89,7 @@ var SPACE=location.origin;
|
|
| 89 |
</script>
|
| 90 |
<script src="/static/app_v2.js?v=20260903livefootball"></script>
|
| 91 |
<script src="/static/designer_v2.js?v=20260907fix2"></script>
|
| 92 |
-
<script src="/static/post_image_designer.js?v=
|
| 93 |
<script src="/static/yt_live.js"></script>
|
| 94 |
<script src="/static/vtv_init.js"></script>
|
| 95 |
<script src="/static/hot_multi.js?v=1"></script>
|
|
|
|
| 89 |
</script>
|
| 90 |
<script src="/static/app_v2.js?v=20260903livefootball"></script>
|
| 91 |
<script src="/static/designer_v2.js?v=20260907fix2"></script>
|
| 92 |
+
<script src="/static/post_image_designer.js?v=20260907pidfix5"></script>
|
| 93 |
<script src="/static/yt_live.js"></script>
|
| 94 |
<script src="/static/vtv_init.js"></script>
|
| 95 |
<script src="/static/hot_multi.js?v=1"></script>
|
static/post_image_designer.js
CHANGED
|
@@ -265,7 +265,7 @@ function _pidFontScale(){
|
|
| 265 |
* High-contrast, crisp: solid clean band + black outline + optional glow.
|
| 266 |
* Returns the y position after the last drawn line.
|
| 267 |
*/
|
| 268 |
-
function _pidDrawTextWrapped(ctx, W, H, text, pos, color, glow, baseScale, maxLines){
|
| 269 |
if(!text || !text.trim()) return 0;
|
| 270 |
var fs = Math.max(20, Math.round(W * baseScale));
|
| 271 |
fs = Math.min(fs, Math.round(W * 0.095));
|
|
@@ -304,7 +304,7 @@ function _pidDrawTextWrapped(ctx, W, H, text, pos, color, glow, baseScale, maxLi
|
|
| 304 |
/* --- legibility without a black band: strong outline + optional glow.
|
| 305 |
The background image stays visible — only the text gets contrast.
|
| 306 |
A crisp band is drawn ONLY for the explicit 'blur' layout choice. --- */
|
| 307 |
-
var band = opts._deepBand || false; // set by _pidDrawText via layout===blur/split
|
| 308 |
if(band){
|
| 309 |
var bx = Math.round(W * 0.02);
|
| 310 |
var bw = W - 2 * bx;
|
|
@@ -352,19 +352,19 @@ function _pidDrawText(ctx, W, H, opts){
|
|
| 352 |
if(!overlay && !text) return;
|
| 353 |
if(overlay && text){
|
| 354 |
if(opts.pos === 'top'){
|
| 355 |
-
_pidDrawTextWrapped(ctx, W, H, overlay, 0.05, opts.color, opts.glow, fScale, 4);
|
| 356 |
-
_pidDrawTextWrapped(ctx, W, H, text, 0.44, opts.color, opts.glow, fScale * 0.8, 3);
|
| 357 |
} else if(opts.pos === 'bottom'){
|
| 358 |
-
_pidDrawTextWrapped(ctx, W, H, text, 0.38, opts.color, opts.glow, fScale * 0.8, 3);
|
| 359 |
-
_pidDrawTextWrapped(ctx, W, H, overlay, 0.76, opts.color, opts.glow, fScale, 4);
|
| 360 |
} else {
|
| 361 |
-
_pidDrawTextWrapped(ctx, W, H, overlay, 0.46, opts.color, opts.glow, fScale, 4);
|
| 362 |
-
_pidDrawTextWrapped(ctx, W, H, text, 0.72, opts.color, opts.glow, fScale * 0.78, 3);
|
| 363 |
}
|
| 364 |
} else if(overlay){
|
| 365 |
-
_pidDrawTextWrapped(ctx, W, H, overlay, opts.pos, opts.color, opts.glow, fScale, 6);
|
| 366 |
} else {
|
| 367 |
-
_pidDrawTextWrapped(ctx, W, H, text, opts.pos, opts.color, opts.glow, fScale, 5);
|
| 368 |
}
|
| 369 |
}
|
| 370 |
|
|
|
|
| 265 |
* High-contrast, crisp: solid clean band + black outline + optional glow.
|
| 266 |
* Returns the y position after the last drawn line.
|
| 267 |
*/
|
| 268 |
+
function _pidDrawTextWrapped(ctx, W, H, text, pos, color, glow, baseScale, maxLines, opts){
|
| 269 |
if(!text || !text.trim()) return 0;
|
| 270 |
var fs = Math.max(20, Math.round(W * baseScale));
|
| 271 |
fs = Math.min(fs, Math.round(W * 0.095));
|
|
|
|
| 304 |
/* --- legibility without a black band: strong outline + optional glow.
|
| 305 |
The background image stays visible — only the text gets contrast.
|
| 306 |
A crisp band is drawn ONLY for the explicit 'blur' layout choice. --- */
|
| 307 |
+
var band = (opts && opts._deepBand) || false; // set by _pidDrawText via layout===blur/split
|
| 308 |
if(band){
|
| 309 |
var bx = Math.round(W * 0.02);
|
| 310 |
var bw = W - 2 * bx;
|
|
|
|
| 352 |
if(!overlay && !text) return;
|
| 353 |
if(overlay && text){
|
| 354 |
if(opts.pos === 'top'){
|
| 355 |
+
_pidDrawTextWrapped(ctx, W, H, overlay, 0.05, opts.color, opts.glow, fScale, 4, opts);
|
| 356 |
+
_pidDrawTextWrapped(ctx, W, H, text, 0.44, opts.color, opts.glow, fScale * 0.8, 3, opts);
|
| 357 |
} else if(opts.pos === 'bottom'){
|
| 358 |
+
_pidDrawTextWrapped(ctx, W, H, text, 0.38, opts.color, opts.glow, fScale * 0.8, 3, opts);
|
| 359 |
+
_pidDrawTextWrapped(ctx, W, H, overlay, 0.76, opts.color, opts.glow, fScale, 4, opts);
|
| 360 |
} else {
|
| 361 |
+
_pidDrawTextWrapped(ctx, W, H, overlay, 0.46, opts.color, opts.glow, fScale, 4, opts);
|
| 362 |
+
_pidDrawTextWrapped(ctx, W, H, text, 0.72, opts.color, opts.glow, fScale * 0.78, 3, opts);
|
| 363 |
}
|
| 364 |
} else if(overlay){
|
| 365 |
+
_pidDrawTextWrapped(ctx, W, H, overlay, opts.pos, opts.color, opts.glow, fScale, 6, opts);
|
| 366 |
} else {
|
| 367 |
+
_pidDrawTextWrapped(ctx, W, H, text, opts.pos, opts.color, opts.glow, fScale, 5, opts);
|
| 368 |
}
|
| 369 |
}
|
| 370 |
|