mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-12-02 20:18:38 -05:00
Scripts: DXF scale tests fail on a drawing with no polyline vertices
dxf_widest and dxf_leftmost folded from f64::MIN and f64::MAX, so a DXF that kept its header but lost every vertex gave an infinite product and the unitScaleRatio and pica assertions still passed. Both now reduce the coordinates and fail when there are none. docs/mcp.md: a relative save or open path is resolved against the working folder of the process that wrote or read the file.
This commit is contained in:
1 parent
fe3d001806
commit
a65d251c87
2 files changed
+3
-3
No files matched your search
@@ -423,12 +423,12 @@ fn dxf_header(dxf: &str, name: &str) -> Option<String> {
|
||||
|
||||
/// The largest x coordinate (group code 10) in the entities of a DXF.
|
||||
fn dxf_widest(dxf: &str) -> f64 {
|
||||
dxf_xs(dxf).into_iter().fold(f64::MIN, f64::max)
|
||||
dxf_xs(dxf).into_iter().reduce(f64::max).expect("DXF contains polyline vertices")
|
||||
}
|
||||
|
||||
/// The smallest x coordinate (group code 10) in the entities of a DXF.
|
||||
fn dxf_leftmost(dxf: &str) -> f64 {
|
||||
dxf_xs(dxf).into_iter().fold(f64::MAX, f64::min)
|
||||
dxf_xs(dxf).into_iter().reduce(f64::min).expect("DXF contains polyline vertices")
|
||||
}
|
||||
|
||||
/// The x coordinates (group code 10) of the polyline vertices in a DXF. A hatch's code 10 is its
|
||||
|
||||
+1
-1
@@ -3301,7 +3301,7 @@ through `$`:
|
||||
writes only the file at the path, holding that artboard. Without `saveMultipleArtboards`, a `.ai` or EPS
|
||||
`artboardRange` is not checked against the document's artboards, but one that is not written as a range of
|
||||
artboard numbers (such as `abc` or `0-`) throws. `Document.path` is a `Folder` for the folder of the document's
|
||||
file. A file saved or opened under a relative path is in the working folder of the process that wrote or read it,
|
||||
file. A relative path that a file is saved or opened under is resolved against the working folder of the process that wrote or read it,
|
||||
for `fullName`, `path` and `close` alike. A document that has no file has a `fullName` of a `File` for its name in `Folder.current` and a `path` of
|
||||
`""`. `fullName` and `path` of a document whose file the automation read roots do not allow throw
|
||||
`Script file access denied`. Changing `saved` runs `document.setSaved`: `true` records the document as saved
|
||||
|
||||
Reference in new issue
Block a user