From 80873ef6b2f948966e2a66171a930266265f973a Mon Sep 17 00:00:00 2001 From: Shingo Ohtsuka Date: Thu, 4 Jan 2018 20:59:47 +0900 Subject: [PATCH] fix view for narrow --- viewer/viewer.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/viewer/viewer.js b/viewer/viewer.js index 6f47cea..bf8eee8 100644 --- a/viewer/viewer.js +++ b/viewer/viewer.js @@ -284,11 +284,11 @@ function drawCourse() { var overviewWidth = overviewPitch*(course.width+1); // The rest of the space is used by the magnified display fieldWidth = svgWidth-overviewWidth-2*xmargin; - mag = fieldWidth/course.width; + mag = Math.min(64, Math.min(fieldWidth/course.width, svgHeight/11)); field = document.createElementNS(ns, 'svg'); field.setAttribute('height', svgHeight); field.setAttribute('width', fieldWidth); - field.setAttribute('x', 0); + field.setAttribute('x', Math.max(0, (fieldWidth - (course.width + 1) * mag) / 2 )); field.setAttribute('y', 0); // Draw the course on an SVG group "courseFig" gridDotRadius = mag*gridDotRadiusRatio;