Skip to content

Commit

Permalink
editor: vector n-slicer should clamp all shapes contained
Browse files Browse the repository at this point in the history
Previously, i thought it'd be nice to let vertices outside the bounds of the NSlicer to move relative to the bounds. You could get to this state by manually changing the intrinsic size to be smaller, so some vertices that used to be within bounds are now considered out.

However, I think this could be kinda confusing, not to mention harder to implement correctly (e.g. if the node is flipped, then the vertices outside the bounds also need to be flipped). I think not a lot of people will manually go and change the intrinsic size, so the simpler thing to do is to just clip everything:
<img width="1030" alt="image" src="https://github.com/user-attachments/assets/fc19caed-edce-4c15-bc3b-6d0e5f9496fc">

Diffs=
afcf0992da editor: vector n-slicer should clamp all shapes contained (#8428)

Co-authored-by: Susan Wang <susan@rive.app>
  • Loading branch information
susan101566 and susan101566 committed Oct 30, 2024
1 parent 739c25b commit c3a25af
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
2 changes: 1 addition & 1 deletion .rive_head
Original file line number Diff line number Diff line change
@@ -1 +1 @@
c7de07c0ca5e766fd2050ea87ac0b48e9714df63
afcf0992da4e4982243b7fa1c51c93b76a5bcb64
5 changes: 0 additions & 5 deletions src/math/n_slicer_helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,6 @@ float NSlicerHelpers::mapValue(const std::vector<float>& stops,
const ScaleInfo& scaleInfo,
float value)
{
if (value < (stops.front() - 0.001) || value > (stops.back() + 0.001))
{
return value;
}

float result = 0;
for (int i = 0; i < (int)stops.size() - 1; i++)
{
Expand Down

0 comments on commit c3a25af

Please sign in to comment.