mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-10-30 01:27:26 +08:00
This commit is contained in:
1 parent
237487b53c
commit
0034e0edbd
11 files changed
+234
-52
No files matched your search
@@ -607,7 +607,7 @@ func editorObjects(index int, text *ofdgo.PageText) ([]any, error) {
|
||||
if currentEditor == nil {
|
||||
return objects, nil
|
||||
}
|
||||
page, err := currentSession.pageContent(index)
|
||||
page, err := currentEditor.Page(index)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -651,7 +651,7 @@ func editorObjects(index int, text *ofdgo.PageText) ([]any, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !capability.Transform && !capability.Update {
|
||||
if capability.Reason == "nested objects are read-only" {
|
||||
continue
|
||||
}
|
||||
var box ofdgo.Box
|
||||
@@ -664,12 +664,12 @@ func editorObjects(index int, text *ofdgo.PageText) ([]any, error) {
|
||||
box, err = ofdgo.ParseBox(object.PathObject.Boundary)
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
continue
|
||||
}
|
||||
if box.W > 0 && box.H > 0 {
|
||||
item := map[string]any{"id": id, "type": object.Type, "x": box.X, "y": box.Y, "width": box.W, "height": box.H, "order": order, "count": len(layer.Objects), "layer": layer.ID,
|
||||
"capabilities": map[string]any{"update": capability.Update, "replaceFont": capability.ReplaceFont, "reflow": capability.Reflow, "layoutKnown": capability.LayoutKnown, "transform": capability.Transform, "arrange": capability.Arrange, "copy": capability.Copy, "delete": capability.Delete, "order": capability.Order, "reason": capability.Reason}}
|
||||
if object.Type == "ImageObject" {
|
||||
if object.Type == "ImageObject" && capability.Update {
|
||||
full, err := object.ImageObject.ImageBounds()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -689,11 +689,7 @@ func editorObjects(index int, text *ofdgo.PageText) ([]any, error) {
|
||||
item["lineWidth"] = path.LineWidth * editorPathScale(path)
|
||||
}
|
||||
if object.Type == "TextObject" {
|
||||
source, err := currentEditor.Object(index, id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
value, layout := source.TextObject.TextLayout()
|
||||
value, layout := object.TextObject.TextLayout()
|
||||
item["text"], item["font"], item["fontName"], item["size"] = value, object.TextObject.Font, fontNames[object.TextObject.Font], object.TextObject.Size
|
||||
item["wrap"], item["align"], item["paragraphHeight"] = layout.Wrap, layout.Align, layout.LineHeight
|
||||
item["letterSpacing"] = layout.LetterSpacing
|
||||
|
||||
Reference in new issue
Block a user