Swap the L-shape when the indent is dragged outwards
When the indent becomes an ‘outdent’, the L-shape needs to be swapped.
This is implemented in the original code in LGroup::scaleLGroup
as follows:
if (fourAboveZero != (msCoords[4] <= msCoords[0])) {
// swap 0-4&1-3
int t = maxSegs[4]; maxSegs[4] = maxSegs[0]; maxSegs[0] = t;
double t2 = msCoords[4]; msCoords[4] = msCoords[0]; msCoords[0] = t2;
t = maxSegs[1]; maxSegs[1] = maxSegs[3]; maxSegs[3] = t;
t2 = msCoords[1]; msCoords[1] = msCoords[3]; msCoords[3] = t2;
for (int i = 0; i < countries.nMaxSegments; i++) invMaxSegs[i] = -1;
for (int i = 0; i < maxSegs.length; i++) invMaxSegs[maxSegs[i]] = i;
oneLeftFive = !oneLeftFive;
}
if (oneLeftFive != (msCoords[1] <= msCoords[5])) {
// swap 1-5&2-4
int t = maxSegs[1]; maxSegs[1] = maxSegs[5]; maxSegs[5] = t;
double t2 = msCoords[1]; msCoords[1] = msCoords[5]; msCoords[5] = t2;
t = maxSegs[2]; maxSegs[2] = maxSegs[4]; maxSegs[4] = t;
t2 = msCoords[2]; msCoords[2] = msCoords[4]; msCoords[4] = t2;
for (int i = 0; i < countries.nMaxSegments; i++) invMaxSegs[i] = -1;
for (int i = 0; i < maxSegs.length; i++) invMaxSegs[maxSegs[i]] = i;
fourAboveZero = !fourAboveZero;
}
Open questions:
- what do
oneLeftFive
andfourAboveZero
mean exactly? - why not just compute it every time?