hyperprop-charting-library 0.1.112 → 0.1.113
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.
|
@@ -1035,6 +1035,7 @@ function createChart(element, options = {}) {
|
|
|
1035
1035
|
let magnetModifierActive = false;
|
|
1036
1036
|
let shiftKeyActive = false;
|
|
1037
1037
|
const MAGNET_WEAK_THRESHOLD_PX = 16;
|
|
1038
|
+
const MAGNET_STRONG_THRESHOLD_PX = 48;
|
|
1038
1039
|
let drawingHoverHandler = null;
|
|
1039
1040
|
let lastHoveredDrawingId = null;
|
|
1040
1041
|
let selectedDrawingId = null;
|
|
@@ -3942,7 +3943,8 @@ function createChart(element, options = {}) {
|
|
|
3942
3943
|
nearest = candidate;
|
|
3943
3944
|
}
|
|
3944
3945
|
}
|
|
3945
|
-
|
|
3946
|
+
const snapThresholdPx = effective === "weak" ? MAGNET_WEAK_THRESHOLD_PX : MAGNET_STRONG_THRESHOLD_PX;
|
|
3947
|
+
if (Math.abs(canvasYFromDrawingPrice(nearest) - y) > snapThresholdPx) {
|
|
3946
3948
|
return { index, price };
|
|
3947
3949
|
}
|
|
3948
3950
|
return { index: barIndex, price: nearest };
|
|
@@ -1009,6 +1009,7 @@ function createChart(element, options = {}) {
|
|
|
1009
1009
|
let magnetModifierActive = false;
|
|
1010
1010
|
let shiftKeyActive = false;
|
|
1011
1011
|
const MAGNET_WEAK_THRESHOLD_PX = 16;
|
|
1012
|
+
const MAGNET_STRONG_THRESHOLD_PX = 48;
|
|
1012
1013
|
let drawingHoverHandler = null;
|
|
1013
1014
|
let lastHoveredDrawingId = null;
|
|
1014
1015
|
let selectedDrawingId = null;
|
|
@@ -3916,7 +3917,8 @@ function createChart(element, options = {}) {
|
|
|
3916
3917
|
nearest = candidate;
|
|
3917
3918
|
}
|
|
3918
3919
|
}
|
|
3919
|
-
|
|
3920
|
+
const snapThresholdPx = effective === "weak" ? MAGNET_WEAK_THRESHOLD_PX : MAGNET_STRONG_THRESHOLD_PX;
|
|
3921
|
+
if (Math.abs(canvasYFromDrawingPrice(nearest) - y) > snapThresholdPx) {
|
|
3920
3922
|
return { index, price };
|
|
3921
3923
|
}
|
|
3922
3924
|
return { index: barIndex, price: nearest };
|
package/dist/index.cjs
CHANGED
|
@@ -1035,6 +1035,7 @@ function createChart(element, options = {}) {
|
|
|
1035
1035
|
let magnetModifierActive = false;
|
|
1036
1036
|
let shiftKeyActive = false;
|
|
1037
1037
|
const MAGNET_WEAK_THRESHOLD_PX = 16;
|
|
1038
|
+
const MAGNET_STRONG_THRESHOLD_PX = 48;
|
|
1038
1039
|
let drawingHoverHandler = null;
|
|
1039
1040
|
let lastHoveredDrawingId = null;
|
|
1040
1041
|
let selectedDrawingId = null;
|
|
@@ -3942,7 +3943,8 @@ function createChart(element, options = {}) {
|
|
|
3942
3943
|
nearest = candidate;
|
|
3943
3944
|
}
|
|
3944
3945
|
}
|
|
3945
|
-
|
|
3946
|
+
const snapThresholdPx = effective === "weak" ? MAGNET_WEAK_THRESHOLD_PX : MAGNET_STRONG_THRESHOLD_PX;
|
|
3947
|
+
if (Math.abs(canvasYFromDrawingPrice(nearest) - y) > snapThresholdPx) {
|
|
3946
3948
|
return { index, price };
|
|
3947
3949
|
}
|
|
3948
3950
|
return { index: barIndex, price: nearest };
|
package/dist/index.js
CHANGED
|
@@ -1009,6 +1009,7 @@ function createChart(element, options = {}) {
|
|
|
1009
1009
|
let magnetModifierActive = false;
|
|
1010
1010
|
let shiftKeyActive = false;
|
|
1011
1011
|
const MAGNET_WEAK_THRESHOLD_PX = 16;
|
|
1012
|
+
const MAGNET_STRONG_THRESHOLD_PX = 48;
|
|
1012
1013
|
let drawingHoverHandler = null;
|
|
1013
1014
|
let lastHoveredDrawingId = null;
|
|
1014
1015
|
let selectedDrawingId = null;
|
|
@@ -3916,7 +3917,8 @@ function createChart(element, options = {}) {
|
|
|
3916
3917
|
nearest = candidate;
|
|
3917
3918
|
}
|
|
3918
3919
|
}
|
|
3919
|
-
|
|
3920
|
+
const snapThresholdPx = effective === "weak" ? MAGNET_WEAK_THRESHOLD_PX : MAGNET_STRONG_THRESHOLD_PX;
|
|
3921
|
+
if (Math.abs(canvasYFromDrawingPrice(nearest) - y) > snapThresholdPx) {
|
|
3920
3922
|
return { index, price };
|
|
3921
3923
|
}
|
|
3922
3924
|
return { index: barIndex, price: nearest };
|