Skip to content

DesignCraft: An open-source page and layout design editor written by scratch in pure Rust

Integration: custom wrap boundaries with graphic text wrap

aiongg1daf0a8ec878
diff --git a/crates/engine/src/cmd/object.rs b/crates/engine/src/cmd/object.rs
index 2b37a86b4..052f4ffe3 100644
--- a/crates/engine/src/cmd/object.rs
+++ b/crates/engine/src/cmd/object.rs
@@ -1676,7 +1676,7 @@ fn text_wrap(s: &mut Session, p: &Value) -> Result<Value> {
// A custom boundary has the offsets built in and replaces the contour, so setting
// either one rebuilds the wrap from the frame.
if off.is_some() || contour.is_some() {
- i.wrap.path = None;
+ w.path = None;
}
},
false,
diff --git a/crates/idml/src/tests/wrap.rs b/crates/idml/src/tests/wrap.rs
index fdddd5957..5f631a78f 100644
--- a/crates/idml/src/tests/wrap.rs
+++ b/crates/idml/src/tests/wrap.rs
@@ -118,7 +118,7 @@ fn contour_wrap_on_a_placed_graphic_follows_its_shown_part_on_one_side() {
use designcraft_doc::{ContourType, WrapSide};
let pref = r#"<TextWrapPreference Inverse="false" ApplyToMasterPageOnly="false" TextWrapSide="RightSide" TextWrapMode="Contour"><Properties><TextWrapOffset Top="4" Left="4" Bottom="4" Right="4"/></Properties><ContourOption ContourType="BoundingBox" IncludeInsideEdges="false"/></TextWrapPreference>"#;
let mut d = wrap_doc(&wrap_pref("None", 0.0), pref);
- let w = d.spreads[0].items[1].graphic().unwrap().wrap;
+ let w = d.spreads[0].items[1].graphic().unwrap().wrap.clone();
assert_eq!((w.side, w.contour), (WrapSide::RightSide, ContourType::BoundingBox));
let back = import_idml(&export_idml(&d)).unwrap();
assert_eq!(back.spreads[0].items.iter().find_map(|i| i.graphic()).unwrap().wrap, w);