mirror of
https://github.com/storytold/designcraft.git
synced 2026-10-24 10:16:59 -06:00
Integration: cargo fmt
This commit is contained in:
@@ -276,11 +276,7 @@ pub(crate) fn point_param(p: &Value, key: &str) -> Option<Point> {
|
||||
/// `r`, computed from coordinate params, or an error when a value overflowed to infinity or NaN:
|
||||
/// a document holding one can't be saved (#1050).
|
||||
pub(crate) fn finite_rect(command: &str, r: Rect) -> Result<Rect> {
|
||||
if [r.x0, r.y0, r.x1, r.y1].iter().all(|v| v.is_finite()) {
|
||||
Ok(r)
|
||||
} else {
|
||||
Err(bad(command, "the position and size must stay finite numbers"))
|
||||
}
|
||||
if [r.x0, r.y0, r.x1, r.y1].iter().all(|v| v.is_finite()) { Ok(r) } else { Err(bad(command, "the position and size must stay finite numbers")) }
|
||||
}
|
||||
|
||||
pub(crate) fn rect_param(p: &Value, key: &str) -> Option<Rect> {
|
||||
|
||||
@@ -34,7 +34,17 @@ fn shown(file: Vec<u8>, fill: Fill) -> Vec<[u8; 4]> {
|
||||
let aid = AssetId(d.alloc());
|
||||
d.assets.insert(
|
||||
aid,
|
||||
Arc::new(Asset { page: 0, id: aid, name: "a".into(), mime: "image/png".into(), link: None, data: Arc::new(file), pixels: Some((3, 1)), pdf_crop: Default::default(), pdf_box: None }),
|
||||
Arc::new(Asset {
|
||||
page: 0,
|
||||
id: aid,
|
||||
name: "a".into(),
|
||||
mime: "image/png".into(),
|
||||
link: None,
|
||||
data: Arc::new(file),
|
||||
pixels: Some((3, 1)),
|
||||
pdf_crop: Default::default(),
|
||||
pdf_box: None,
|
||||
}),
|
||||
);
|
||||
let id = ItemId(d.alloc());
|
||||
let mut it = Item::new(id, d.default_layer(), Shape::Rectangle, shapes::rectangle(Rect::new(100.0, 100.0, 250.0, 150.0)));
|
||||
|
||||
Reference in New Issue
Block a user