hyperprop-charting-library 0.1.64 → 0.1.65
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.
- package/dist/hyperprop-charting-library.cjs +11 -1
- package/dist/hyperprop-charting-library.js +11 -1
- package/dist/index.cjs +11 -1
- package/dist/index.js +11 -1
- package/package.json +1 -1
|
@@ -3522,10 +3522,15 @@ function createChart(element, options = {}) {
|
|
|
3522
3522
|
}
|
|
3523
3523
|
const midpoint = getMidpoint(first, second);
|
|
3524
3524
|
const anchorRatio = clamp((midpoint.x - drawState.chartLeft) / drawState.chartWidth, 0, 1);
|
|
3525
|
+
const startYMin = yMinOverride ?? drawState.yMin;
|
|
3526
|
+
const startYMax = yMaxOverride ?? drawState.yMax;
|
|
3525
3527
|
pinchZoomState = {
|
|
3526
3528
|
startDistance: Math.max(1, getPointerDistance(first, second)),
|
|
3527
3529
|
startSpan: xSpan,
|
|
3528
|
-
anchorIndex: drawState.xStart + anchorRatio * xSpan
|
|
3530
|
+
anchorIndex: drawState.xStart + anchorRatio * xSpan,
|
|
3531
|
+
startMidpoint: midpoint,
|
|
3532
|
+
startYMin,
|
|
3533
|
+
startYMax
|
|
3529
3534
|
};
|
|
3530
3535
|
isDragging = false;
|
|
3531
3536
|
dragMode = null;
|
|
@@ -3554,6 +3559,11 @@ function createChart(element, options = {}) {
|
|
|
3554
3559
|
xSpan = nextSpan;
|
|
3555
3560
|
xCenter = nextStart + nextSpan / 2;
|
|
3556
3561
|
clampXViewport();
|
|
3562
|
+
const startYRange = pinchZoomState.startYMax - pinchZoomState.startYMin || 1;
|
|
3563
|
+
const priceShift = (midpoint.y - pinchZoomState.startMidpoint.y) / drawState.chartHeight * startYRange;
|
|
3564
|
+
const clampedY = clampYRange(pinchZoomState.startYMin + priceShift, pinchZoomState.startYMax + priceShift);
|
|
3565
|
+
yMinOverride = clampedY.min;
|
|
3566
|
+
yMaxOverride = clampedY.max;
|
|
3557
3567
|
updateFollowLatest(false);
|
|
3558
3568
|
emitViewportChange();
|
|
3559
3569
|
draw();
|
|
@@ -3498,10 +3498,15 @@ function createChart(element, options = {}) {
|
|
|
3498
3498
|
}
|
|
3499
3499
|
const midpoint = getMidpoint(first, second);
|
|
3500
3500
|
const anchorRatio = clamp((midpoint.x - drawState.chartLeft) / drawState.chartWidth, 0, 1);
|
|
3501
|
+
const startYMin = yMinOverride ?? drawState.yMin;
|
|
3502
|
+
const startYMax = yMaxOverride ?? drawState.yMax;
|
|
3501
3503
|
pinchZoomState = {
|
|
3502
3504
|
startDistance: Math.max(1, getPointerDistance(first, second)),
|
|
3503
3505
|
startSpan: xSpan,
|
|
3504
|
-
anchorIndex: drawState.xStart + anchorRatio * xSpan
|
|
3506
|
+
anchorIndex: drawState.xStart + anchorRatio * xSpan,
|
|
3507
|
+
startMidpoint: midpoint,
|
|
3508
|
+
startYMin,
|
|
3509
|
+
startYMax
|
|
3505
3510
|
};
|
|
3506
3511
|
isDragging = false;
|
|
3507
3512
|
dragMode = null;
|
|
@@ -3530,6 +3535,11 @@ function createChart(element, options = {}) {
|
|
|
3530
3535
|
xSpan = nextSpan;
|
|
3531
3536
|
xCenter = nextStart + nextSpan / 2;
|
|
3532
3537
|
clampXViewport();
|
|
3538
|
+
const startYRange = pinchZoomState.startYMax - pinchZoomState.startYMin || 1;
|
|
3539
|
+
const priceShift = (midpoint.y - pinchZoomState.startMidpoint.y) / drawState.chartHeight * startYRange;
|
|
3540
|
+
const clampedY = clampYRange(pinchZoomState.startYMin + priceShift, pinchZoomState.startYMax + priceShift);
|
|
3541
|
+
yMinOverride = clampedY.min;
|
|
3542
|
+
yMaxOverride = clampedY.max;
|
|
3533
3543
|
updateFollowLatest(false);
|
|
3534
3544
|
emitViewportChange();
|
|
3535
3545
|
draw();
|
package/dist/index.cjs
CHANGED
|
@@ -3522,10 +3522,15 @@ function createChart(element, options = {}) {
|
|
|
3522
3522
|
}
|
|
3523
3523
|
const midpoint = getMidpoint(first, second);
|
|
3524
3524
|
const anchorRatio = clamp((midpoint.x - drawState.chartLeft) / drawState.chartWidth, 0, 1);
|
|
3525
|
+
const startYMin = yMinOverride ?? drawState.yMin;
|
|
3526
|
+
const startYMax = yMaxOverride ?? drawState.yMax;
|
|
3525
3527
|
pinchZoomState = {
|
|
3526
3528
|
startDistance: Math.max(1, getPointerDistance(first, second)),
|
|
3527
3529
|
startSpan: xSpan,
|
|
3528
|
-
anchorIndex: drawState.xStart + anchorRatio * xSpan
|
|
3530
|
+
anchorIndex: drawState.xStart + anchorRatio * xSpan,
|
|
3531
|
+
startMidpoint: midpoint,
|
|
3532
|
+
startYMin,
|
|
3533
|
+
startYMax
|
|
3529
3534
|
};
|
|
3530
3535
|
isDragging = false;
|
|
3531
3536
|
dragMode = null;
|
|
@@ -3554,6 +3559,11 @@ function createChart(element, options = {}) {
|
|
|
3554
3559
|
xSpan = nextSpan;
|
|
3555
3560
|
xCenter = nextStart + nextSpan / 2;
|
|
3556
3561
|
clampXViewport();
|
|
3562
|
+
const startYRange = pinchZoomState.startYMax - pinchZoomState.startYMin || 1;
|
|
3563
|
+
const priceShift = (midpoint.y - pinchZoomState.startMidpoint.y) / drawState.chartHeight * startYRange;
|
|
3564
|
+
const clampedY = clampYRange(pinchZoomState.startYMin + priceShift, pinchZoomState.startYMax + priceShift);
|
|
3565
|
+
yMinOverride = clampedY.min;
|
|
3566
|
+
yMaxOverride = clampedY.max;
|
|
3557
3567
|
updateFollowLatest(false);
|
|
3558
3568
|
emitViewportChange();
|
|
3559
3569
|
draw();
|
package/dist/index.js
CHANGED
|
@@ -3498,10 +3498,15 @@ function createChart(element, options = {}) {
|
|
|
3498
3498
|
}
|
|
3499
3499
|
const midpoint = getMidpoint(first, second);
|
|
3500
3500
|
const anchorRatio = clamp((midpoint.x - drawState.chartLeft) / drawState.chartWidth, 0, 1);
|
|
3501
|
+
const startYMin = yMinOverride ?? drawState.yMin;
|
|
3502
|
+
const startYMax = yMaxOverride ?? drawState.yMax;
|
|
3501
3503
|
pinchZoomState = {
|
|
3502
3504
|
startDistance: Math.max(1, getPointerDistance(first, second)),
|
|
3503
3505
|
startSpan: xSpan,
|
|
3504
|
-
anchorIndex: drawState.xStart + anchorRatio * xSpan
|
|
3506
|
+
anchorIndex: drawState.xStart + anchorRatio * xSpan,
|
|
3507
|
+
startMidpoint: midpoint,
|
|
3508
|
+
startYMin,
|
|
3509
|
+
startYMax
|
|
3505
3510
|
};
|
|
3506
3511
|
isDragging = false;
|
|
3507
3512
|
dragMode = null;
|
|
@@ -3530,6 +3535,11 @@ function createChart(element, options = {}) {
|
|
|
3530
3535
|
xSpan = nextSpan;
|
|
3531
3536
|
xCenter = nextStart + nextSpan / 2;
|
|
3532
3537
|
clampXViewport();
|
|
3538
|
+
const startYRange = pinchZoomState.startYMax - pinchZoomState.startYMin || 1;
|
|
3539
|
+
const priceShift = (midpoint.y - pinchZoomState.startMidpoint.y) / drawState.chartHeight * startYRange;
|
|
3540
|
+
const clampedY = clampYRange(pinchZoomState.startYMin + priceShift, pinchZoomState.startYMax + priceShift);
|
|
3541
|
+
yMinOverride = clampedY.min;
|
|
3542
|
+
yMaxOverride = clampedY.max;
|
|
3533
3543
|
updateFollowLatest(false);
|
|
3534
3544
|
emitViewportChange();
|
|
3535
3545
|
draw();
|