Recompute property browser viewport on resize.
Before this commit, resizing the property browser would cut off the rows at the bottom, or else add black space, until next refresh. This could be perhaps more elegantly done by adding an onResize event but given that each of them would be followed by onRender anyway, it seems there's no benefit to adding onResize.pull/507/head
parent
54015b6777
commit
f0359556d8
|
@ -563,7 +563,11 @@ void TextWindow::Show() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(window) {
|
if(window) Resize();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TextWindow::Resize()
|
||||||
|
{
|
||||||
double width, height;
|
double width, height;
|
||||||
window->GetContentSize(&width, &height);
|
window->GetContentSize(&width, &height);
|
||||||
|
|
||||||
|
@ -578,7 +582,6 @@ void TextWindow::Show() {
|
||||||
window->SetScrollbarVisible(top[rows - 1] + 1 > halfRows);
|
window->SetScrollbarVisible(top[rows - 1] + 1 > halfRows);
|
||||||
window->Invalidate();
|
window->Invalidate();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void TextWindow::DrawOrHitTestIcons(UiCanvas *uiCanvas, TextWindow::DrawOrHitHow how,
|
void TextWindow::DrawOrHitTestIcons(UiCanvas *uiCanvas, TextWindow::DrawOrHitHow how,
|
||||||
double mx, double my)
|
double mx, double my)
|
||||||
|
@ -909,6 +912,8 @@ void TextWindow::Paint() {
|
||||||
|
|
||||||
double width, height;
|
double width, height;
|
||||||
window->GetContentSize(&width, &height);
|
window->GetContentSize(&width, &height);
|
||||||
|
if(halfRows != (int)height / (LINE_HEIGHT/2))
|
||||||
|
Resize();
|
||||||
|
|
||||||
Camera camera = {};
|
Camera camera = {};
|
||||||
camera.width = width;
|
camera.width = width;
|
||||||
|
|
1
src/ui.h
1
src/ui.h
|
@ -253,6 +253,7 @@ public:
|
||||||
void ClearScreen();
|
void ClearScreen();
|
||||||
|
|
||||||
void Show();
|
void Show();
|
||||||
|
void Resize();
|
||||||
|
|
||||||
// State for the screen that we are showing in the text window.
|
// State for the screen that we are showing in the text window.
|
||||||
enum class Screen : uint32_t {
|
enum class Screen : uint32_t {
|
||||||
|
|
Loading…
Reference in New Issue