feat(字体处理): 优化字体与文案,修复文档隔离
build.yaml / build (push) Successful in 3m22s

This commit is contained in:
xiaoqidun committed 2026-10-10 12:24:32 +08:00
1 parent c2d9a349c5
commit 0f2fb7a842
17 files changed
+113 -61

No files matched your search

+5 -4
View File
@@ -20,6 +20,7 @@ import "fmt"
// 来源修改、删除或撤销不改变快照,不用于跨文档传输
type ObjectSelection struct {
editor *Editor
document editorDocumentIdentity
objects []GraphicObject
annotations *AnnotationSelection
}
@@ -32,7 +33,7 @@ func (e *Editor) CaptureSelection(page int, objects, annotations []string) (*Obj
if err != nil {
return nil, err
}
selection := &ObjectSelection{editor: e, objects: items}
selection := &ObjectSelection{editor: e, document: e.documentIdentity(), objects: items}
if len(annotations) != 0 {
selection.annotations, err = e.CaptureAnnotations(page, annotations)
if err != nil {
@@ -46,7 +47,7 @@ func (e *Editor) CaptureSelection(page int, objects, annotations []string) (*Obj
// 入参: page 目标页面索引, selection 当前编辑器快照, dx 横向位移,单位为毫米, dy 纵向位移,单位为毫米
// 返回: []string 新正文标识, []string 新注解标识, error 标识、资源或编辑错误
func (e *Editor) PasteSelection(page int, selection *ObjectSelection, dx, dy float64) ([]string, []string, error) {
if selection == nil || selection.editor != e || !finite(dx) || !finite(dy) {
if selection == nil || selection.editor != e || !e.documentIdentity().matches(selection.document) || !finite(dx) || !finite(dy) {
return nil, nil, fmt.Errorf("invalid object selection or offset")
}
var objects, annotations []string
@@ -68,8 +69,8 @@ func (e *Editor) PasteSelection(page int, selection *ObjectSelection, dx, dy flo
// 入参: page 目标页面索引, path 父复合路径, selection 当前编辑器快照, dx 横向位移,单位为毫米, dy 纵向位移,单位为毫米
// 返回: []int 新成员序号, error 选区、资源或编辑错误
func (e *Editor) PasteSelectionToComposite(page int, path ObjectPath, selection *ObjectSelection, dx, dy float64) ([]int, error) {
if selection == nil || selection.editor != e {
return nil, fmt.Errorf("object selection belongs to another editor")
if selection == nil || selection.editor != e || !e.documentIdentity().matches(selection.document) {
return nil, fmt.Errorf("object selection belongs to another document or editor")
}
if selection.annotations != nil {
return nil, fmt.Errorf("annotations cannot be nested in a page object")