mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-10-29 17:27:08 +08:00
1 parent
d384527371
commit
7e3f2c468a
6 files changed
+59
-9
No files matched your search
@@ -134,6 +134,9 @@ func (e *Editor) updateRichTextFrame(page int, id string, value RichText, offset
|
||||
if err := value.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
if width > 0 {
|
||||
value.AutoWidth = false
|
||||
}
|
||||
if old.Type == "CompositeObject" && offset == 0 && (width == 0 || width == frame.W) && reflect.DeepEqual(normalizeRichText(current), normalizeRichText(value)) {
|
||||
return nil
|
||||
}
|
||||
@@ -356,6 +359,9 @@ func (e *Editor) updateCompositeRichText(page int, path ObjectPath, index int, v
|
||||
if err := value.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
if width > 0 {
|
||||
value.AutoWidth = false
|
||||
}
|
||||
if offset == 0 && (width == 0 || width == frame.W) && reflect.DeepEqual(normalizeRichText(current), normalizeRichText(value)) {
|
||||
return nil
|
||||
}
|
||||
@@ -460,6 +466,10 @@ func (e *Editor) prepareRichText(box Box, value RichText) (GraphicObject, richTe
|
||||
if err != nil {
|
||||
return GraphicObject{}, richTextMetadata{}, err
|
||||
}
|
||||
box.W = result.width
|
||||
if value.AutoWidth && !value.Layout.Wrap {
|
||||
box.H = result.bounds.Y + result.bounds.H
|
||||
}
|
||||
padX, padY := -min(0, result.bounds.X), -min(0, result.bounds.Y)
|
||||
extent := Box{W: max(box.W, result.bounds.X+result.bounds.W) + padX, H: max(box.H, result.bounds.Y+result.bounds.H) + padY}
|
||||
if !finite(extent.W) || !finite(extent.H) || extent.W <= 0 || extent.H <= 0 {
|
||||
|
||||
Reference in new issue
Block a user