Skip to content

How to get rid of the extra edges of borders? #601

Closed Locked Answered by LinArcX
LinArcX asked this question in Q&A
Discussion options

You must be logged in to vote

Ok, i fixed it by passing area to bar():

local bar = function(area, c, x, y)
	x, y = math.max(0, x), math.max(0, y)
	return ui.Bar(ui.Rect { x = x, y = y, w = ya.clamp(0, area.w - x, 1), h = math.min(1, area.h) }, ui.Bar.TOP):symbol(c)
end

function Manager:render(area)
	local chunks = self:layout(area)

	return ya.flat {
		-- Borders
    ui.Border(area, ui.Border.ALL):type(ui.Border.ROUNDED),
	  ui.Bar(chunks[1], ui.Bar.RIGHT),
	  ui.Bar(chunks[3], ui.Bar.LEFT),

	  bar(area, "┬", chunks[1].right - 1, chunks[1].y),
    bar(area, "┴", chunks[1].right - 1, chunks[1].bottom - 1),
	  bar(area, "┬", chunks[2].right, chunks[2].y),
	  bar(area, "┴", chunks[2].right, chunks[1].bottom - 1),

		--…

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@sxyazi
Comment options

@LinArcX
Comment options

@LinArcX
Comment options

@LinArcX
Comment options

Answer selected by LinArcX
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants