From 82f579bf0aed4597e42f86c348484f50d3212db5 Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Wed, 14 Oct 2020 19:01:40 +0200 Subject: [PATCH] Fix some spacing and alignment issues --- editor/src/editor/GUIPiano.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/editor/src/editor/GUIPiano.cpp b/editor/src/editor/GUIPiano.cpp index 6d4919bb..dd7d6cf5 100644 --- a/editor/src/editor/GUIPiano.cpp +++ b/editor/src/editor/GUIPiano.cpp @@ -10,6 +10,7 @@ #include "vstgui/lib/cgraphicspath.h" #include "utility/vstgui_after.h" #include +#include static constexpr CCoord keyoffs[12] = {0, 0.6, 1, 1.8, 2, 3, 3.55, 4, 4.7, 5, 5.85, 6}; @@ -166,7 +167,7 @@ const SPiano::Dimensions& SPiano::getDimensions(bool forceUpdate) const Dimensions dim; dim.bounds = getViewSize(); dim.paddedBounds = CRect(dim.bounds) - .extend(-innerPaddingX_, -innerPaddingY_); + .extend(-2 * innerPaddingX_, -2 * innerPaddingY_); CCoord keyHeight = std::floor(dim.paddedBounds.getHeight()); CCoord fontHeight = font_ ? font_->getSize() : 0.0; keyHeight -= spacingY_ + fontHeight; @@ -176,14 +177,14 @@ const SPiano::Dimensions& SPiano::getDimensions(bool forceUpdate) const dim.paddedBounds.getWidth() / octs_ / 7.0); dim.keyBounds.setWidth(dim.keyWidth * octs_ * 7.0); 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_) dim.labelBounds = CRect(); else dim.labelBounds = CRect( - dim.keyBounds.left, dim.keyBounds.bottom, - dim.keyBounds.right, dim.keyBounds.bottom + (spacingY_ + fontHeight)); + dim.keyBounds.left, dim.keyBounds.bottom + spacingY_, + dim.keyBounds.right, dim.keyBounds.bottom + spacingY_ + fontHeight); dim_ = dim; return dim_;