Skip to content

minmax fails if new min == old max #31

@d-lamb

Description

@d-lamb

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;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions