| 180 | } |
| 181 | |
| 182 | void ArcSpectrogram::resized() { |
| 183 | auto r = getLocalBounds(); |
| 184 | |
| 185 | mRainbowRect = r.withTrimmedBottom(20).reduced(10, 5); // Leaving room for clouds |
| 186 | |
| 187 | // Cloud centers |
| 188 | { |
| 189 | const int translation = 45; |
| 190 | const auto leftCenter = mRainbowRect.getBottomLeft().translated(translation, -7); |
| 191 | const auto rightCenter = mRainbowRect.getBottomRight().translated(-translation, -7); |
| 192 | mCloudLeft.rect = mCloudLeft.images[0].getBounds().withCentre(leftCenter).toFloat(); |
| 193 | mCloudRight.rect = mCloudRight.images[0].getBounds().withCentre(rightCenter).toFloat(); |
| 194 | |
| 195 | // This was figured out by using drawRect() until saw the area it should be |
| 196 | // TODO: move rain here too? |
| 197 | // const float leftCloudWidth = mCloudLeftTargetArea.getWidth(); |
| 198 | // const float leftCloudHeight = mCloudLeftTargetArea.getHeight(); |
| 199 | // mLeftRain = mCloudLeftTargetArea.translated(leftCloudWidth / 3.8f, leftCloudHeight / 1.7f) |
| 200 | // .withWidth(leftCloudWidth / 2.0f) |
| 201 | // .withHeight(leftCloudHeight / 1.6f); |
| 202 | // const float rightCloudWidth = mCloudRightTargetArea.getWidth(); |
| 203 | // const float rightCloudHeight = mCloudRightTargetArea.getHeight(); |
| 204 | // mRightRain = mCloudRightTargetArea.translated(rightCloudWidth / 4.2f, rightCloudHeight / 1.7f) |
| 205 | // .withWidth(rightCloudWidth / 2.0f) |
| 206 | // .withHeight(rightCloudHeight / 1.6f); |
| 207 | } |
| 208 | |
| 209 | // Spec type combobox |
| 210 | mSpecType.setBounds(r.removeFromRight(SPEC_TYPE_WIDTH).removeFromTop(SPEC_TYPE_HEIGHT)); |
| 211 | |
| 212 | mStartPoint = juce::Point<int>(mRainbowRect.getWidth() / 2, mRainbowRect.getHeight()); |
| 213 | mCenterPoint = juce::Point<float>(getWidth() / 2.0f, mRainbowRect.getBottom()); |
| 214 | mStartRadius = (mRainbowRect.getWidth() / 2.0f) / 2.6f; |
| 215 | mEndRadius = mRainbowRect.getWidth() / 2.0f; |
| 216 | mBowWidth = mEndRadius - mStartRadius; |
| 217 | } |
| 218 | |
| 219 | void ArcSpectrogram::mouseMove(const juce::MouseEvent& evt) { |
| 220 | auto pos = evt.getEventRelativeTo(this).getPosition().toFloat(); |