mirror of
https://github.com/storytold/designcraft.git
synced 2026-10-27 11:46:51 -06:00
Integration: rustfmt after merging #389-#392, indd 8 and 9
This commit is contained in:
@@ -572,7 +572,15 @@ fn place_load(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
let aid = s.edit(|d, _| {
|
||||
let fresh = AssetId(d.alloc());
|
||||
let mime = designcraft_render::image_mime(&bytes).to_string();
|
||||
Ok(d.add_asset(Asset { id: fresh, name: name.clone(), mime, link: link.clone(), data: Arc::new(bytes), pixels: Some((pw, ph)), ..Default::default() }))
|
||||
Ok(d.add_asset(Asset {
|
||||
id: fresh,
|
||||
name: name.clone(),
|
||||
mime,
|
||||
link: link.clone(),
|
||||
data: Arc::new(bytes),
|
||||
pixels: Some((pw, ph)),
|
||||
..Default::default()
|
||||
}))
|
||||
})?;
|
||||
s.loaded = Some((aid, (pw as f64, ph as f64)));
|
||||
s.set_tool("placeGun");
|
||||
|
||||
@@ -94,7 +94,15 @@ pub fn specs() -> Vec<CommandSpec> {
|
||||
Some(Some((bytes, name, link, px))) => {
|
||||
let fresh = AssetId(d.alloc());
|
||||
let mime = designcraft_render::image_mime(&bytes).to_string();
|
||||
Some(Some(d.add_asset(Asset { id: fresh, name, mime, link, data: Arc::new(bytes), pixels: Some(px), ..Default::default() })))
|
||||
Some(Some(d.add_asset(Asset {
|
||||
id: fresh,
|
||||
name,
|
||||
mime,
|
||||
link,
|
||||
data: Arc::new(bytes),
|
||||
pixels: Some(px),
|
||||
..Default::default()
|
||||
})))
|
||||
}
|
||||
Some(None) => Some(None),
|
||||
None => None,
|
||||
|
||||
@@ -2606,7 +2606,8 @@ impl<'r> Importer<'r> {
|
||||
None => (0.0, 0.0, 0.0, 0.0),
|
||||
};
|
||||
let size = ((r - l).abs(), (b - t).abs());
|
||||
let wrap = if g.get("AppliedObjectStyle").is_some() { self.with_style(g, "TextWrapPreference") } else { g.find("TextWrapPreference").cloned() };
|
||||
let wrap =
|
||||
if g.get("AppliedObjectStyle").is_some() { self.with_style(g, "TextWrapPreference") } else { g.find("TextWrapPreference").cloned() };
|
||||
let wrap = wrap.map(|w| text_wrap(&w)).unwrap_or_default();
|
||||
let link = g.find("Link");
|
||||
let uri = link.and_then(|k| k.get("LinkResourceURI")).map(uri_to_path);
|
||||
|
||||
@@ -9,10 +9,10 @@ use super::*;
|
||||
|
||||
mod assets;
|
||||
mod decorations;
|
||||
mod object_styles;
|
||||
mod rtl_binding;
|
||||
mod variables;
|
||||
mod wrap;
|
||||
mod object_styles;
|
||||
|
||||
fn zip_files(files: &[(&str, &str)]) -> Vec<u8> {
|
||||
use zip::write::SimpleFileOptions;
|
||||
|
||||
@@ -212,7 +212,10 @@ fn feathers_come_from_the_object_style_unless_its_category_turns_them_off() {
|
||||
&[
|
||||
(r#"AppliedObjectStyle="ObjectStyle/Fade""#, ""),
|
||||
(r#"AppliedObjectStyle="ObjectStyle/NoGradient""#, ""),
|
||||
(r#"AppliedObjectStyle="ObjectStyle/Fade""#, r#"<TransparencySetting><DirectionalFeatherSetting Applied="false"/></TransparencySetting>"#),
|
||||
(
|
||||
r#"AppliedObjectStyle="ObjectStyle/Fade""#,
|
||||
r#"<TransparencySetting><DirectionalFeatherSetting Applied="false"/></TransparencySetting>"#,
|
||||
),
|
||||
],
|
||||
);
|
||||
let fx: Vec<&designcraft_doc::Effects> = d.spreads[0].items.iter().map(|i| &i.effects).collect();
|
||||
|
||||
Reference in New Issue
Block a user