Skip to content

Commit 9f7e5b9

Browse files
committed
Fix ui fluctuations
1 parent 14e0f81 commit 9f7e5b9

File tree

4 files changed

+14
-4
lines changed

4 files changed

+14
-4
lines changed

src/NppJsonViewer/JsonViewDlg.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -941,8 +941,9 @@ void JsonViewDlg::HandleZoomOnScroll(WPARAM wParam) const
941941
int pos = GetZoomLevel(); // Current zoom level
942942
int delta = GET_WHEEL_DELTA_WPARAM(wParam);
943943

944-
const auto& zoomRange = m_pTreeViewZoom->GetRange();
945-
const bool isZoomIn = delta > 0;
944+
const auto& zoomRange = m_pTreeViewZoom->GetRange();
945+
const bool isZoomIn = delta > 0;
946+
bool bRefreshUI = true;
946947

947948
if (isZoomIn && pos < zoomRange.m_nMaxZoom)
948949
{
@@ -952,8 +953,15 @@ void JsonViewDlg::HandleZoomOnScroll(WPARAM wParam) const
952953
{
953954
pos -= 10; // Zoom out
954955
}
956+
else
957+
{
958+
bRefreshUI = false;
959+
}
955960

956-
UpdateUIOnZoom(pos);
961+
if (bRefreshUI)
962+
{
963+
UpdateUIOnZoom(pos);
964+
}
957965
}
958966

959967
void JsonViewDlg::HandleTreeEvents(LPARAM lParam) const

src/NppJsonViewer/SliderCtrl.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ void SliderCtrl::OnInit(HWND hParent, int sliderID, int sliderInfoID)
2222
// Set slider range and initial position
2323
SendMessage(m_hSelf, TBM_SETRANGE, TRUE, MAKELPARAM(m_sliderRange.m_nMinZoom, m_sliderRange.m_nMaxZoom));
2424
SendMessage(m_hSelf, TBM_SETPOS, TRUE, m_sliderRange.m_nDefault);
25+
SendMessage(m_hSelf, TBM_SETPAGESIZE, 0, m_sliderRange.m_nSteps);
2526

2627
UpdateInfo(m_sliderRange.m_nDefault);
2728

src/NppJsonViewer/SliderCtrl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ struct SliderRange
99
int m_nDefault = 100;
1010
int m_nMinZoom = 80;
1111
int m_nMaxZoom = 250;
12+
int m_nSteps = 10;
1213
}; // namespace SliderRange
1314

1415
class SliderCtrl

src/NppJsonViewer/resource.rc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ BEGIN
8888
CONTROL "",IDC_DIVIDER,"Static",SS_ETCHEDVERT,56,1,2,16
8989
EDITTEXT IDC_EDT_SEARCH,60,2,99,12,ES_AUTOHSCROLL
9090
PUSHBUTTON "",IDC_BTN_SEARCH,160,2,16,12,BS_ICON
91-
CONTROL "",IDC_ZOOM_SLIDER,"msctls_trackbar32",TBS_AUTOTICKS | TBS_NOTICKS,2,16,58,12
91+
CONTROL "",IDC_ZOOM_SLIDER,"msctls_trackbar32",TBS_AUTOTICKS | TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,2,16,58,12
9292
RTEXT "100%",IDC_ZOOM_PERCENT,60,16,22,12,SS_NOTIFY | NOT WS_GROUP,WS_EX_RIGHT
9393
CONTROL "",IDC_TREE,"SysTreeView32",TVS_HASBUTTONS | TVS_HASLINES | TVS_DISABLEDRAGDROP | TVS_SHOWSELALWAYS | TVS_FULLROWSELECT | WS_HSCROLL | WS_TABSTOP,2,30,173,264,WS_EX_CLIENTEDGE
9494
EDITTEXT IDC_EDT_NODEPATH,2,296,173,12,ES_AUTOHSCROLL | ES_READONLY

0 commit comments

Comments
 (0)