Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not much bounds checking is done when moving selection window #2

Open
justinhj opened this issue Apr 2, 2022 · 3 comments
Open

Not much bounds checking is done when moving selection window #2

justinhj opened this issue Apr 2, 2022 · 3 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@justinhj
Copy link
Owner

justinhj commented Apr 2, 2022

When moving the selection window there is some but not enough checking for bounds. Specifically when you reach one or more edges of the screen the selection window should not move in that direction.

@justinhj justinhj added bug Something isn't working good first issue Good for newcomers labels Apr 2, 2022
@tusharxoxoxo
Copy link

is there a way to know the screen width of the device on which we are viewing the image. Cause for the bounds I was thinking of creating something like this
// Check if the new corners exceed the bounds of the screen
let max_re = screen_width;
let min_re = 0.0;
let max_im = screen_height;
let min_im = 0.0;

am I going in right direction for this problem or I am completely wrong

@tusharxoxoxo
Copy link

can u tell me the direction in which I need to think for this problem

@justinhj
Copy link
Owner Author

Yeah you're on the right lines. There are functions such as move_selection_right, move_selection_down and so on. You need to calculate whether the thing is going out of bounds. Sorry it's been a while since I looked at the code, but there are essentially two coordinate systems in play, the terminal coords and the window coords. You may need to add some print! instructions to the various variables and print them out while moving things around and see what they do. The idea is to figure out the bounds and keep the user within them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants