Fix 2 loi UX sua-trong-form tren file Canva: (1) sau commit tra lai anh goc ngay + hint 'Dang ap dung...' thay vi hien anh-render-an (chu cu da xoa) nhieu giay gay cam giac chu bien mat; (2) vong no indices reflow noi pad DOC 8pt - dau tieng Viet (nga cua E~) ve bang op rieng co tam ngoai bbox+2pt nen sot lai dau lo lung sau sua
Build Windows portable / build (push) Canceled after 0s
Build Windows portable / build (push) Canceled after 0s
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
+5
-2
@@ -2770,9 +2770,12 @@ function startBlockTextEdit(o, lines, ev) {
|
|||||||
ce.remove();
|
ce.remove();
|
||||||
ov.querySelectorAll(".edit-box").forEach((b) => { b.style.display = ""; });
|
ov.querySelectorAll(".edit-box").forEach((b) => { b.style.display = ""; });
|
||||||
const changed = save && text.trim() && text !== original;
|
const changed = save && text.trim() && text !== original;
|
||||||
// Huỷ/không đổi gì → trả lại ảnh trang gốc (đang hiện bản ẩn run sửa).
|
// LUÔN trả lại ảnh trang gốc ngay (đang hiện bản ẩn run sửa): trong lúc
|
||||||
if (!changed && bgSwapped) img.src = prevSrc;
|
// engine áp thay đổi (file phức tạp mất vài giây) người dùng thấy chữ CŨ
|
||||||
|
// thay vì khoảng trống — hết cảm giác "chữ biến mất".
|
||||||
|
if (bgSwapped) img.src = prevSrc;
|
||||||
if (changed) {
|
if (changed) {
|
||||||
|
$("editHint").textContent = "Đang áp dụng thay đổi…";
|
||||||
stageEditOp({
|
stageEditOp({
|
||||||
op: "reflowText",
|
op: "reflowText",
|
||||||
indices: allRuns.map((r) => r.index),
|
indices: allRuns.map((r) => r.index),
|
||||||
|
|||||||
@@ -931,17 +931,23 @@ pub fn apply_edits(
|
|||||||
bb.top = bb.top.max(r.top);
|
bb.top = bb.top.max(r.top);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let pad = 2.0;
|
// Nới DỌC rộng hơn ngang: dấu tiếng Việt (ngã của Ễ…)
|
||||||
|
// nhiều file (Canva) vẽ bằng op riêng nằm TRÊN cap —
|
||||||
|
// tâm ngoài bbox +2pt → sót lại dấu lơ lửng sau sửa.
|
||||||
|
// 8pt vẫn nhỏ hơn nhịp dòng (≥12pt) nên không nuốt
|
||||||
|
// nhầm dòng bên cạnh.
|
||||||
|
let pad_x = 2.0;
|
||||||
|
let pad_y = 8.0;
|
||||||
for i in 0..entries.len() as u16 {
|
for i in 0..entries.len() as u16 {
|
||||||
if idxs.contains(&i) {
|
if idxs.contains(&i) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
let Some(r) = text_rect(i) else { continue };
|
let Some(r) = text_rect(i) else { continue };
|
||||||
let (cx, cy) = ((r.left + r.right) / 2.0, (r.bottom + r.top) / 2.0);
|
let (cx, cy) = ((r.left + r.right) / 2.0, (r.bottom + r.top) / 2.0);
|
||||||
if cx >= bb.left - pad
|
if cx >= bb.left - pad_x
|
||||||
&& cx <= bb.right + pad
|
&& cx <= bb.right + pad_x
|
||||||
&& cy >= bb.bottom - pad
|
&& cy >= bb.bottom - pad_y
|
||||||
&& cy <= bb.top + pad
|
&& cy <= bb.top + pad_y
|
||||||
{
|
{
|
||||||
idxs.push(i);
|
idxs.push(i);
|
||||||
if let Some(g) = geo_of(&page, i)? {
|
if let Some(g) = geo_of(&page, i)? {
|
||||||
|
|||||||
Reference in New Issue
Block a user