Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Current
- void MainComponent::resized()
- {
- Rectangle<int> top = getLocalBounds();
- Rectangle<int> bottom = top.removeFromTop(top.getHeight() * 0.5);
- dial1.setBounds(top.removeFromLeft(top.getWidth() * 0.5));
- dial2.setBounds(top);
- dial3.setBounds(bottom.removeFromLeft(bottom.getWidth() * 0.5));
- dial4.setBounds(bottom);
- }
- //Proposed - that using removeFromSide doesn't change caller object
- //Maybe alternative method?
- void MainComponent::resized()
- {
- Rectangle<int> area = getLocalBounds();
- int h = area.getHeight();
- int w = area.getWidth();
- dial1.setBounds(area.removeFromTop(h * 0.5).removeFromLeft(w * 0.5));
- dial2.setBounds(area.removeFromTop(h * 0.5).removeFromRight(w * 0.5));
- dial3.setBounds(area.removeFromBottom(h * 0.5).removeFromLeft(w * 0.5));
- dial4.setBounds(area.removeFromBottom(h * 0.5).removeFromRight(w * 0.5));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement