mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-10-29 14:31:12 +08:00
1 parent
28175723e6
commit
32585c6343
46 files changed
+84
-168
No files matched your search
@@ -1724,7 +1724,7 @@ func captureEditorSelection(page int, ids []string) (*editorClipboard, error) {
|
||||
}
|
||||
|
||||
// pasteEditorSelection 原子粘贴正文和注解,共享字体与图片数据
|
||||
// 入参: page 目标页, clipboard 快照, dx、dy 位移
|
||||
// 入参: page 目标页, clipboard 快照, dx 横向位移, dy 纵向位移
|
||||
// 返回: []string 新画布标识, error 错误信息
|
||||
func pasteEditorSelection(page int, clipboard *editorClipboard, dx, dy float64) ([]string, error) {
|
||||
ids, annotations, err := currentEditor.PasteSelection(page, clipboard.selection, dx, dy)
|
||||
@@ -2747,7 +2747,7 @@ func pasteObjects(args []js.Value) (any, error) {
|
||||
}
|
||||
|
||||
// copyEditorObjects 复制快照并更新预览,返回新对象标识
|
||||
// 入参: page 目标页, objects 对象快照, dx、dy 毫米位移
|
||||
// 入参: page 目标页, objects 对象快照, dx 横向位移,单位为毫米, dy 纵向位移,单位为毫米
|
||||
// 返回: any 文档信息及新选区, error 错误信息
|
||||
func copyEditorObjects(page int, objects []ofdgo.GraphicObject, dx, dy float64) (any, error) {
|
||||
ids, err := currentEditor.CopyObjects(page, objects, dx, dy)
|
||||
|
||||
@@ -379,6 +379,8 @@ func (s *Session) PageText(index int) (*ofdgo.PageText, error) {
|
||||
}
|
||||
|
||||
// cachedPageText 获取缓存索引并更新最近访问顺序
|
||||
// 入参: index 页面索引
|
||||
// 返回: *ofdgo.PageText 文字索引,未缓存时为nil
|
||||
func (s *Session) cachedPageText(index int) *ofdgo.PageText {
|
||||
text := s.textCache[index]
|
||||
if text != nil {
|
||||
@@ -388,6 +390,7 @@ func (s *Session) cachedPageText(index int) *ofdgo.PageText {
|
||||
}
|
||||
|
||||
// cachePageText 保留最近访问的文字索引,避免全文搜索持续占用内存
|
||||
// 入参: index 页面索引, text 文字索引
|
||||
func (s *Session) cachePageText(index int, text *ofdgo.PageText) {
|
||||
if position := slices.Index(s.textOrder, index); position >= 0 {
|
||||
s.textOrder = slices.Delete(s.textOrder, position, position+1)
|
||||
|
||||
Reference in new issue
Block a user