修正ScrollArea中的ListElement的绘图区域会超出ScrollArea的问题

This commit is contained in:
zhongyang219
2026-01-29 09:49:38 +08:00
parent 38d7edd832
commit 782efcdeb1
2 changed files with 13 additions and 2 deletions
+12 -2
View File
@@ -11,7 +11,17 @@
void UiElement::AbstractListElement::DrawScrollArea()
{
DrawAreaGuard guard(&ui->GetDrawer(), rect);
//设置绘图剪辑区域。如果父节点有ScrollArea元素,则需要将绘图区域限制在ScrallArea中
CRect clip_rect = rect;
Element* ele = GetParent();
while (ele != nullptr)
{
if (dynamic_cast<AbstractScrollArea*>(ele) != nullptr)
clip_rect &= ele->GetRect();
ele = ele->GetParent();
}
DrawAreaGuard guard(&ui->GetDrawer(), clip_rect);
if (GetRowCount() <= 0)
{
@@ -231,7 +241,7 @@ void UiElement::AbstractListElement::DrawScrollArea()
//绘制文本
if (!draw_mini_spectrum || j > 0)//如果第1列绘制了迷你频谱,则不再绘制文本
{
DrawAreaGuard guard(&ui->GetDrawer(), rect & rect_text);
DrawAreaGuard guard(&ui->GetDrawer(), clip_rect & rect_text);
if (!IsMultipleSelected() && i == GetItemSelected() && j == GetColumnScrollTextWhenSelected())
ui->GetDrawer().DrawScrollText(rect_text, display_name.c_str(), ui->GetUIColors().color_text, ui->GetScrollTextPixel(), false, selected_item_scroll_info, false, true);
else
+1
View File
@@ -36,6 +36,7 @@ CTestPanel::CTestPanel(CPlayerUIBase* ui)
m_combobox1->SetCurSel(0);
m_tip_info_text = m_root_element->FindElement<UiElement::Text>("tipInfoText");
m_list1 = m_root_element->FindElement<UiElement::ListElement>("list1");
if (m_list1 != nullptr)
{
m_list1 = m_root_element->FindElement<UiElement::ListElement>("list1");