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

minmax fails if new min == old max #31

Open
d-lamb opened this issue Aug 28, 2014 · 1 comment
Open

minmax fails if new min == old max #31

d-lamb opened this issue Aug 28, 2014 · 1 comment

Comments

@d-lamb
Copy link
Member

d-lamb commented Aug 28, 2014

If I have some scenario like this:

($old_min,$old_max)=$plot->x->minmax;
$dx = $old_max - $old_min;
$new_max = $old_max + $dx;
$new_min = $old_max;
$plot->x->minmax($new_min,$new_max);`

it will fail because the minmax setter calls _min, then _max. _min has the line if ($self->max == $new_value), which is true in the moment, so $self->{minValue} = $new_value; never happens.

I thought that just switching _min and _max in minmax would work, but not for the case where new max == old min. So maybe in minmax you want to call the _min, _max pair twice? Doesn't look like it would introduce too much overhead. I couldn't quickly think of any logic to easily change _min, but haven't spent too much time on it.

I got around it for now buy having

$new_min = $old_max +1;
@run4flat
Copy link
Member

This needs to be fixed, but I'll have to think about just how to fix it. One thing would be to check if either the $new_max == $old_min or $new_min == $old_max in minmax.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants