From e6e1dce59fa4f5c8d082874633b06954f453bb36 Mon Sep 17 00:00:00 2001 From: Sam El-Husseini Date: Mon, 18 Dec 2017 17:07:23 -0800 Subject: [PATCH] Add tiny padding around the screen for the canvas. --- sim/visuals/board.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sim/visuals/board.ts b/sim/visuals/board.ts index d74b6359..79be7b10 100644 --- a/sim/visuals/board.ts +++ b/sim/visuals/board.ts @@ -400,12 +400,12 @@ namespace pxsim.visuals { const bBox = this.layoutView.getBrick().getScreenBBox(); if (!bBox || bBox.width == 0) return; - const scale = bBox.width / SCREEN_WIDTH; - this.screenScaledWidth = bBox.width; + const scale = (bBox.width - 4) / SCREEN_WIDTH; + this.screenScaledWidth = (bBox.width - 4); this.screenScaledHeight = this.screenScaledWidth / SCREEN_WIDTH * SCREEN_HEIGHT; - this.screenCanvas.style.top = `${bBox.top}px`; - this.screenCanvas.style.left = `${bBox.left}px`; + this.screenCanvas.style.top = `${bBox.top + 2}px`; + this.screenCanvas.style.left = `${bBox.left + 2}px`; this.screenCanvas.width = this.screenScaledWidth; this.screenCanvas.height = this.screenScaledHeight;