feat(编辑功能): 优化水印定位与平铺,支持框选范围和全文应用,统一弹窗间距
build.yaml / build (push) Successful in 38s

This commit is contained in:
xiaoqidun committed 2026-09-18 10:30:43 +08:00
1 parent 526a207aa6
commit d2c99b1610
5 files changed
+198 -27

No files matched your search

+5 -1
View File
@@ -783,7 +783,7 @@ export class CanvasEditor {
this.viewer.releasePointerCapture(drag.pointerID);
if (drag.annotation) {
const point = pagePoint(drag.clientX, drag.clientY, drag.rect, drag.page, drag.rotation);
const box = drag.box || { ...point, width: drag.annotation === "note" ? 5 : 40, height: drag.annotation === "note" ? 5 : 12 };
const box = drag.box || { ...point, width: drag.annotation === "watermark" ? 0 : drag.annotation === "note" ? 5 : 40, height: drag.annotation === "watermark" ? 0 : drag.annotation === "note" ? 5 : 12 };
drag.preview.remove();
this.setTool("");
this.options.onDrawAnnotation(drag.page.index, drag.annotation, box);
@@ -975,6 +975,9 @@ export class CanvasEditor {
const annotation = this.tool.startsWith("annotation:") ? this.tool.slice(11) : "";
const shape = annotation ? "rectangle" : this.tool;
const style = this.options.drawStyle();
if (annotation === "watermark") {
Object.assign(style, { fill: false, stroke: true, strokeColor: "var(--accent)", lineWidth: 1 });
}
if (lineShape(shape)) {
style.fill = false;
style.stroke = true;
@@ -982,6 +985,7 @@ export class CanvasEditor {
this.drag = { shape, annotation, page, surface, ...this.createPreview(surface, page, shape === "text" ? "rectangle" : shape, style), style, pointerID: event.pointerId,
rect: surface.getBoundingClientRect(), rotation: this.options.rotation(),
clientX: event.clientX, clientY: event.clientY };
if (annotation === "watermark") this.drag.node.setAttribute("vector-effect", "non-scaling-stroke");
this.viewer.setPointerCapture(event.pointerId);
}