fix: cpn: custom curve edit default points and expand curve tab details column (#1815)

This commit is contained in:
Neil Horne
2022-04-14 10:16:57 +10:00
committed by GitHub
parent 6da73376e1
commit dc3b55771f
5 changed files with 58 additions and 35 deletions
+9 -8
View File
@@ -36,18 +36,19 @@ void CurveData::clear(int count)
void CurveData::init()
{
float incr = 200.0 / ((float)count - 1.0);
memset(points, 0, sizeof(CurvePoint) * CPN_MAX_POINTS);
// points[0].x must be -100
for (int i = 0; i < count; i++) {
if (i < count - 1)
points[i].x = -100 + (int)(incr * i);
else
points[i].x = 100; // points[count - 1].x must be +100 do not risk a rounding issue using incr
float incr = 200.0 / (float)(count - 1);
for (int i = 1; i < (count - 1); i++) {
points[i].x = -100 + (int)(incr * (float)i);
points[i].y = points[i].x;
}
points[0].x = -100;
points[0].y = -100;
points[count - 1].x = 100;
points[count - 1].y = 100;
}
bool CurveData::isEmpty() const