drawille-rs icon indicating copy to clipboard operation
drawille-rs copied to clipboard

Size of initialized canvas

Open tobiasvl opened this issue 2 years ago • 0 comments

I'm a little confused as to how Canvas::new works.

let mut canvas = Canvas::new(2, 4);
for y in 0..4 {
    for x in 0..2 {
        canvas.set(x, y);
    }
}
dbg!(canvas.frame());

This prints:

[src/main.rs:14] canvas.frame() = "⣿ \n  "

In other words, it seems to create a canvas that's one Braille character wider and taller than expected.

I realize I can just do Canvas::new(1, 1) and the canvas will automatically be resized if I draw outside it, but I'm not sure if this is intended behavior or not.

tobiasvl avatar Aug 09 '22 07:08 tobiasvl