Freeze the scrollbar while editor is open in property browser.
Before this commit, the scrollbar would move freely, without changing the position of the viewport. It would be reset after editing is finished.pull/507/head
parent
f0359556d8
commit
8c750cef9c
|
@ -952,9 +952,10 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetScrollbarPosition(double pos) override {
|
void SetScrollbarPosition(double pos) override {
|
||||||
if(pos > ssView.scrollerMax) {
|
if(pos > ssView.scrollerMax)
|
||||||
pos = ssView.scrollerMax;
|
pos = ssView.scrollerMax;
|
||||||
}
|
if(GetScrollbarPosition() == pos)
|
||||||
|
return;
|
||||||
[nsScroller setDoubleValue:(pos / (ssView.scrollerMax - ssView.scrollerMin))];
|
[nsScroller setDoubleValue:(pos / (ssView.scrollerMax - ssView.scrollerMin))];
|
||||||
if(onScrollbarAdjusted) {
|
if(onScrollbarAdjusted) {
|
||||||
onScrollbarAdjusted(pos);
|
onScrollbarAdjusted(pos);
|
||||||
|
|
|
@ -1354,7 +1354,11 @@ public:
|
||||||
SCROLLINFO si = {};
|
SCROLLINFO si = {};
|
||||||
si.cbSize = sizeof(si);
|
si.cbSize = sizeof(si);
|
||||||
si.fMask = SIF_POS;
|
si.fMask = SIF_POS;
|
||||||
si.nPos = (UINT)(pos * SCROLLBAR_UNIT);
|
sscheck(GetScrollInfo(hWindow, SB_VERT, &si));
|
||||||
|
if(si.nPos == (int)(pos * SCROLLBAR_UNIT))
|
||||||
|
return;
|
||||||
|
|
||||||
|
si.nPos = (int)(pos * SCROLLBAR_UNIT);
|
||||||
sscheck(SetScrollInfo(hWindow, SB_VERT, &si, /*redraw=*/TRUE));
|
sscheck(SetScrollInfo(hWindow, SB_VERT, &si, /*redraw=*/TRUE));
|
||||||
|
|
||||||
// Windows won't synthesize a WM_VSCROLL for us here.
|
// Windows won't synthesize a WM_VSCROLL for us here.
|
||||||
|
|
|
@ -1129,8 +1129,10 @@ void TextWindow::MouseLeave() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextWindow::ScrollbarEvent(double newPos) {
|
void TextWindow::ScrollbarEvent(double newPos) {
|
||||||
if(window->IsEditorVisible())
|
if(window->IsEditorVisible()) {
|
||||||
|
window->SetScrollbarPosition(scrollPos);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int bottom = top[rows-1] + 2;
|
int bottom = top[rows-1] + 2;
|
||||||
newPos = min((int)newPos, bottom - halfRows);
|
newPos = min((int)newPos, bottom - halfRows);
|
||||||
|
|
Loading…
Reference in New Issue