improving filter display
This commit is contained in:
@@ -911,17 +911,21 @@ function private.remove_post_filter()
|
||||
end
|
||||
|
||||
do
|
||||
local text
|
||||
|
||||
function private.update_filter_display()
|
||||
local text = aux.filter.indented_post_query_string(m.post_components)
|
||||
text = aux.filter.indented_post_query_string(m.post_components)
|
||||
m.filter_display:SetWidth(m.filter_display_width())
|
||||
m.filter_display:SetText(text)
|
||||
end
|
||||
|
||||
function private.filter_display_width()
|
||||
local widest_line = 0
|
||||
for line in string.gfind(text, '<p>(.-)</p>') do
|
||||
m.filter_display.measure:SetText(line)
|
||||
widest_line = max(widest_line, m.filter_display.measure:GetStringWidth())
|
||||
end
|
||||
m.filter_display:SetWidth(widest_line)
|
||||
m.filter_display:SetText(text)
|
||||
local scroll_frame = m.filter_display:GetParent()
|
||||
scroll_frame:SetHorizontalScroll(max(scroll_frame:GetWidth() - widest_line, scroll_frame:GetHorizontalScroll()))
|
||||
return widest_line
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -546,7 +546,8 @@ do
|
||||
local x, y = GetCursorPosition()
|
||||
local new_x_offset = this.x_offset + x - this.x
|
||||
local new_y_offset = this.y_offset + y - this.y
|
||||
this:SetHorizontalScroll(min(0, new_x_offset - this.x_extra))
|
||||
|
||||
this:SetHorizontalScroll(min(0, max((this:GetWidth() - m.filter_display_width())*m.filter_display:GetScale() - 2, new_x_offset - this.x_extra)))
|
||||
this:SetVerticalScroll(max(0, new_y_offset - this.y_extra))
|
||||
this.x_extra = max(this.x_extra, new_x_offset)
|
||||
this.y_extra = min(this.y_extra, new_y_offset)
|
||||
|
||||
Reference in New Issue
Block a user