| 199 | } |
| 200 | |
| 201 | int ControlPointComponent::clipX(int newX, int pointIndex) { |
| 202 | if(pointIndex == 0) { |
| 203 | return points.getFirst().getX(); |
| 204 | } |
| 205 | |
| 206 | if(pointIndex == points.size() -1) { |
| 207 | return points.getLast().getX(); |
| 208 | } |
| 209 | |
| 210 | auto pointBefore = points.getReference(pointIndex - 1); |
| 211 | auto pointAfter = points.getReference(pointIndex + 1); |
| 212 | |
| 213 | static int threshold = 5; |
| 214 | if(newX < (pointBefore.getX() + threshold)) { |
| 215 | return points.getReference(pointIndex).getX(); |
| 216 | } |
| 217 | |
| 218 | if(newX > (pointAfter.getX() - threshold)) { |
| 219 | return points.getReference(pointIndex).getX(); |
| 220 | } |
| 221 | |
| 222 | return newX; |
| 223 | } |
| 224 | |
| 225 | int ControlPointComponent::clipY(int newY, int) { |
| 226 | auto padding = 0; |
nothing calls this directly
no outgoing calls
no test coverage detected