Просмотр исходного кода

fix: scale plot line widths by devicePixelRatio

- Curve lines: 3 * dpr (was hardcoded 2)
- Axis lines: 2 * dpr (was hardcoded 1.2)
- Grid lines: 0.6 * dpr (was hardcoded 0.5)
- Scatter point radius: 3 * dpr (was hardcoded 3.5)

Co-Authored-By: Claude <noreply@anthropic.com>
nonvioce 3 месяцев назад
Родитель
Сommit
a3a1fccb2a
1 измененных файлов с 4 добавлено и 4 удалено
  1. 4 4
      app/src/main/assets/console.js

+ 4 - 4
app/src/main/assets/console.js

@@ -2183,7 +2183,7 @@ class PlotRenderer {
 
 
                 if (el.type === 'line' || (el.type === 'point' && this.data.options && this.data.options.joined)) {
                 if (el.type === 'line' || (el.type === 'point' && this.data.options && this.data.options.joined)) {
                     ctx.strokeStyle = rgb;
                     ctx.strokeStyle = rgb;
-                    ctx.lineWidth = 2;
+                    ctx.lineWidth = 3 * this.dpr;
                     ctx.beginPath();
                     ctx.beginPath();
                     for (let i = 0; i < el.points.length; i++) {
                     for (let i = 0; i < el.points.length; i++) {
                         const pt = this.toCanvas(el.points[i][0], el.points[i][1]);
                         const pt = this.toCanvas(el.points[i][0], el.points[i][1]);
@@ -2198,7 +2198,7 @@ class PlotRenderer {
                     for (const pt of el.points) {
                     for (const pt of el.points) {
                         const p = this.toCanvas(pt[0], pt[1]);
                         const p = this.toCanvas(pt[0], pt[1]);
                         ctx.beginPath();
                         ctx.beginPath();
-                        ctx.arc(p.x, p.y, 3.5, 0, Math.PI * 2);
+                        ctx.arc(p.x, p.y, 3 * this.dpr, 0, Math.PI * 2);
                         ctx.fill();
                         ctx.fill();
                     }
                     }
                 }
                 }
@@ -2213,7 +2213,7 @@ class PlotRenderer {
         const xRange = b.xMax - b.xMin, yRange = b.yMax - b.yMin;
         const xRange = b.xMax - b.xMin, yRange = b.yMax - b.yMin;
 
 
         ctx.strokeStyle = '#E8EDF2';
         ctx.strokeStyle = '#E8EDF2';
-        ctx.lineWidth = 0.5;
+        ctx.lineWidth = 0.6 * this.dpr;
         ctx.fillStyle = '#8B95A5';
         ctx.fillStyle = '#8B95A5';
         ctx.font = '11px -apple-system, sans-serif';
         ctx.font = '11px -apple-system, sans-serif';
         ctx.textAlign = 'center';
         ctx.textAlign = 'center';
@@ -2256,7 +2256,7 @@ class PlotRenderer {
         const origin = this.toCanvas(0, 0);
         const origin = this.toCanvas(0, 0);
 
 
         ctx.strokeStyle = '#1976D2';
         ctx.strokeStyle = '#1976D2';
-        ctx.lineWidth = 1.2;
+        ctx.lineWidth = 2 * this.dpr;
         ctx.fillStyle = '#1976D2';
         ctx.fillStyle = '#1976D2';
         ctx.font = 'bold 11px -apple-system, sans-serif';
         ctx.font = 'bold 11px -apple-system, sans-serif';