Fix some spacing and alignment issues
This commit is contained in:
parent
39a4df017e
commit
82f579bf0a
1 changed files with 5 additions and 4 deletions
|
|
@ -10,6 +10,7 @@
|
||||||
#include "vstgui/lib/cgraphicspath.h"
|
#include "vstgui/lib/cgraphicspath.h"
|
||||||
#include "utility/vstgui_after.h"
|
#include "utility/vstgui_after.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
static constexpr CCoord keyoffs[12] = {0, 0.6, 1, 1.8, 2, 3,
|
static constexpr CCoord keyoffs[12] = {0, 0.6, 1, 1.8, 2, 3,
|
||||||
3.55, 4, 4.7, 5, 5.85, 6};
|
3.55, 4, 4.7, 5, 5.85, 6};
|
||||||
|
|
@ -166,7 +167,7 @@ const SPiano::Dimensions& SPiano::getDimensions(bool forceUpdate) const
|
||||||
Dimensions dim;
|
Dimensions dim;
|
||||||
dim.bounds = getViewSize();
|
dim.bounds = getViewSize();
|
||||||
dim.paddedBounds = CRect(dim.bounds)
|
dim.paddedBounds = CRect(dim.bounds)
|
||||||
.extend(-innerPaddingX_, -innerPaddingY_);
|
.extend(-2 * innerPaddingX_, -2 * innerPaddingY_);
|
||||||
CCoord keyHeight = std::floor(dim.paddedBounds.getHeight());
|
CCoord keyHeight = std::floor(dim.paddedBounds.getHeight());
|
||||||
CCoord fontHeight = font_ ? font_->getSize() : 0.0;
|
CCoord fontHeight = font_ ? font_->getSize() : 0.0;
|
||||||
keyHeight -= spacingY_ + fontHeight;
|
keyHeight -= spacingY_ + fontHeight;
|
||||||
|
|
@ -176,14 +177,14 @@ const SPiano::Dimensions& SPiano::getDimensions(bool forceUpdate) const
|
||||||
dim.paddedBounds.getWidth() / octs_ / 7.0);
|
dim.paddedBounds.getWidth() / octs_ / 7.0);
|
||||||
dim.keyBounds.setWidth(dim.keyWidth * octs_ * 7.0);
|
dim.keyBounds.setWidth(dim.keyWidth * octs_ * 7.0);
|
||||||
dim.keyBounds.offset(
|
dim.keyBounds.offset(
|
||||||
0.5 * (dim.paddedBounds.getWidth() - dim.keyBounds.getWidth()), 0.0);
|
std::floor(0.5 * (dim.paddedBounds.getWidth() - dim.keyBounds.getWidth())), 0.0);
|
||||||
|
|
||||||
if (!font_)
|
if (!font_)
|
||||||
dim.labelBounds = CRect();
|
dim.labelBounds = CRect();
|
||||||
else
|
else
|
||||||
dim.labelBounds = CRect(
|
dim.labelBounds = CRect(
|
||||||
dim.keyBounds.left, dim.keyBounds.bottom,
|
dim.keyBounds.left, dim.keyBounds.bottom + spacingY_,
|
||||||
dim.keyBounds.right, dim.keyBounds.bottom + (spacingY_ + fontHeight));
|
dim.keyBounds.right, dim.keyBounds.bottom + spacingY_ + fontHeight);
|
||||||
|
|
||||||
dim_ = dim;
|
dim_ = dim;
|
||||||
return dim_;
|
return dim_;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue