Skip to content

Conversation

@kitizz
Copy link
Contributor

@kitizz kitizz commented Dec 11, 2025

The previous logic would force reset the bounds for an axis if its auto_bounds was false. I believe that the behavior of mem.auto_bounds already sufficiently achieves the intended behavior here.

Scenarios tested:

  • User can pan/zoom/scroll with auto_bounds true/false
  • Double-click resets auto_bounds the plot (regardless of default_auto_bounds setting)
  • Plot bounds are updated when plot data changes after double-clicking
  • User can still interact with the plot (pan/zoom/scroll) after double-clicking

The previous logic would force reset the bounds for an axis if its auto_bounds was false. I believe that the behavior of mem.auto_bounds already sufficiently achieves the intended behavior here.

Scenarios tested:
- User can pan/zoom/scroll with auto_bounds true/false
- Double-click resets auto_bounds the plot (regardless of default_auto_bounds setting)
- Plot bounds are updated when plot data changes after double-clicking
- User can still interact with the plot (pan/zoom/scroll) after double-clicking

Fixes emilk#151
@github-actions
Copy link

View snapshot changes at kitdiff

Copy link
Contributor Author

@kitizz kitizz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to write a test case for this. Not seeing any examples for non-screenshot based tests in this repo. Just need to go and figure out how to set up a Context and Ui for testing...

}

// Reset bounds to initial bounds if they haven't been modified.
if (!self.default_auto_bounds.x && !any_dynamic_modifications) || mem.auto_bounds.x {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hope my understanding of the full intention here is correct. I thought long and hard about it, and played around with a number of different configurations, and this works well.
But I'm suspicious that I'm missing something important

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could not find any problems here either

@kitizz
Copy link
Contributor Author

kitizz commented Dec 11, 2025

Writing tests is blocked on some missing features in egui_kittest (click-and-drag).
I'll go add that to kittest. But in the meantime, I'll take this out of draft, and I'll add tests once kittest supports click-and-drag

(See #219)

@kitizz kitizz marked this pull request as ready for review December 11, 2025 03:35
Copy link
Contributor

@bircni bircni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm
Lets get this in prod and write an issue to write test once the kittest is added

}

// Reset bounds to initial bounds if they haven't been modified.
if (!self.default_auto_bounds.x && !any_dynamic_modifications) || mem.auto_bounds.x {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could not find any problems here either

@michalsustr
Copy link
Collaborator

Good job, thank you!

I did not find any issues either. Agreed we need non-screenshot tests, and thank you so much for taking an initiative in this direction, it's exactly what is needed here!

@michalsustr michalsustr added the include in changelog This change will be included in the changelog label Dec 13, 2025
@michalsustr michalsustr merged commit f70ac43 into emilk:main Dec 13, 2025
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

include in changelog This change will be included in the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Disabling default auto_bounds prevents pan/zoom/scroll

3 participants