change center for finer meshes

This commit is contained in:
Ian Jauslin 2021-12-01 18:58:24 -05:00
parent d740dec08e
commit 52f9df3c4d

View File

@ -66,13 +66,13 @@ class Painter(Widget):
height_offset=self.app.status_bar.height+self.app.command_prompt.height height_offset=self.app.status_bar.height+self.app.command_prompt.height
# vertical lines # vertical lines
# offest wrt 0 # offest wrt 0
offset=(pos.x-mesh/2)%mesh offset=(pos.x-0.5)%mesh
for i in range(math.floor((self.width/Square_element.size-offset)/mesh)+1): for i in range(math.floor((self.width/Square_element.size-offset)/mesh)+1):
Color(1,1,1) Color(1,1,1)
Line(points=((i*mesh+offset)*Square_element.size,height_offset,(i*mesh+offset)*Square_element.size,self.height+height_offset)) Line(points=((i*mesh+offset)*Square_element.size,height_offset,(i*mesh+offset)*Square_element.size,self.height+height_offset))
# horizontal lines # horizontal lines
# offset wrt 0 # offset wrt 0
offset=(pos.y-mesh/2)%1-height_offset/Square_element.size offset=(pos.y-0.5)%1-height_offset/Square_element.size
for i in range(math.floor((self.height/Square_element.size-offset)/mesh)+1): for i in range(math.floor((self.height/Square_element.size-offset)/mesh)+1):
Color(1,1,1) Color(1,1,1)
Line(points=(0,(i*mesh+offset)*Square_element.size+height_offset,self.width,(i*mesh+offset)*Square_element.size+height_offset)) Line(points=(0,(i*mesh+offset)*Square_element.size+height_offset,self.width,(i*mesh+offset)*Square_element.size+height_offset))