Skip to content
Discussion options

You must be logged in to vote

The thing tripping you up is that present() is not a per-area operation. top and bottom are two views onto the same backend, so top.present() does not present the top half — it finalises the entire SVG document, before you have drawn the bottom one.

For SVG that is a one-way door:

fn present(&mut self) -> Result<(), DrawingErrorKind<Error>> {
    if !self.saved {
        while self.close_tag() {}
        match self.target {
            Target::File(ref buf, path) => { /* write buf to path */ }
            Target::Buffer(_) => {}
        }
        self.saved = true;
    }
    Ok(())
}

Every open tag gets closed, the buffer as it stands is written to new.svg, and saved latches to true. Your…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@DorianCoding
Comment options

Answer selected by DorianCoding
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants