hyperprop-charting-library 0.1.110 → 0.1.111

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.
@@ -4617,52 +4617,55 @@ function createChart(element, options = {}) {
4617
4617
  return;
4618
4618
  }
4619
4619
  }
4620
- const crosshairButtonRegion = getCrosshairPriceActionRegion(point.x, point.y);
4621
- if (crosshairButtonRegion) {
4622
- crosshairPriceActionHandler?.({
4623
- x: point.x,
4624
- y: point.y,
4625
- price: crosshairButtonRegion.price
4626
- });
4627
- return;
4628
- }
4629
- const orderRegion = getOrderActionRegion(point.x, point.y);
4630
- if (orderRegion) {
4631
- if (orderRegion.draggable) {
4632
- activePointerId = event.pointerId;
4633
- const startPrice = roundToPricePrecision(orderRegion.line.price);
4634
- actionDragState = {
4620
+ const drawingToolCapturesPointer = activeDrawingTool !== null || draftDrawing !== null;
4621
+ if (!drawingToolCapturesPointer) {
4622
+ const crosshairButtonRegion = getCrosshairPriceActionRegion(point.x, point.y);
4623
+ if (crosshairButtonRegion) {
4624
+ crosshairPriceActionHandler?.({
4625
+ x: point.x,
4626
+ y: point.y,
4627
+ price: crosshairButtonRegion.price
4628
+ });
4629
+ return;
4630
+ }
4631
+ const orderRegion = getOrderActionRegion(point.x, point.y);
4632
+ if (orderRegion) {
4633
+ if (orderRegion.draggable) {
4634
+ activePointerId = event.pointerId;
4635
+ const startPrice = roundToPricePrecision(orderRegion.line.price);
4636
+ actionDragState = {
4637
+ orderId: orderRegion.orderId,
4638
+ action: orderRegion.action,
4639
+ startPrice,
4640
+ lastPrice: startPrice,
4641
+ moved: false
4642
+ };
4643
+ canvas.setPointerCapture(event.pointerId);
4644
+ canvas.style.cursor = "ns-resize";
4645
+ setCrosshairPoint(null);
4646
+ return;
4647
+ }
4648
+ setCrosshairPoint(null);
4649
+ orderActionHandler?.({
4635
4650
  orderId: orderRegion.orderId,
4636
4651
  action: orderRegion.action,
4637
- startPrice,
4638
- lastPrice: startPrice,
4639
- moved: false
4652
+ line: orderRegion.line
4653
+ });
4654
+ return;
4655
+ }
4656
+ const orderDragRegion = getOrderDragRegion(point.x, point.y);
4657
+ if (orderDragRegion) {
4658
+ activePointerId = event.pointerId;
4659
+ orderDragState = {
4660
+ orderId: orderDragRegion.orderId,
4661
+ startPrice: orderDragRegion.price,
4662
+ lastPrice: orderDragRegion.price
4640
4663
  };
4641
4664
  canvas.setPointerCapture(event.pointerId);
4642
4665
  canvas.style.cursor = "ns-resize";
4643
4666
  setCrosshairPoint(null);
4644
4667
  return;
4645
4668
  }
4646
- setCrosshairPoint(null);
4647
- orderActionHandler?.({
4648
- orderId: orderRegion.orderId,
4649
- action: orderRegion.action,
4650
- line: orderRegion.line
4651
- });
4652
- return;
4653
- }
4654
- const orderDragRegion = getOrderDragRegion(point.x, point.y);
4655
- if (orderDragRegion) {
4656
- activePointerId = event.pointerId;
4657
- orderDragState = {
4658
- orderId: orderDragRegion.orderId,
4659
- startPrice: orderDragRegion.price,
4660
- lastPrice: orderDragRegion.price
4661
- };
4662
- canvas.setPointerCapture(event.pointerId);
4663
- canvas.style.cursor = "ns-resize";
4664
- setCrosshairPoint(null);
4665
- return;
4666
4669
  }
4667
4670
  const region = getHitRegion(point.x, point.y);
4668
4671
  if (region === "outside") {
@@ -4839,23 +4842,26 @@ function createChart(element, options = {}) {
4839
4842
  return;
4840
4843
  }
4841
4844
  if (!isDragging || !dragMode) {
4842
- const crosshairButtonRegion = getCrosshairPriceActionRegion(point.x, point.y);
4843
- if (crosshairButtonRegion) {
4844
- canvas.style.cursor = "pointer";
4845
- setCrosshairPoint(point);
4846
- return;
4847
- }
4848
- const orderRegion = getOrderActionRegion(point.x, point.y);
4849
- if (orderRegion) {
4850
- canvas.style.cursor = orderRegion.draggable ? "ns-resize" : "pointer";
4851
- setCrosshairPoint(null);
4852
- return;
4853
- }
4854
- const orderDragRegion = getOrderDragRegion(point.x, point.y);
4855
- if (orderDragRegion) {
4856
- canvas.style.cursor = "ns-resize";
4857
- setCrosshairPoint(null);
4858
- return;
4845
+ const drawingToolOwnsHover = activeDrawingTool !== null || draftDrawing !== null;
4846
+ if (!drawingToolOwnsHover) {
4847
+ const crosshairButtonRegion = getCrosshairPriceActionRegion(point.x, point.y);
4848
+ if (crosshairButtonRegion) {
4849
+ canvas.style.cursor = "pointer";
4850
+ setCrosshairPoint(point);
4851
+ return;
4852
+ }
4853
+ const orderRegion = getOrderActionRegion(point.x, point.y);
4854
+ if (orderRegion) {
4855
+ canvas.style.cursor = orderRegion.draggable ? "ns-resize" : "pointer";
4856
+ setCrosshairPoint(null);
4857
+ return;
4858
+ }
4859
+ const orderDragRegion = getOrderDragRegion(point.x, point.y);
4860
+ if (orderDragRegion) {
4861
+ canvas.style.cursor = "ns-resize";
4862
+ setCrosshairPoint(null);
4863
+ return;
4864
+ }
4859
4865
  }
4860
4866
  if (!activeDrawingTool && getDrawingHit(point.x, point.y)) {
4861
4867
  const drawingHit = getDrawingHit(point.x, point.y);
@@ -4591,52 +4591,55 @@ function createChart(element, options = {}) {
4591
4591
  return;
4592
4592
  }
4593
4593
  }
4594
- const crosshairButtonRegion = getCrosshairPriceActionRegion(point.x, point.y);
4595
- if (crosshairButtonRegion) {
4596
- crosshairPriceActionHandler?.({
4597
- x: point.x,
4598
- y: point.y,
4599
- price: crosshairButtonRegion.price
4600
- });
4601
- return;
4602
- }
4603
- const orderRegion = getOrderActionRegion(point.x, point.y);
4604
- if (orderRegion) {
4605
- if (orderRegion.draggable) {
4606
- activePointerId = event.pointerId;
4607
- const startPrice = roundToPricePrecision(orderRegion.line.price);
4608
- actionDragState = {
4594
+ const drawingToolCapturesPointer = activeDrawingTool !== null || draftDrawing !== null;
4595
+ if (!drawingToolCapturesPointer) {
4596
+ const crosshairButtonRegion = getCrosshairPriceActionRegion(point.x, point.y);
4597
+ if (crosshairButtonRegion) {
4598
+ crosshairPriceActionHandler?.({
4599
+ x: point.x,
4600
+ y: point.y,
4601
+ price: crosshairButtonRegion.price
4602
+ });
4603
+ return;
4604
+ }
4605
+ const orderRegion = getOrderActionRegion(point.x, point.y);
4606
+ if (orderRegion) {
4607
+ if (orderRegion.draggable) {
4608
+ activePointerId = event.pointerId;
4609
+ const startPrice = roundToPricePrecision(orderRegion.line.price);
4610
+ actionDragState = {
4611
+ orderId: orderRegion.orderId,
4612
+ action: orderRegion.action,
4613
+ startPrice,
4614
+ lastPrice: startPrice,
4615
+ moved: false
4616
+ };
4617
+ canvas.setPointerCapture(event.pointerId);
4618
+ canvas.style.cursor = "ns-resize";
4619
+ setCrosshairPoint(null);
4620
+ return;
4621
+ }
4622
+ setCrosshairPoint(null);
4623
+ orderActionHandler?.({
4609
4624
  orderId: orderRegion.orderId,
4610
4625
  action: orderRegion.action,
4611
- startPrice,
4612
- lastPrice: startPrice,
4613
- moved: false
4626
+ line: orderRegion.line
4627
+ });
4628
+ return;
4629
+ }
4630
+ const orderDragRegion = getOrderDragRegion(point.x, point.y);
4631
+ if (orderDragRegion) {
4632
+ activePointerId = event.pointerId;
4633
+ orderDragState = {
4634
+ orderId: orderDragRegion.orderId,
4635
+ startPrice: orderDragRegion.price,
4636
+ lastPrice: orderDragRegion.price
4614
4637
  };
4615
4638
  canvas.setPointerCapture(event.pointerId);
4616
4639
  canvas.style.cursor = "ns-resize";
4617
4640
  setCrosshairPoint(null);
4618
4641
  return;
4619
4642
  }
4620
- setCrosshairPoint(null);
4621
- orderActionHandler?.({
4622
- orderId: orderRegion.orderId,
4623
- action: orderRegion.action,
4624
- line: orderRegion.line
4625
- });
4626
- return;
4627
- }
4628
- const orderDragRegion = getOrderDragRegion(point.x, point.y);
4629
- if (orderDragRegion) {
4630
- activePointerId = event.pointerId;
4631
- orderDragState = {
4632
- orderId: orderDragRegion.orderId,
4633
- startPrice: orderDragRegion.price,
4634
- lastPrice: orderDragRegion.price
4635
- };
4636
- canvas.setPointerCapture(event.pointerId);
4637
- canvas.style.cursor = "ns-resize";
4638
- setCrosshairPoint(null);
4639
- return;
4640
4643
  }
4641
4644
  const region = getHitRegion(point.x, point.y);
4642
4645
  if (region === "outside") {
@@ -4813,23 +4816,26 @@ function createChart(element, options = {}) {
4813
4816
  return;
4814
4817
  }
4815
4818
  if (!isDragging || !dragMode) {
4816
- const crosshairButtonRegion = getCrosshairPriceActionRegion(point.x, point.y);
4817
- if (crosshairButtonRegion) {
4818
- canvas.style.cursor = "pointer";
4819
- setCrosshairPoint(point);
4820
- return;
4821
- }
4822
- const orderRegion = getOrderActionRegion(point.x, point.y);
4823
- if (orderRegion) {
4824
- canvas.style.cursor = orderRegion.draggable ? "ns-resize" : "pointer";
4825
- setCrosshairPoint(null);
4826
- return;
4827
- }
4828
- const orderDragRegion = getOrderDragRegion(point.x, point.y);
4829
- if (orderDragRegion) {
4830
- canvas.style.cursor = "ns-resize";
4831
- setCrosshairPoint(null);
4832
- return;
4819
+ const drawingToolOwnsHover = activeDrawingTool !== null || draftDrawing !== null;
4820
+ if (!drawingToolOwnsHover) {
4821
+ const crosshairButtonRegion = getCrosshairPriceActionRegion(point.x, point.y);
4822
+ if (crosshairButtonRegion) {
4823
+ canvas.style.cursor = "pointer";
4824
+ setCrosshairPoint(point);
4825
+ return;
4826
+ }
4827
+ const orderRegion = getOrderActionRegion(point.x, point.y);
4828
+ if (orderRegion) {
4829
+ canvas.style.cursor = orderRegion.draggable ? "ns-resize" : "pointer";
4830
+ setCrosshairPoint(null);
4831
+ return;
4832
+ }
4833
+ const orderDragRegion = getOrderDragRegion(point.x, point.y);
4834
+ if (orderDragRegion) {
4835
+ canvas.style.cursor = "ns-resize";
4836
+ setCrosshairPoint(null);
4837
+ return;
4838
+ }
4833
4839
  }
4834
4840
  if (!activeDrawingTool && getDrawingHit(point.x, point.y)) {
4835
4841
  const drawingHit = getDrawingHit(point.x, point.y);
package/dist/index.cjs CHANGED
@@ -4617,52 +4617,55 @@ function createChart(element, options = {}) {
4617
4617
  return;
4618
4618
  }
4619
4619
  }
4620
- const crosshairButtonRegion = getCrosshairPriceActionRegion(point.x, point.y);
4621
- if (crosshairButtonRegion) {
4622
- crosshairPriceActionHandler?.({
4623
- x: point.x,
4624
- y: point.y,
4625
- price: crosshairButtonRegion.price
4626
- });
4627
- return;
4628
- }
4629
- const orderRegion = getOrderActionRegion(point.x, point.y);
4630
- if (orderRegion) {
4631
- if (orderRegion.draggable) {
4632
- activePointerId = event.pointerId;
4633
- const startPrice = roundToPricePrecision(orderRegion.line.price);
4634
- actionDragState = {
4620
+ const drawingToolCapturesPointer = activeDrawingTool !== null || draftDrawing !== null;
4621
+ if (!drawingToolCapturesPointer) {
4622
+ const crosshairButtonRegion = getCrosshairPriceActionRegion(point.x, point.y);
4623
+ if (crosshairButtonRegion) {
4624
+ crosshairPriceActionHandler?.({
4625
+ x: point.x,
4626
+ y: point.y,
4627
+ price: crosshairButtonRegion.price
4628
+ });
4629
+ return;
4630
+ }
4631
+ const orderRegion = getOrderActionRegion(point.x, point.y);
4632
+ if (orderRegion) {
4633
+ if (orderRegion.draggable) {
4634
+ activePointerId = event.pointerId;
4635
+ const startPrice = roundToPricePrecision(orderRegion.line.price);
4636
+ actionDragState = {
4637
+ orderId: orderRegion.orderId,
4638
+ action: orderRegion.action,
4639
+ startPrice,
4640
+ lastPrice: startPrice,
4641
+ moved: false
4642
+ };
4643
+ canvas.setPointerCapture(event.pointerId);
4644
+ canvas.style.cursor = "ns-resize";
4645
+ setCrosshairPoint(null);
4646
+ return;
4647
+ }
4648
+ setCrosshairPoint(null);
4649
+ orderActionHandler?.({
4635
4650
  orderId: orderRegion.orderId,
4636
4651
  action: orderRegion.action,
4637
- startPrice,
4638
- lastPrice: startPrice,
4639
- moved: false
4652
+ line: orderRegion.line
4653
+ });
4654
+ return;
4655
+ }
4656
+ const orderDragRegion = getOrderDragRegion(point.x, point.y);
4657
+ if (orderDragRegion) {
4658
+ activePointerId = event.pointerId;
4659
+ orderDragState = {
4660
+ orderId: orderDragRegion.orderId,
4661
+ startPrice: orderDragRegion.price,
4662
+ lastPrice: orderDragRegion.price
4640
4663
  };
4641
4664
  canvas.setPointerCapture(event.pointerId);
4642
4665
  canvas.style.cursor = "ns-resize";
4643
4666
  setCrosshairPoint(null);
4644
4667
  return;
4645
4668
  }
4646
- setCrosshairPoint(null);
4647
- orderActionHandler?.({
4648
- orderId: orderRegion.orderId,
4649
- action: orderRegion.action,
4650
- line: orderRegion.line
4651
- });
4652
- return;
4653
- }
4654
- const orderDragRegion = getOrderDragRegion(point.x, point.y);
4655
- if (orderDragRegion) {
4656
- activePointerId = event.pointerId;
4657
- orderDragState = {
4658
- orderId: orderDragRegion.orderId,
4659
- startPrice: orderDragRegion.price,
4660
- lastPrice: orderDragRegion.price
4661
- };
4662
- canvas.setPointerCapture(event.pointerId);
4663
- canvas.style.cursor = "ns-resize";
4664
- setCrosshairPoint(null);
4665
- return;
4666
4669
  }
4667
4670
  const region = getHitRegion(point.x, point.y);
4668
4671
  if (region === "outside") {
@@ -4839,23 +4842,26 @@ function createChart(element, options = {}) {
4839
4842
  return;
4840
4843
  }
4841
4844
  if (!isDragging || !dragMode) {
4842
- const crosshairButtonRegion = getCrosshairPriceActionRegion(point.x, point.y);
4843
- if (crosshairButtonRegion) {
4844
- canvas.style.cursor = "pointer";
4845
- setCrosshairPoint(point);
4846
- return;
4847
- }
4848
- const orderRegion = getOrderActionRegion(point.x, point.y);
4849
- if (orderRegion) {
4850
- canvas.style.cursor = orderRegion.draggable ? "ns-resize" : "pointer";
4851
- setCrosshairPoint(null);
4852
- return;
4853
- }
4854
- const orderDragRegion = getOrderDragRegion(point.x, point.y);
4855
- if (orderDragRegion) {
4856
- canvas.style.cursor = "ns-resize";
4857
- setCrosshairPoint(null);
4858
- return;
4845
+ const drawingToolOwnsHover = activeDrawingTool !== null || draftDrawing !== null;
4846
+ if (!drawingToolOwnsHover) {
4847
+ const crosshairButtonRegion = getCrosshairPriceActionRegion(point.x, point.y);
4848
+ if (crosshairButtonRegion) {
4849
+ canvas.style.cursor = "pointer";
4850
+ setCrosshairPoint(point);
4851
+ return;
4852
+ }
4853
+ const orderRegion = getOrderActionRegion(point.x, point.y);
4854
+ if (orderRegion) {
4855
+ canvas.style.cursor = orderRegion.draggable ? "ns-resize" : "pointer";
4856
+ setCrosshairPoint(null);
4857
+ return;
4858
+ }
4859
+ const orderDragRegion = getOrderDragRegion(point.x, point.y);
4860
+ if (orderDragRegion) {
4861
+ canvas.style.cursor = "ns-resize";
4862
+ setCrosshairPoint(null);
4863
+ return;
4864
+ }
4859
4865
  }
4860
4866
  if (!activeDrawingTool && getDrawingHit(point.x, point.y)) {
4861
4867
  const drawingHit = getDrawingHit(point.x, point.y);
package/dist/index.js CHANGED
@@ -4591,52 +4591,55 @@ function createChart(element, options = {}) {
4591
4591
  return;
4592
4592
  }
4593
4593
  }
4594
- const crosshairButtonRegion = getCrosshairPriceActionRegion(point.x, point.y);
4595
- if (crosshairButtonRegion) {
4596
- crosshairPriceActionHandler?.({
4597
- x: point.x,
4598
- y: point.y,
4599
- price: crosshairButtonRegion.price
4600
- });
4601
- return;
4602
- }
4603
- const orderRegion = getOrderActionRegion(point.x, point.y);
4604
- if (orderRegion) {
4605
- if (orderRegion.draggable) {
4606
- activePointerId = event.pointerId;
4607
- const startPrice = roundToPricePrecision(orderRegion.line.price);
4608
- actionDragState = {
4594
+ const drawingToolCapturesPointer = activeDrawingTool !== null || draftDrawing !== null;
4595
+ if (!drawingToolCapturesPointer) {
4596
+ const crosshairButtonRegion = getCrosshairPriceActionRegion(point.x, point.y);
4597
+ if (crosshairButtonRegion) {
4598
+ crosshairPriceActionHandler?.({
4599
+ x: point.x,
4600
+ y: point.y,
4601
+ price: crosshairButtonRegion.price
4602
+ });
4603
+ return;
4604
+ }
4605
+ const orderRegion = getOrderActionRegion(point.x, point.y);
4606
+ if (orderRegion) {
4607
+ if (orderRegion.draggable) {
4608
+ activePointerId = event.pointerId;
4609
+ const startPrice = roundToPricePrecision(orderRegion.line.price);
4610
+ actionDragState = {
4611
+ orderId: orderRegion.orderId,
4612
+ action: orderRegion.action,
4613
+ startPrice,
4614
+ lastPrice: startPrice,
4615
+ moved: false
4616
+ };
4617
+ canvas.setPointerCapture(event.pointerId);
4618
+ canvas.style.cursor = "ns-resize";
4619
+ setCrosshairPoint(null);
4620
+ return;
4621
+ }
4622
+ setCrosshairPoint(null);
4623
+ orderActionHandler?.({
4609
4624
  orderId: orderRegion.orderId,
4610
4625
  action: orderRegion.action,
4611
- startPrice,
4612
- lastPrice: startPrice,
4613
- moved: false
4626
+ line: orderRegion.line
4627
+ });
4628
+ return;
4629
+ }
4630
+ const orderDragRegion = getOrderDragRegion(point.x, point.y);
4631
+ if (orderDragRegion) {
4632
+ activePointerId = event.pointerId;
4633
+ orderDragState = {
4634
+ orderId: orderDragRegion.orderId,
4635
+ startPrice: orderDragRegion.price,
4636
+ lastPrice: orderDragRegion.price
4614
4637
  };
4615
4638
  canvas.setPointerCapture(event.pointerId);
4616
4639
  canvas.style.cursor = "ns-resize";
4617
4640
  setCrosshairPoint(null);
4618
4641
  return;
4619
4642
  }
4620
- setCrosshairPoint(null);
4621
- orderActionHandler?.({
4622
- orderId: orderRegion.orderId,
4623
- action: orderRegion.action,
4624
- line: orderRegion.line
4625
- });
4626
- return;
4627
- }
4628
- const orderDragRegion = getOrderDragRegion(point.x, point.y);
4629
- if (orderDragRegion) {
4630
- activePointerId = event.pointerId;
4631
- orderDragState = {
4632
- orderId: orderDragRegion.orderId,
4633
- startPrice: orderDragRegion.price,
4634
- lastPrice: orderDragRegion.price
4635
- };
4636
- canvas.setPointerCapture(event.pointerId);
4637
- canvas.style.cursor = "ns-resize";
4638
- setCrosshairPoint(null);
4639
- return;
4640
4643
  }
4641
4644
  const region = getHitRegion(point.x, point.y);
4642
4645
  if (region === "outside") {
@@ -4813,23 +4816,26 @@ function createChart(element, options = {}) {
4813
4816
  return;
4814
4817
  }
4815
4818
  if (!isDragging || !dragMode) {
4816
- const crosshairButtonRegion = getCrosshairPriceActionRegion(point.x, point.y);
4817
- if (crosshairButtonRegion) {
4818
- canvas.style.cursor = "pointer";
4819
- setCrosshairPoint(point);
4820
- return;
4821
- }
4822
- const orderRegion = getOrderActionRegion(point.x, point.y);
4823
- if (orderRegion) {
4824
- canvas.style.cursor = orderRegion.draggable ? "ns-resize" : "pointer";
4825
- setCrosshairPoint(null);
4826
- return;
4827
- }
4828
- const orderDragRegion = getOrderDragRegion(point.x, point.y);
4829
- if (orderDragRegion) {
4830
- canvas.style.cursor = "ns-resize";
4831
- setCrosshairPoint(null);
4832
- return;
4819
+ const drawingToolOwnsHover = activeDrawingTool !== null || draftDrawing !== null;
4820
+ if (!drawingToolOwnsHover) {
4821
+ const crosshairButtonRegion = getCrosshairPriceActionRegion(point.x, point.y);
4822
+ if (crosshairButtonRegion) {
4823
+ canvas.style.cursor = "pointer";
4824
+ setCrosshairPoint(point);
4825
+ return;
4826
+ }
4827
+ const orderRegion = getOrderActionRegion(point.x, point.y);
4828
+ if (orderRegion) {
4829
+ canvas.style.cursor = orderRegion.draggable ? "ns-resize" : "pointer";
4830
+ setCrosshairPoint(null);
4831
+ return;
4832
+ }
4833
+ const orderDragRegion = getOrderDragRegion(point.x, point.y);
4834
+ if (orderDragRegion) {
4835
+ canvas.style.cursor = "ns-resize";
4836
+ setCrosshairPoint(null);
4837
+ return;
4838
+ }
4833
4839
  }
4834
4840
  if (!activeDrawingTool && getDrawingHit(point.x, point.y)) {
4835
4841
  const drawingHit = getDrawingHit(point.x, point.y);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hyperprop-charting-library",
3
- "version": "0.1.110",
3
+ "version": "0.1.111",
4
4
  "description": "Lightweight TypeScript charting core",
5
5
  "type": "module",
6
6
  "main": "./dist/hyperprop-charting-library.cjs",