Closed Davejkane closed 5 years ago
So, pressing z
should either zoom in or out on the image until it fits in the dimensions of the window?
Yes, pressing z should toggle between actual size and fit to window. The default for images smaller than the window should be actual size, and the default for images larger than the window should be fit to window.
Question. When the image is larger than the display and actual size is desired, should the viewport focus on the center of the image?
I'm heavily leaning toward centered.
Centered
xxxxx
xyyyx
xyyyx
xyyyx
xxxxx
Or
Top-left focus
yyyxx
yyyxx
yyyxx
xxxxx
xxxxx
I'd also definitely go with centred. Hadn't even thought of it as an option :)
Just a heads up, canvas.copy_ex
let's you specify a centre point, which will make this much easier.
https://rust-sdl2.github.io/rust-sdl2/sdl2/render/struct.Canvas.html#method.copy_ex
Nice! Just need to get the center point of the texture.
From what I've read, the center point for copy_ex
is used to specify the point to rotate or flip along.
https://docs.rs/sdl2/0.32.2/sdl2/render/struct.Canvas.html#method.copy_ex
Copies a portion of the texture to the current rendering target, optionally rotating it by angle around the given center and also flipping it top-bottom and/or left-right.
So, perhaps what needs to be done manually is:
tex_slice
center on the destination area center.
ToggleFit
toAction
enum inui.rs
actual_size
boolean to programz
key toToggleFit
inevent_action
function inui.rs
Action::ToggleFit
totoggle_fit
function inrun
inprogram.rs
toggle_fit
function flip theactual_size
booleanNext, Prev, Move, First, Last
etc, reset theactual_size
boolean. It should be true when both images are small than window, and false when any dimension is larger than the corresponding window dimension.