From babf8ab5c3f7a6c8da3dff02256a120560eaf32e Mon Sep 17 00:00:00 2001 From: rswindell <> Date: Thu, 17 Oct 2019 07:47:24 +0000 Subject: [PATCH] Use Math.ceil() - round up - for vertical 'center' position of draw() and drafx() methods. For consistency with how Minesweeper vertically centers its game board. --- exec/load/graphic.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exec/load/graphic.js b/exec/load/graphic.js index 15d1404125..3276a2ff98 100644 --- a/exec/load/graphic.js +++ b/exec/load/graphic.js @@ -557,7 +557,7 @@ Graphic.prototype.draw = function(xpos,ypos,width,height,xoff,yoff,delay) if(xpos==undefined || xpos < 1) xpos=1; if(ypos == 'center') // center - ypos = Math.floor((console.screen_rows - height) / 2) + 1; + ypos = Math.ceil((console.screen_rows - height) / 2) + 1; if(ypos==undefined || ypos < 1) ypos=1; if(delay==undefined) @@ -619,7 +619,7 @@ Graphic.prototype.drawfx = function(xpos,ypos,width,height,xoff,yoff) if(xpos == 'center') // center xpos = Math.floor((console.screen_columns - width) / 2) + 1; if(ypos == 'center') // center - ypos = Math.floor((console.screen_rows - height) / 2) + 1; + ypos = Math.ceil((console.screen_rows - height) / 2) + 1; if(xoff+width > this.width || yoff+height > this.height) { alert("Attempt to draw from outside of graphic: "+xoff+":"+yoff+" "+width+"x"+height+" "+this.width+"x"+this.height); return(false); -- GitLab