sunjay / turtle

Create Animated Drawings in Rust
http://turtle.rs
Mozilla Public License 2.0
562 stars 53 forks source link

Zoom #46

Open sunjay opened 6 years ago

sunjay commented 6 years ago

We probably need a better renderer (#45) before we do this, but it would be great if zoom was settable on Drawing and also manipulatable through the keyboard/mouse (#42) and the toolbar (#41).

The first step to making all of that possible is making zoom a gettable and settable property in Drawing.

  1. Add a pub zoom: f64 field to the DrawingState struct
  2. Set the default zoom to 1.0 in the Default implementation of DrawingState
  3. Add methods to Drawing that perform the appropriate queries to get and set the zoom
  4. For the time-being, valid zoom values will be from 0.2 to 5.0 (arbitrary choices) and any values outside of this range should panic with a helpful error message (check this value in the methods of Drawing, not elsewhere)
    • We can always extend this range later but trying to make the range smaller is quite difficult because it would be a breaking change

Next, we need to implement zoom in the renderer:

Tasks

Anyone can attempt to do one or more of these tasks. I am happy to help.