@spider-analyzer/timeline 5.0.4 → 5.0.6
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/CHANGELOG.md +29 -0
- package/dist/index.js +9 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/TimeLine.tsx +29 -8
package/dist/index.mjs
CHANGED
|
@@ -2071,13 +2071,15 @@ var TimeLineInner = forwardRef(function TimeLine(props, ref) {
|
|
|
2071
2071
|
const xAxis = scaleTime().domain([domain2.min, domain2.max]).range([0, histoWidth2]);
|
|
2072
2072
|
xAxis.clamp(true);
|
|
2073
2073
|
xAxisRef.current = xAxis;
|
|
2074
|
-
const
|
|
2074
|
+
const tickCount = floor(histoWidth2 / p.xAxis.spaceBetweenTicks);
|
|
2075
|
+
const ticks2 = xAxis.ticks(tickCount);
|
|
2076
|
+
const tickIntervalMs = ticks2.length >= 2 ? ticks2[1].getTime() - ticks2[0].getTime() : (+domain2.max - +domain2.min) / Math.max(tickCount, 1);
|
|
2075
2077
|
const intervalMs = max([
|
|
2076
|
-
round(
|
|
2078
|
+
round(tickIntervalMs / p.xAxis.barsBetweenTicks),
|
|
2077
2079
|
propsRef.current.smallestResolution.asMilliseconds()
|
|
2078
2080
|
]);
|
|
2079
2081
|
patchState({ histoWidth: histoWidth2, isActive: true, ticks: ticks2 });
|
|
2080
|
-
if (shouldReload && intervalMs) {
|
|
2082
|
+
if (shouldReload && intervalMs && histoWidth2 > 0) {
|
|
2081
2083
|
widthOfLastUpdateRef.current = p.width;
|
|
2082
2084
|
patchState({ waitForLoad: true });
|
|
2083
2085
|
p.onLoadHisto(intervalMs, domain2.min, domain2.max);
|
|
@@ -2107,12 +2109,11 @@ var TimeLineInner = forwardRef(function TimeLine(props, ref) {
|
|
|
2107
2109
|
return;
|
|
2108
2110
|
}
|
|
2109
2111
|
const s = stateRef.current;
|
|
2110
|
-
|
|
2112
|
+
patchState(computeMarginAndWidth(props));
|
|
2113
|
+
if (s.domain) {
|
|
2111
2114
|
const big = widthOfLastUpdateRef.current !== null && Math.abs((props.width ?? 0) - (widthOfLastUpdateRef.current ?? 0)) > 30;
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
} else {
|
|
2115
|
-
patchState(computeMarginAndWidth(props));
|
|
2115
|
+
const shouldReload = !s.isActive || big || widthOfLastUpdateRef.current === null;
|
|
2116
|
+
getItems(props, s.domain, shouldReload);
|
|
2116
2117
|
}
|
|
2117
2118
|
if (stateRef.current.domain) {
|
|
2118
2119
|
const res = checkAndCorrectDomain({ domain: stateRef.current.domain });
|