hyperprop-charting-library 0.1.88 → 0.1.89

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2648,7 +2648,7 @@ function createChart(element, options = {}) {
2648
2648
  const prevFont = ctx.font;
2649
2649
  ctx.font = `500 ${fontSize}px ${mergedOptions.fontFamily}`;
2650
2650
  ctx.textAlign = "left";
2651
- ctx.textBaseline = "top";
2651
+ ctx.textBaseline = "middle";
2652
2652
  const lines = (drawing.label ?? "").split("\n");
2653
2653
  const lineH = Math.round(fontSize * 1.35);
2654
2654
  const textW = Math.max(1, ...lines.map((line) => ctx.measureText(line).width));
@@ -2666,7 +2666,7 @@ function createChart(element, options = {}) {
2666
2666
  strokeRoundedRect(ax, ay, blockW, blockH, 4);
2667
2667
  }
2668
2668
  ctx.fillStyle = drawing.color;
2669
- lines.forEach((line, lineIndex) => ctx.fillText(line, ax + padX, ay + padY + lineIndex * lineH));
2669
+ lines.forEach((line, lineIndex) => ctx.fillText(line, ax + padX, ay + padY + lineIndex * lineH + lineH / 2));
2670
2670
  if (isSelected) {
2671
2671
  ctx.setLineDash([3, 3]);
2672
2672
  ctx.strokeStyle = hexToRgba(drawing.color, 0.7);
@@ -2622,7 +2622,7 @@ function createChart(element, options = {}) {
2622
2622
  const prevFont = ctx.font;
2623
2623
  ctx.font = `500 ${fontSize}px ${mergedOptions.fontFamily}`;
2624
2624
  ctx.textAlign = "left";
2625
- ctx.textBaseline = "top";
2625
+ ctx.textBaseline = "middle";
2626
2626
  const lines = (drawing.label ?? "").split("\n");
2627
2627
  const lineH = Math.round(fontSize * 1.35);
2628
2628
  const textW = Math.max(1, ...lines.map((line) => ctx.measureText(line).width));
@@ -2640,7 +2640,7 @@ function createChart(element, options = {}) {
2640
2640
  strokeRoundedRect(ax, ay, blockW, blockH, 4);
2641
2641
  }
2642
2642
  ctx.fillStyle = drawing.color;
2643
- lines.forEach((line, lineIndex) => ctx.fillText(line, ax + padX, ay + padY + lineIndex * lineH));
2643
+ lines.forEach((line, lineIndex) => ctx.fillText(line, ax + padX, ay + padY + lineIndex * lineH + lineH / 2));
2644
2644
  if (isSelected) {
2645
2645
  ctx.setLineDash([3, 3]);
2646
2646
  ctx.strokeStyle = hexToRgba(drawing.color, 0.7);
package/dist/index.cjs CHANGED
@@ -2648,7 +2648,7 @@ function createChart(element, options = {}) {
2648
2648
  const prevFont = ctx.font;
2649
2649
  ctx.font = `500 ${fontSize}px ${mergedOptions.fontFamily}`;
2650
2650
  ctx.textAlign = "left";
2651
- ctx.textBaseline = "top";
2651
+ ctx.textBaseline = "middle";
2652
2652
  const lines = (drawing.label ?? "").split("\n");
2653
2653
  const lineH = Math.round(fontSize * 1.35);
2654
2654
  const textW = Math.max(1, ...lines.map((line) => ctx.measureText(line).width));
@@ -2666,7 +2666,7 @@ function createChart(element, options = {}) {
2666
2666
  strokeRoundedRect(ax, ay, blockW, blockH, 4);
2667
2667
  }
2668
2668
  ctx.fillStyle = drawing.color;
2669
- lines.forEach((line, lineIndex) => ctx.fillText(line, ax + padX, ay + padY + lineIndex * lineH));
2669
+ lines.forEach((line, lineIndex) => ctx.fillText(line, ax + padX, ay + padY + lineIndex * lineH + lineH / 2));
2670
2670
  if (isSelected) {
2671
2671
  ctx.setLineDash([3, 3]);
2672
2672
  ctx.strokeStyle = hexToRgba(drawing.color, 0.7);
package/dist/index.js CHANGED
@@ -2622,7 +2622,7 @@ function createChart(element, options = {}) {
2622
2622
  const prevFont = ctx.font;
2623
2623
  ctx.font = `500 ${fontSize}px ${mergedOptions.fontFamily}`;
2624
2624
  ctx.textAlign = "left";
2625
- ctx.textBaseline = "top";
2625
+ ctx.textBaseline = "middle";
2626
2626
  const lines = (drawing.label ?? "").split("\n");
2627
2627
  const lineH = Math.round(fontSize * 1.35);
2628
2628
  const textW = Math.max(1, ...lines.map((line) => ctx.measureText(line).width));
@@ -2640,7 +2640,7 @@ function createChart(element, options = {}) {
2640
2640
  strokeRoundedRect(ax, ay, blockW, blockH, 4);
2641
2641
  }
2642
2642
  ctx.fillStyle = drawing.color;
2643
- lines.forEach((line, lineIndex) => ctx.fillText(line, ax + padX, ay + padY + lineIndex * lineH));
2643
+ lines.forEach((line, lineIndex) => ctx.fillText(line, ax + padX, ay + padY + lineIndex * lineH + lineH / 2));
2644
2644
  if (isSelected) {
2645
2645
  ctx.setLineDash([3, 3]);
2646
2646
  ctx.strokeStyle = hexToRgba(drawing.color, 0.7);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hyperprop-charting-library",
3
- "version": "0.1.88",
3
+ "version": "0.1.89",
4
4
  "description": "Lightweight TypeScript charting core",
5
5
  "type": "module",
6
6
  "main": "./dist/hyperprop-charting-library.cjs",