Add tiny padding around the screen for the canvas.

This commit is contained in:
Sam El-Husseini 2017-12-18 17:07:23 -08:00
parent 43a9d03231
commit e6e1dce59f

View File

@ -400,12 +400,12 @@ namespace pxsim.visuals {
const bBox = this.layoutView.getBrick().getScreenBBox(); const bBox = this.layoutView.getBrick().getScreenBBox();
if (!bBox || bBox.width == 0) return; if (!bBox || bBox.width == 0) return;
const scale = bBox.width / SCREEN_WIDTH; const scale = (bBox.width - 4) / SCREEN_WIDTH;
this.screenScaledWidth = bBox.width; this.screenScaledWidth = (bBox.width - 4);
this.screenScaledHeight = this.screenScaledWidth / SCREEN_WIDTH * SCREEN_HEIGHT; this.screenScaledHeight = this.screenScaledWidth / SCREEN_WIDTH * SCREEN_HEIGHT;
this.screenCanvas.style.top = `${bBox.top}px`; this.screenCanvas.style.top = `${bBox.top + 2}px`;
this.screenCanvas.style.left = `${bBox.left}px`; this.screenCanvas.style.left = `${bBox.left + 2}px`;
this.screenCanvas.width = this.screenScaledWidth; this.screenCanvas.width = this.screenScaledWidth;
this.screenCanvas.height = this.screenScaledHeight; this.screenCanvas.height = this.screenScaledHeight;