about summary refs log tree commit diff stats
path: root/src/render
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2022-06-08 18:04:59 +0200
committerbptato <nincsnevem662@gmail.com>2022-06-08 18:04:59 +0200
commitb6b4e896e07f143484e22cf45fb7658b10af084d (patch)
tree1cd72dc1ab5133710f1ab26fe2e3822420b3d7a4 /src/render
parent9931aa918058f64692e2d81ccd51d7e74c11e336 (diff)
downloadchawan-b6b4e896e07f143484e22cf45fb7658b10af084d.tar.gz
Simplify offset, fix a text node bug
Diffstat (limited to 'src/render')
-rw-r--r--src/render/renderdocument.nim8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/render/renderdocument.nim b/src/render/renderdocument.nim
index 798709c4..3dc72c38 100644
--- a/src/render/renderdocument.nim
+++ b/src/render/renderdocument.nim
@@ -205,8 +205,8 @@ proc paintBackground(lines: var FlexibleGrid, color: CSSColor, startx, starty, e
 proc renderBlockContext(grid: var FlexibleGrid, ctx: BlockContext, x, y: int, term: TermAttributes)
 
 proc renderInlineContext(grid: var FlexibleGrid, ctx: InlineContext, x, y: int, term: TermAttributes) =
-  let x = x + ctx.relx
-  let y = y + ctx.rely
+  let x = x + ctx.offset.x
+  let y = y + ctx.offset.y
   for row in ctx.rows:
     let x = x + row.relx
     let y = y + row.rely
@@ -232,8 +232,8 @@ proc renderBlockContext(grid: var FlexibleGrid, ctx: BlockContext, x, y: int, te
 
   while stack.len > 0:
     var (ctx, x, y) = stack.pop()
-    x += ctx.offset.absx
-    y += ctx.offset.absy
+    x += ctx.offset.x
+    y += ctx.offset.y
 
     if ctx.specified{"background-color"}.rgba.a != 0: #TODO color blending
       grid.paintBackground(ctx.specified{"background-color"}, x, y, x + ctx.width, y + ctx.height, term)