mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-10-29 17:27:08 +08:00
This commit is contained in:
1 parent
f90b8c80c3
commit
526a207aa6
4 files changed
+34
-18
No files matched your search
@@ -270,11 +270,11 @@
|
||||
<form id="annotationCreateForm">
|
||||
<label class="form-row" data-annotation="watermark"><span>类型</span><select id="annotationContent"><option value="text">文字</option><option value="image">图片</option></select></label>
|
||||
<label class="form-row" data-annotation="replace"><span>原文</span><select id="annotationOld"></select></label>
|
||||
<label class="form-row" data-annotation="replace"><span>字体</span><select id="annotationFont"><option value="keep">原字体</option><option value="current">当前字体</option></select></label>
|
||||
<label class="form-row" data-annotation="replace"><span>字体</span><select id="annotationFont"><option value="keep">原有</option><option value="current">当前</option></select></label>
|
||||
<label class="form-row" id="annotationTextRow"><span>内容</span><textarea id="annotationText" rows="2" required></textarea></label>
|
||||
<label class="form-row" id="annotationImageRow" hidden><span>图片</span><input id="annotationImage" type="file" accept="image/png,image/jpeg,image/bmp,image/tiff,image/gif,image/webp"></label>
|
||||
<label class="form-row" data-annotation="note watermark stamp link"><span>作者</span><input id="annotationAuthor" type="text"></label>
|
||||
<label class="form-row" data-annotation="link"><span>目标</span><select id="annotationLinkKind"><option value="uri">网址</option><option value="page">页面</option><option value="keep" hidden>原链接</option></select></label>
|
||||
<label class="form-row" data-annotation="link"><span>目标</span><select id="annotationLinkKind"><option value="uri">网址</option><option value="page">页面</option><option value="keep" hidden>原有</option></select></label>
|
||||
<label class="form-row" data-annotation="link" id="annotationAddressRow"><span>网址</span><input id="annotationAddress" type="text"></label>
|
||||
<label class="form-row" data-annotation="link" id="annotationTargetRow"><span>页码</span><input id="annotationTarget" type="number" min="1" value="1"></label>
|
||||
<div class="form-pair" data-annotation="note watermark stamp link">
|
||||
|
||||
+14
-4
@@ -1316,6 +1316,7 @@ button.outline-link:hover {
|
||||
.navigation-tabs[hidden],
|
||||
.page-selection-tools[hidden],
|
||||
.form-row[hidden],
|
||||
.form-pair[hidden],
|
||||
.form-actions > [hidden],
|
||||
.annotation-detail[hidden],
|
||||
.tool-group[hidden],
|
||||
@@ -1644,10 +1645,6 @@ button.outline-link:hover {
|
||||
content: "";
|
||||
}
|
||||
|
||||
.edit-object.selected {
|
||||
background: rgba(15, 123, 104, 0.04);
|
||||
}
|
||||
|
||||
.edit-object.erasing {
|
||||
background: var(--accent-soft);
|
||||
outline-style: dashed;
|
||||
@@ -1849,6 +1846,19 @@ button.outline-link:hover {
|
||||
--note-rotation: calc(-1 * var(--surface-rotation, 0deg));
|
||||
}
|
||||
|
||||
.edit-note-icon {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
border: 1px solid var(--line-strong);
|
||||
background: var(--panel);
|
||||
color: var(--accent-strong);
|
||||
font-size: 16px;
|
||||
line-height: 1;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.annotation-detail {
|
||||
display: grid;
|
||||
gap: 8px;
|
||||
|
||||
@@ -303,14 +303,21 @@ export class CanvasEditor {
|
||||
node.setAttribute("aria-label", { ImageObject: "图片对象", TextObject: "文字对象", PathObject: "图形对象", CompositeObject: "复合对象", CompositeGraphicUnit: "复合对象", Annotation: "注解对象" }[object.type]);
|
||||
const item = { ...object, index, page: { width: page.width, height: page.height }, node, surface };
|
||||
item.artwork = artwork.get(object.id)?.node;
|
||||
if (object.type === "PathObject" && (object.shape || object.outline) || (object.scoped || object.type === "CompositeObject" || object.type === "CompositeGraphicUnit" || object.type === "Annotation") && object.contours?.length) {
|
||||
if (object.note) {
|
||||
const icon = document.createElement("span");
|
||||
icon.className = "edit-note-icon";
|
||||
icon.setAttribute("aria-hidden", "true");
|
||||
icon.textContent = "\u24d8";
|
||||
node.append(icon);
|
||||
}
|
||||
if (object.type === "PathObject" && (object.shape || object.outline || object.contours?.length)) {
|
||||
node.classList.add("edit-contour");
|
||||
const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
||||
svg.classList.add("edit-outline");
|
||||
svg.setAttribute("aria-hidden", "true");
|
||||
svg.setAttribute("preserveAspectRatio", "none");
|
||||
let contour;
|
||||
if (object.type === "PathObject" && (object.shape || object.oriented || !object.contours?.length)) {
|
||||
if (object.shape || object.oriented || !object.contours?.length) {
|
||||
const shape = object.shape || object.oriented?.kind;
|
||||
contour = document.createElementNS("http://www.w3.org/2000/svg", shape === "line" ? "line" : shape === "ellipse" ? "ellipse" : shape === "rectangle" ? "rect" : "path");
|
||||
if (!shape) contour.setAttribute("d", object.outline);
|
||||
|
||||
Reference in new issue
Block a user