mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-23 07:40:42 +01:00
[apps] In curve view, avoid to reload the whole view when reloading
cursor Change-Id: Ie8c0e100159201cc6b11122eeb567c68092a7b06
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
constexpr KDColor CurveView::k_axisColor;
|
||||
constexpr KDColor CurveView::k_gridColor;
|
||||
|
||||
CurveView::CurveView(CurveViewRange * curveViewRange, CurveViewCursor * curveViewCursor, View * bannerView,
|
||||
CurveView::CurveView(CurveViewRange * curveViewRange, CurveViewCursor * curveViewCursor, BannerView * bannerView,
|
||||
View * cursorView, float topMarginFactor, float rightMarginFactor, float bottomMarginFactor,
|
||||
float leftMarginFactor) :
|
||||
View(),
|
||||
@@ -40,7 +40,10 @@ void CurveView::reloadSelection() {
|
||||
float pixelYSelection = roundf(floatToPixel(Axis::Vertical, m_curveViewCursor->y()));
|
||||
KDRect dirtyZone(KDRect(pixelXSelection - k_cursorSize/2, pixelYSelection - k_cursorSize/2, k_cursorSize, k_cursorSize));
|
||||
markRectAsDirty(dirtyZone);
|
||||
layoutSubviews();
|
||||
layoutCursor();
|
||||
if (m_bannerView != nullptr) {
|
||||
m_bannerView->layoutSubviews();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -392,15 +395,7 @@ void CurveView::stampAtLocation(KDContext * ctx, KDRect rect, float pxf, float p
|
||||
}
|
||||
|
||||
void CurveView::layoutSubviews() {
|
||||
if (m_curveViewCursor != nullptr && m_cursorView != nullptr) {
|
||||
KDCoordinate xCursorPixelPosition = roundf(floatToPixel(Axis::Horizontal, m_curveViewCursor->x()));
|
||||
KDCoordinate yCursorPixelPosition = roundf(floatToPixel(Axis::Vertical, m_curveViewCursor->y()));
|
||||
KDRect cursorFrame(xCursorPixelPosition - k_cursorSize/2, yCursorPixelPosition - k_cursorSize/2, k_cursorSize, k_cursorSize);
|
||||
if (!m_mainViewSelected) {
|
||||
cursorFrame = KDRectZero;
|
||||
}
|
||||
m_cursorView->setFrame(cursorFrame);
|
||||
}
|
||||
layoutCursor();
|
||||
if (m_bannerView != nullptr) {
|
||||
m_bannerView->setFrame(bounds());
|
||||
KDCoordinate bannerHeight = m_bannerView->minimalSizeForOptimalDisplay().height();
|
||||
@@ -412,6 +407,18 @@ void CurveView::layoutSubviews() {
|
||||
}
|
||||
}
|
||||
|
||||
void CurveView::layoutCursor() {
|
||||
if (m_curveViewCursor != nullptr && m_cursorView != nullptr) {
|
||||
KDCoordinate xCursorPixelPosition = roundf(floatToPixel(Axis::Horizontal, m_curveViewCursor->x()));
|
||||
KDCoordinate yCursorPixelPosition = roundf(floatToPixel(Axis::Vertical, m_curveViewCursor->y()));
|
||||
KDRect cursorFrame(xCursorPixelPosition - k_cursorSize/2, yCursorPixelPosition - k_cursorSize/2, k_cursorSize, k_cursorSize);
|
||||
if (!m_mainViewSelected) {
|
||||
cursorFrame = KDRectZero;
|
||||
}
|
||||
m_cursorView->setFrame(cursorFrame);
|
||||
}
|
||||
}
|
||||
|
||||
int CurveView::numberOfSubviews() const {
|
||||
return (m_bannerView != nullptr) + (m_cursorView != nullptr);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user