hyperprop-charting-library 0.1.19 → 0.1.20

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.
@@ -1529,7 +1529,6 @@ function createChart(element, options = {}) {
1529
1529
  lastPointerX = point.x;
1530
1530
  lastPointerY = point.y;
1531
1531
  canvas.setPointerCapture(event.pointerId);
1532
- setCrosshairPoint(null);
1533
1532
  };
1534
1533
  const onPointerMove = (event) => {
1535
1534
  const point = getCanvasPoint(event);
@@ -1611,7 +1610,7 @@ function createChart(element, options = {}) {
1611
1610
  }
1612
1611
  const hoverRegion = getHitRegion(point.x, point.y);
1613
1612
  if (hoverRegion === "plot") {
1614
- canvas.style.cursor = "default";
1613
+ canvas.style.cursor = doubleClickEnabled ? "default" : "crosshair";
1615
1614
  setCrosshairPoint(point);
1616
1615
  emitCrosshairMove(point.x, point.y, "plot");
1617
1616
  } else if (hoverRegion === "x-axis") {
@@ -1631,7 +1630,7 @@ function createChart(element, options = {}) {
1631
1630
  const deltaX = point.x - lastPointerX;
1632
1631
  const deltaY = point.y - lastPointerY;
1633
1632
  if (dragMode === "plot") {
1634
- canvas.style.cursor = "default";
1633
+ canvas.style.cursor = "grabbing";
1635
1634
  pan(deltaX, deltaY, true, true);
1636
1635
  setCrosshairPoint(null);
1637
1636
  } else if (dragMode === "x-axis") {
@@ -1689,7 +1688,6 @@ function createChart(element, options = {}) {
1689
1688
  dragMode = null;
1690
1689
  activePointerId = null;
1691
1690
  canvas.style.cursor = "default";
1692
- setCrosshairPoint(null);
1693
1691
  if (event && pointerDownInfo && event.pointerId === pointerDownInfo.pointerId) {
1694
1692
  if (!pointerDownInfo.moved) {
1695
1693
  const clickPrice = pointerDownInfo.region === "plot" ? Number(priceFromCanvasY(pointerDownInfo.y).toFixed(2)) : void 0;
@@ -1699,10 +1697,21 @@ function createChart(element, options = {}) {
1699
1697
  ...clickPrice === void 0 ? {} : { price: clickPrice },
1700
1698
  region: pointerDownInfo.region
1701
1699
  });
1700
+ if (pointerDownInfo.region === "plot") {
1701
+ const clickPoint = { x: pointerDownInfo.x, y: pointerDownInfo.y };
1702
+ setCrosshairPoint(clickPoint);
1703
+ emitCrosshairMove(clickPoint.x, clickPoint.y, "plot");
1704
+ canvas.style.cursor = doubleClickEnabled ? "default" : "crosshair";
1705
+ } else {
1706
+ setCrosshairPoint(null);
1707
+ }
1708
+ } else {
1709
+ setCrosshairPoint(null);
1702
1710
  }
1703
1711
  pointerDownInfo = null;
1704
1712
  } else if (!event) {
1705
1713
  pointerDownInfo = null;
1714
+ setCrosshairPoint(null);
1706
1715
  }
1707
1716
  };
1708
1717
  const onWheel = (event) => {
@@ -1505,7 +1505,6 @@ function createChart(element, options = {}) {
1505
1505
  lastPointerX = point.x;
1506
1506
  lastPointerY = point.y;
1507
1507
  canvas.setPointerCapture(event.pointerId);
1508
- setCrosshairPoint(null);
1509
1508
  };
1510
1509
  const onPointerMove = (event) => {
1511
1510
  const point = getCanvasPoint(event);
@@ -1587,7 +1586,7 @@ function createChart(element, options = {}) {
1587
1586
  }
1588
1587
  const hoverRegion = getHitRegion(point.x, point.y);
1589
1588
  if (hoverRegion === "plot") {
1590
- canvas.style.cursor = "default";
1589
+ canvas.style.cursor = doubleClickEnabled ? "default" : "crosshair";
1591
1590
  setCrosshairPoint(point);
1592
1591
  emitCrosshairMove(point.x, point.y, "plot");
1593
1592
  } else if (hoverRegion === "x-axis") {
@@ -1607,7 +1606,7 @@ function createChart(element, options = {}) {
1607
1606
  const deltaX = point.x - lastPointerX;
1608
1607
  const deltaY = point.y - lastPointerY;
1609
1608
  if (dragMode === "plot") {
1610
- canvas.style.cursor = "default";
1609
+ canvas.style.cursor = "grabbing";
1611
1610
  pan(deltaX, deltaY, true, true);
1612
1611
  setCrosshairPoint(null);
1613
1612
  } else if (dragMode === "x-axis") {
@@ -1665,7 +1664,6 @@ function createChart(element, options = {}) {
1665
1664
  dragMode = null;
1666
1665
  activePointerId = null;
1667
1666
  canvas.style.cursor = "default";
1668
- setCrosshairPoint(null);
1669
1667
  if (event && pointerDownInfo && event.pointerId === pointerDownInfo.pointerId) {
1670
1668
  if (!pointerDownInfo.moved) {
1671
1669
  const clickPrice = pointerDownInfo.region === "plot" ? Number(priceFromCanvasY(pointerDownInfo.y).toFixed(2)) : void 0;
@@ -1675,10 +1673,21 @@ function createChart(element, options = {}) {
1675
1673
  ...clickPrice === void 0 ? {} : { price: clickPrice },
1676
1674
  region: pointerDownInfo.region
1677
1675
  });
1676
+ if (pointerDownInfo.region === "plot") {
1677
+ const clickPoint = { x: pointerDownInfo.x, y: pointerDownInfo.y };
1678
+ setCrosshairPoint(clickPoint);
1679
+ emitCrosshairMove(clickPoint.x, clickPoint.y, "plot");
1680
+ canvas.style.cursor = doubleClickEnabled ? "default" : "crosshair";
1681
+ } else {
1682
+ setCrosshairPoint(null);
1683
+ }
1684
+ } else {
1685
+ setCrosshairPoint(null);
1678
1686
  }
1679
1687
  pointerDownInfo = null;
1680
1688
  } else if (!event) {
1681
1689
  pointerDownInfo = null;
1690
+ setCrosshairPoint(null);
1682
1691
  }
1683
1692
  };
1684
1693
  const onWheel = (event) => {
package/dist/index.cjs CHANGED
@@ -1529,7 +1529,6 @@ function createChart(element, options = {}) {
1529
1529
  lastPointerX = point.x;
1530
1530
  lastPointerY = point.y;
1531
1531
  canvas.setPointerCapture(event.pointerId);
1532
- setCrosshairPoint(null);
1533
1532
  };
1534
1533
  const onPointerMove = (event) => {
1535
1534
  const point = getCanvasPoint(event);
@@ -1611,7 +1610,7 @@ function createChart(element, options = {}) {
1611
1610
  }
1612
1611
  const hoverRegion = getHitRegion(point.x, point.y);
1613
1612
  if (hoverRegion === "plot") {
1614
- canvas.style.cursor = "default";
1613
+ canvas.style.cursor = doubleClickEnabled ? "default" : "crosshair";
1615
1614
  setCrosshairPoint(point);
1616
1615
  emitCrosshairMove(point.x, point.y, "plot");
1617
1616
  } else if (hoverRegion === "x-axis") {
@@ -1631,7 +1630,7 @@ function createChart(element, options = {}) {
1631
1630
  const deltaX = point.x - lastPointerX;
1632
1631
  const deltaY = point.y - lastPointerY;
1633
1632
  if (dragMode === "plot") {
1634
- canvas.style.cursor = "default";
1633
+ canvas.style.cursor = "grabbing";
1635
1634
  pan(deltaX, deltaY, true, true);
1636
1635
  setCrosshairPoint(null);
1637
1636
  } else if (dragMode === "x-axis") {
@@ -1689,7 +1688,6 @@ function createChart(element, options = {}) {
1689
1688
  dragMode = null;
1690
1689
  activePointerId = null;
1691
1690
  canvas.style.cursor = "default";
1692
- setCrosshairPoint(null);
1693
1691
  if (event && pointerDownInfo && event.pointerId === pointerDownInfo.pointerId) {
1694
1692
  if (!pointerDownInfo.moved) {
1695
1693
  const clickPrice = pointerDownInfo.region === "plot" ? Number(priceFromCanvasY(pointerDownInfo.y).toFixed(2)) : void 0;
@@ -1699,10 +1697,21 @@ function createChart(element, options = {}) {
1699
1697
  ...clickPrice === void 0 ? {} : { price: clickPrice },
1700
1698
  region: pointerDownInfo.region
1701
1699
  });
1700
+ if (pointerDownInfo.region === "plot") {
1701
+ const clickPoint = { x: pointerDownInfo.x, y: pointerDownInfo.y };
1702
+ setCrosshairPoint(clickPoint);
1703
+ emitCrosshairMove(clickPoint.x, clickPoint.y, "plot");
1704
+ canvas.style.cursor = doubleClickEnabled ? "default" : "crosshair";
1705
+ } else {
1706
+ setCrosshairPoint(null);
1707
+ }
1708
+ } else {
1709
+ setCrosshairPoint(null);
1702
1710
  }
1703
1711
  pointerDownInfo = null;
1704
1712
  } else if (!event) {
1705
1713
  pointerDownInfo = null;
1714
+ setCrosshairPoint(null);
1706
1715
  }
1707
1716
  };
1708
1717
  const onWheel = (event) => {
package/dist/index.js CHANGED
@@ -1505,7 +1505,6 @@ function createChart(element, options = {}) {
1505
1505
  lastPointerX = point.x;
1506
1506
  lastPointerY = point.y;
1507
1507
  canvas.setPointerCapture(event.pointerId);
1508
- setCrosshairPoint(null);
1509
1508
  };
1510
1509
  const onPointerMove = (event) => {
1511
1510
  const point = getCanvasPoint(event);
@@ -1587,7 +1586,7 @@ function createChart(element, options = {}) {
1587
1586
  }
1588
1587
  const hoverRegion = getHitRegion(point.x, point.y);
1589
1588
  if (hoverRegion === "plot") {
1590
- canvas.style.cursor = "default";
1589
+ canvas.style.cursor = doubleClickEnabled ? "default" : "crosshair";
1591
1590
  setCrosshairPoint(point);
1592
1591
  emitCrosshairMove(point.x, point.y, "plot");
1593
1592
  } else if (hoverRegion === "x-axis") {
@@ -1607,7 +1606,7 @@ function createChart(element, options = {}) {
1607
1606
  const deltaX = point.x - lastPointerX;
1608
1607
  const deltaY = point.y - lastPointerY;
1609
1608
  if (dragMode === "plot") {
1610
- canvas.style.cursor = "default";
1609
+ canvas.style.cursor = "grabbing";
1611
1610
  pan(deltaX, deltaY, true, true);
1612
1611
  setCrosshairPoint(null);
1613
1612
  } else if (dragMode === "x-axis") {
@@ -1665,7 +1664,6 @@ function createChart(element, options = {}) {
1665
1664
  dragMode = null;
1666
1665
  activePointerId = null;
1667
1666
  canvas.style.cursor = "default";
1668
- setCrosshairPoint(null);
1669
1667
  if (event && pointerDownInfo && event.pointerId === pointerDownInfo.pointerId) {
1670
1668
  if (!pointerDownInfo.moved) {
1671
1669
  const clickPrice = pointerDownInfo.region === "plot" ? Number(priceFromCanvasY(pointerDownInfo.y).toFixed(2)) : void 0;
@@ -1675,10 +1673,21 @@ function createChart(element, options = {}) {
1675
1673
  ...clickPrice === void 0 ? {} : { price: clickPrice },
1676
1674
  region: pointerDownInfo.region
1677
1675
  });
1676
+ if (pointerDownInfo.region === "plot") {
1677
+ const clickPoint = { x: pointerDownInfo.x, y: pointerDownInfo.y };
1678
+ setCrosshairPoint(clickPoint);
1679
+ emitCrosshairMove(clickPoint.x, clickPoint.y, "plot");
1680
+ canvas.style.cursor = doubleClickEnabled ? "default" : "crosshair";
1681
+ } else {
1682
+ setCrosshairPoint(null);
1683
+ }
1684
+ } else {
1685
+ setCrosshairPoint(null);
1678
1686
  }
1679
1687
  pointerDownInfo = null;
1680
1688
  } else if (!event) {
1681
1689
  pointerDownInfo = null;
1690
+ setCrosshairPoint(null);
1682
1691
  }
1683
1692
  };
1684
1693
  const onWheel = (event) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hyperprop-charting-library",
3
- "version": "0.1.19",
3
+ "version": "0.1.20",
4
4
  "description": "Lightweight TypeScript charting core",
5
5
  "type": "module",
6
6
  "main": "./dist/hyperprop-charting-library.cjs",