|
822 | 822 | var profileCtx = profileCanvas.getContext("2d"); |
823 | 823 | var profileHint = document.querySelector("#profile-container .profile-hint"); |
824 | 824 | profileCanvas.style.display = "none"; |
| 825 | + |
| 826 | + // Profile font size control |
| 827 | + var profileFontSize = 10; |
| 828 | + var profileFontControl = document.createElement("div"); |
| 829 | + profileFontControl.className = "profile-font-control"; |
| 830 | + var pfRange = document.createElement("input"); |
| 831 | + pfRange.type = "range"; |
| 832 | + pfRange.min = "7"; |
| 833 | + pfRange.max = "14"; |
| 834 | + pfRange.step = "1"; |
| 835 | + pfRange.value = "10"; |
| 836 | + var pfLabel = document.createElement("span"); |
| 837 | + pfLabel.textContent = "Font"; |
| 838 | + profileFontControl.appendChild(pfLabel); |
| 839 | + profileFontControl.appendChild(pfRange); |
| 840 | + var profileContainer = document.getElementById("profile-container"); |
| 841 | + profileContainer.insertBefore(profileFontControl, profileCanvas); |
| 842 | + pfRange.addEventListener("input", function () { |
| 843 | + profileFontSize = parseInt(pfRange.value); |
| 844 | + if (selectedElementIndex >= 0) drawProfilePlot(selectedElementIndex); |
| 845 | + }); |
825 | 846 | var removeBenchmarksBtn = document.getElementById("remove-benchmarks-btn"); |
826 | 847 | removeBenchmarksBtn.addEventListener("click", function () { |
827 | 848 | benchmarkElements = []; |
|
1042 | 1063 | var rightMargin = leftMargin; |
1043 | 1064 | var plotWidth = containerWidth - leftMargin - rightMargin; |
1044 | 1065 | if (plotWidth < 60) { leftMargin = Math.floor((containerWidth - 60) / 2); rightMargin = leftMargin; plotWidth = containerWidth - leftMargin - rightMargin; } |
1045 | | - var poleFont = "10px -apple-system, BlinkMacSystemFont, sans-serif"; |
1046 | | - var lineHeight = 12; |
| 1066 | + var poleFont = profileFontSize + "px -apple-system, BlinkMacSystemFont, sans-serif"; |
| 1067 | + var lineHeight = Math.round(profileFontSize * 1.2); |
1047 | 1068 | var rowHeight = 32; |
1048 | 1069 | var topPad = 42; |
1049 | | - var bottomPad = benchmarkElements.length > 0 ? 36 : 20; |
| 1070 | + var bottomPad = benchmarkElements.length > 0 ? 42 : 20; |
1050 | 1071 | var canvasHeight = topPad + nc * rowHeight + bottomPad; |
1051 | 1072 |
|
1052 | 1073 | var dpr = window.devicePixelRatio || 1; |
|
1077 | 1098 | profileCtx.fillText(elements[elemIdx].name, containerWidth / 2, 18); |
1078 | 1099 |
|
1079 | 1100 | // Scale ticks at top |
1080 | | - profileCtx.font = "9px -apple-system, BlinkMacSystemFont, sans-serif"; |
| 1101 | + profileCtx.font = "11px -apple-system, BlinkMacSystemFont, sans-serif"; |
1081 | 1102 | profileCtx.fillStyle = isDark ? "#888" : "#999"; |
1082 | 1103 | profileCtx.textAlign = "center"; |
1083 | 1104 | for (var s = scaleMin; s <= scaleMax; s++) { |
|
1224 | 1245 |
|
1225 | 1246 | // Legend for benchmarks |
1226 | 1247 | if (benchmarkElements.length > 0) { |
1227 | | - var legendY = topPad + nc * rowHeight + 10; |
1228 | | - profileCtx.font = "9px -apple-system, BlinkMacSystemFont, sans-serif"; |
| 1248 | + var legendY = topPad + nc * rowHeight + 12; |
| 1249 | + profileCtx.font = "bold 12px -apple-system, BlinkMacSystemFont, sans-serif"; |
1229 | 1250 | var legendX = leftMargin; |
1230 | 1251 | for (var bi = 0; bi < benchmarkElements.length; bi++) { |
1231 | 1252 | var bIdx = benchmarkElements[bi]; |
|
1887 | 1908 | axisWidth: axisWidthRange.value, |
1888 | 1909 | projWidth: projWidthRange.value, |
1889 | 1910 | pcAxisWidth: pcAxisRange.value, |
1890 | | - gridDensity: gridDensityRange.value |
| 1911 | + gridDensity: gridDensityRange.value, |
| 1912 | + profileFontSize: pfRange.value |
1891 | 1913 | }; |
1892 | 1914 | } |
1893 | 1915 |
|
|
1935 | 1957 | pcAxisRange.dispatchEvent(new Event("input")); |
1936 | 1958 | gridDensityRange.value = s.gridDensity; |
1937 | 1959 | gridDensityRange.dispatchEvent(new Event("input")); |
| 1960 | + if (s.profileFontSize) { |
| 1961 | + pfRange.value = s.profileFontSize; |
| 1962 | + pfRange.dispatchEvent(new Event("input")); |
| 1963 | + } |
1938 | 1964 |
|
1939 | 1965 | // Element/construct visibility |
1940 | 1966 | for (var i = 0; i < elements.length; i++) { |
|
0 commit comments