| 113 | } |
| 114 | |
| 115 | void VerticalLine::moveToX (int lineNum, float newXPercent, float margin, std::unique_ptr<VerticalLine> verticalLines[]) |
| 116 | { |
| 117 | float leftLimit; |
| 118 | float rightLimit; |
| 119 | |
| 120 | // int index = leftIndex + 1; |
| 121 | leftLimit = (index + 1) * margin; |
| 122 | rightLimit = 1 - (lineNum - index) * margin; |
| 123 | |
| 124 | if (newXPercent < leftLimit) |
| 125 | newXPercent = leftLimit; |
| 126 | if (newXPercent > rightLimit) |
| 127 | newXPercent = rightLimit; |
| 128 | |
| 129 | if (leftIndex >= 0 && newXPercent - verticalLines[leftIndex]->getXPercent() - margin < -0.00001f) // float is not accurate!!!! |
| 130 | { |
| 131 | verticalLines[leftIndex]->moveToX (lineNum, newXPercent - margin, margin, verticalLines); |
| 132 | } |
| 133 | if (rightIndex < lineNum && verticalLines[rightIndex]->getXPercent() - newXPercent - margin < -0.00001f) |
| 134 | { |
| 135 | verticalLines[rightIndex]->moveToX (lineNum, newXPercent + margin, margin, verticalLines); |
| 136 | } |
| 137 | xPercent = newXPercent; |
| 138 | } |
no test coverage detected