Vong 6: edit mode NHIEU TRANG + nut Huy thay doi + fix de chu khi luu dong lan style
Build Windows portable / build (push) Canceled after 0s
Build Windows portable / build (push) Canceled after 0s
- Engine (edit.rs): sau khi ve tung manh rich, tien con tro theo MAX(do hmtx,
MEP MUC THAT tu PDFium bounds) - subset font ttf-parser khong parse duoc roi
ve fallback 0.5em/ky tu uoc luong thieu ("HttpOnly" do 36pt vs muc that
42.6pt) lam manh sau de len manh truoc ("auth-storagetu"). Ca duong ve ca
manh lan duong be theo tung tu.
- UI nhieu trang: #editPagesCol chua 1 .edit-slot/trang; trang active giu
#editPageWrap (img+overlay cu, chi DI CHUYEN giua cac slot), trang khac
render read-only luoi (IntersectionObserver, stamp editBase|zoom tu
invalidate sau op/undo/zoom). Dup vao trang read-only = chuyen active + mo
o sua ngay tai diem dup (tai dung editPendingPoint). Cuon: so trang bam
theo trang giua khung nhin, tu doi active khi khong co o sua mo. Zoom co
gian moi slot ngay, render net sau.
- Nut "Huy thay doi" canh nut Luu: dong o sua, xoa file tam, editBase ve file
goc, xoa undo/redo, moi trang tu render lai noi dung goc.
- E2E CDP tren app that (tiem patch vao build 29): cot 3 trang, dup trang 3
read-only mo dung dong, Huy tra ve goc (text thu "KIEM" bien mat), zoom
130% ca 3 slot. Docs/12 vong 6.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1748,7 +1748,10 @@ pub fn apply_edits(
|
||||
};
|
||||
// Ghi + tự kiểm; hỏng → ghi lại TỪNG TỪ tự đặt
|
||||
// vị trí (không bao giờ ghi glyph dấu cách).
|
||||
let wrote_ok = {
|
||||
// Mảnh kế đặt từ MÉP MỰC THẬT (bounds PDFium):
|
||||
// hmtx subset có thể không parse được → đo xấp
|
||||
// xỉ 0.5em thiếu hụt làm các mảnh ĐÈ nhau.
|
||||
let (wrote_ok, ink_right) = {
|
||||
let mut obj = page
|
||||
.objects_mut()
|
||||
.create_text_object(
|
||||
@@ -1763,12 +1766,14 @@ pub fn apply_edits(
|
||||
.as_text_object()
|
||||
.map(|t| t.text() == p.text)
|
||||
.unwrap_or(false);
|
||||
let mut ir = None;
|
||||
if ok {
|
||||
obj.apply_matrix(PdfMatrix::new(a, b, c2, d, x, y))
|
||||
.map_err(err)?;
|
||||
obj.set_fill_color(st.color).map_err(err)?;
|
||||
ir = obj.bounds().ok().map(|q| q.right().value);
|
||||
}
|
||||
ok
|
||||
(ok, ir)
|
||||
};
|
||||
if !wrote_ok {
|
||||
let idx = page.objects().len().saturating_sub(1);
|
||||
@@ -1793,10 +1798,17 @@ pub fn apply_edits(
|
||||
obj.apply_matrix(PdfMatrix::new(a, b, c2, d, cx, y))
|
||||
.map_err(err)?;
|
||||
obj.set_fill_color(st.color).map_err(err)?;
|
||||
cx += measure_s(p.style, word) + space_w;
|
||||
let wir =
|
||||
obj.bounds().ok().map(|q| q.right().value);
|
||||
cx = (cx + measure_s(p.style, word))
|
||||
.max(wir.unwrap_or(0.0))
|
||||
+ space_w;
|
||||
}
|
||||
x = cx - space_w;
|
||||
} else {
|
||||
x = (x + measure_s(p.style, &p.text))
|
||||
.max(ink_right.unwrap_or(0.0));
|
||||
}
|
||||
x += measure_s(p.style, &p.text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user