Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions luaui/Include/keybind_dropdown.lua
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ local chevronX, chevronY, chevronH = 0, 0, 0
local function chevronVertices()
gl.Vertex(chevronX - chevronH, chevronY)
gl.Vertex(chevronX + chevronH, chevronY)
gl.Vertex(chevronX, chevronY - chevronH * 1.2)
-- Floored with the rest: a vertex between two pixels softens the whole glyph.
gl.Vertex(chevronX, floor(chevronY - chevronH * 1.2))
end

function Dropdown:draw()
Expand All @@ -129,7 +130,7 @@ function Dropdown:draw()
-- makes both flicker.
local arrowH = floor((y2 - y1) * 0.16)
local arrowX = x2 - inset - arrowH
local arrowY = (y1 + y2) * 0.5 + arrowH * 0.5
local arrowY = floor((y1 + y2) * 0.5 + arrowH * 0.5)
gl.Color(1, 1, 1, self.open and 0.9 or 0.55)
chevronX, chevronY, chevronH = arrowX, arrowY, arrowH
gl.BeginEnd(GL.TRIANGLES, chevronVertices)
Expand All @@ -150,7 +151,7 @@ function Dropdown:draw()
font:Print(
fittedLabel(fitted, 0, font, label, labelW, self.fontSize),
x1 + inset,
(y1 + y2) * 0.5,
floor((y1 + y2) * 0.5),
self.fontSize,
"ov"
)
Expand All @@ -160,7 +161,7 @@ function Dropdown:draw()
local top = self.optRects[1].y2
local bottom = self.optRects[#self.optRects].y1
-- Rounded like the rest of the panel's inner elements.
local cs = WG.FlowUI.elementCorner * 0.66
local cs = floor(WG.FlowUI.elementCorner * 0.66)
R(x1, bottom, x2, top, cs, 1, 1, 1, 1, listFill)

for i in ipairs(self.options) do
Expand All @@ -178,7 +179,7 @@ function Dropdown:draw()
font:Print(
fittedLabel(fitted, i, font, optionLabel(opt), w, self.fontSize),
r.x1 + inset,
(r.y1 + r.y2) * 0.5,
floor((r.y1 + r.y2) * 0.5),
self.fontSize,
"ov"
)
Expand Down
15 changes: 8 additions & 7 deletions luaui/Include/keybind_editbox.lua
Original file line number Diff line number Diff line change
Expand Up @@ -328,17 +328,18 @@
local x1, y1, x2, y2 = self.rect[1], self.rect[2], self.rect[3], self.rect[4]
-- Rounded like the rest of the panel's inner elements; the caret and selection sit
-- inside the field by their own inset.
local cs = WG.FlowUI.elementCorner * 0.66
-- Whole pixels: an edge on a fraction is blended across two of them and reads soft.
local cs = floor(WG.FlowUI.elementCorner * 0.66)
local inset = floor((y2 - y1) * 0.18)
local tx = x1 + self.pad
local ty = (y1 + y2) * 0.5
local ty = floor((y1 + y2) * 0.5)

R(x1, y1, x2, y2, cs, 1, 1, 1, 1, fieldFill)

if self:hasSelection() then
local a, b = self:selRange()
local sa = font:GetTextWidth(utf8.sub(self.text, 1, a)) * self.fontSize
local sb = font:GetTextWidth(utf8.sub(self.text, 1, b)) * self.fontSize
local sa = floor(font:GetTextWidth(utf8.sub(self.text, 1, a)) * self.fontSize)
local sb = floor(font:GetTextWidth(utf8.sub(self.text, 1, b)) * self.fontSize)
gl.Color(0.4, 0.55, 0.85, 0.5)
gl.Rect(tx + sa, y1 + inset, tx + sb, y2 - inset)
gl.Color(1, 1, 1, 1)
Expand Down Expand Up @@ -367,10 +368,10 @@
if self.focused then
-- Sharp bar rather than a rounded one, sized and placed off the font like chat's:
-- a fixed span around the text's middle, so it does not stretch with the field.
local cx = tx + caretOffset(self, font)
local cx = floor(tx + caretOffset(self, font))
local cWidth = 1 + floor(self.fontSize / 14)
local cy1 = math.max(y1 + 1, ty - self.fontSize * 0.6)
local cy2 = math.min(y2 - 1, ty + self.fontSize * 0.64)
local cy1 = math.max(y1 + 1, floor(ty - self.fontSize * 0.6))
local cy2 = math.min(y2 - 1, floor(ty + self.fontSize * 0.64))

Check warning on line 374 in luaui/Include/keybind_editbox.lua

View workflow job for this annotation

GitHub Actions / emmylua_check

assign-type-mismatch

Cannot assign `number` to `integer`.
gl.Color(cursorGrey, cursorGrey, cursorGrey, caretAlpha(self))
gl.Rect(cx, cy1, cx + cWidth, cy2)
gl.Color(1, 1, 1, 1)
Expand Down
Loading
Loading