Skip to content

Commit

Permalink
Retro scrollbars improved and fixed
Browse files Browse the repository at this point in the history
* Adjusted slider size to more dynamic, fitting smaller scrollbars
* Fixed visible scrollbars in HeadlessMiniWindow
  • Loading branch information
Oen44 committed Oct 29, 2024
1 parent 94fa8bf commit 103f474
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
6 changes: 4 additions & 2 deletions layouts/retro/styles/10-scrollbars.otui
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ ScrollBarValueLabel < Label

VerticalScrollBar < UIScrollBar
orientation: vertical
size: 12 96
width: 12
height: 96
image-source: /images/ui/scrollbar
image-clip: 50 0 12 96
image-border-left: 1
Expand Down Expand Up @@ -69,7 +70,8 @@ VerticalScrollBar < UIScrollBar

HorizontalScrollBar < UIScrollBar
orientation: horizontal
size: 96 12
width: 96
height: 12
image-source: /images/ui/scrollbar
image-clip: 0 96 96 12
image-border-top: 1
Expand Down
6 changes: 6 additions & 0 deletions layouts/retro/styles/30-miniwindow.otui
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ MiniWindow < UIMiniWindow
margin-bottom: 3
pixels-scroll: true

$!on:
width: 0

ResizeBorder
id: bottomResizeBorder
anchors.bottom: parent.bottom
Expand Down Expand Up @@ -197,6 +200,9 @@ HeadlessMiniWindow < UIMiniWindow
margin-bottom: 3
pixels-scroll: true

$!on:
width: 0

ResizeBorder
id: bottomResizeBorder
anchors.bottom: parent.bottom
Expand Down
4 changes: 2 additions & 2 deletions modules/corelib/ui/uiscrollbar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ local function calcValues(self)
proportion = math.min(math.max(self.step, 1), range)/range
end

local px = math.max(proportion * pxrange, 30)
local px = math.max(proportion * pxrange, math.min(30, self:getHeight() - 24))
if g_app.isMobile() then
px = math.max(proportion * pxrange, 30)
px = math.max(proportion * pxrange, math.min(30, self:getHeight() - 24))
end
px = px - px % 2 + 1

Expand Down

0 comments on commit 103f474

Please sign in to comment.