bevy icon indicating copy to clipboard operation
bevy copied to clipboard

fix: Ensure linear volume subtraction does not go below zero

Open foxzool opened this issue 6 months ago • 6 comments

fix: Ensure linear volume subtraction does not go below zero

Solution

  • Clamp the result of linear volume subtraction to a minimum of 0.0
  • Add a new test case to verify behavior when subtracting beyond zero

foxzool avatar May 29 '25 03:05 foxzool

I think it's worth to discuss whether to keep these impls or not, but while we have them, we should at least not use abs

My recommendation would be for this PR to remove the impls, and mark this a breaking change in case people have accidentally/intentionally relied on this impl existing.

SolarLiner avatar May 31 '25 22:05 SolarLiner

removed the impls and replace add with increase_by_percentage

foxzool avatar Jun 03 '25 06:06 foxzool

It looks like your PR is a breaking change, but you didn't provide a migration guide.

Please review the instructions for writing migration guides, then expand or revise the content in the migration guides directory to reflect your changes.

github-actions[bot] avatar Jun 03 '25 17:06 github-actions[bot]

@alice-i-cecile marked this as breaking because it removes the Add/Sub impls on Volume, don't know if that's okay

SolarLiner avatar Jun 03 '25 17:06 SolarLiner

Let's just make sure nothing calls abs :eyes:

janhohenheim avatar Jun 03 '25 19:06 janhohenheim

We should keep the Add and Sub impls intact, and just call the corresponding methods in them + document exactly what they do.

I disagree. The impls as they stand are wrong, and changing them to call "the right methods" would make them the same as the Mul and Div impls, which in turn would make it more confusing than it is worth IMHO. To me, this justifies the breaking change.

Besides, changing their implementation is still a breaking change in that they will have fundamentally different behaviors which which will break existing code.

SolarLiner avatar Jun 03 '25 20:06 SolarLiner