mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-09 10:47:27 +00:00
#5139 (in 0.21.0) made a positive Twist angle turn clockwise, but documents saved by earlier releases stored their angles with the other sign and reopened twisted the other way. The document version (FORMAT_VERSION) goes from 1 to 2. Opening a version 1 document negates its Twist angles (in layers, opacity-mask art, Shaper edits, symbols, graph designs, pattern swatches, graphic styles and brush definitions), unless the file is of the current file version and its generator is VectorCraft 0.21.0 or later. The document opens and saves as version 2. A save for an older file version, which only apps before 0.21.0 read, writes a version 1 document with the angles negated back. Graphic style libraries (.vcstyles) go to version 2: a version 1 library's Twist angles are negated when it is read. Readers do not check either version, so older builds open the new files as before.
23 lines
766 B
Rust
23 lines
766 B
Rust
use super::NodeId;
|
|
|
|
/// Coordinates beyond this many points exceed the supported document range.
|
|
pub const MAX_COORD: f64 = 4.0e6;
|
|
|
|
#[derive(Debug, thiserror::Error, PartialEq)]
|
|
pub enum DocError {
|
|
#[error("no such object {0}")]
|
|
NoNode(NodeId),
|
|
#[error("object {0} cannot have children")]
|
|
NotContainer(NodeId),
|
|
#[error("{0}")]
|
|
Invalid(String),
|
|
}
|
|
|
|
/// The document version new documents get. Version 2: a positive Twist angle turns clockwise
|
|
/// ([`crate::twist`]).
|
|
pub const FORMAT_VERSION: u32 = 2;
|
|
|
|
/// Node, slice and asset ids are handed out below this: no document gets near it by counting, so
|
|
/// larger ids in a file are damage (or made by hand) and the counter never follows them (#1718).
|
|
pub(crate) const MAX_NEXT_ID: u64 = 1 << 62;
|