awesome-timeline-react 0.4.1 → 0.4.2

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/index.js CHANGED
@@ -2862,6 +2862,37 @@ var Timeline = (0, import_react7.forwardRef)(
2862
2862
  );
2863
2863
  }
2864
2864
  }, []);
2865
+ const fitStart = new Date(
2866
+ startDate.getFullYear(),
2867
+ startDate.getMonth(),
2868
+ startDate.getDate(),
2869
+ startDate.getHours(),
2870
+ 0,
2871
+ 0
2872
+ ).getTime() / 1e3;
2873
+ const fitEnd = new Date(
2874
+ endDate.getFullYear(),
2875
+ endDate.getMonth(),
2876
+ endDate.getDate(),
2877
+ endDate.getHours(),
2878
+ 0,
2879
+ 0
2880
+ ).getTime() / 1e3;
2881
+ const lastFitRef = (0, import_react7.useRef)([fitStart, fitEnd]);
2882
+ (0, import_react7.useEffect)(() => {
2883
+ var _a;
2884
+ if (lastFitRef.current[0] === fitStart && lastFitRef.current[1] === fitEnd) {
2885
+ return;
2886
+ }
2887
+ lastFitRef.current = [fitStart, fitEnd];
2888
+ setWindowTime([fitStart, fitEnd]);
2889
+ const width = (_a = contentRef.current) == null ? void 0 : _a.getBoundingClientRect().width;
2890
+ if (width) {
2891
+ const windowDuration = fitEnd - fitStart;
2892
+ setTick(windowDuration / width);
2893
+ setCellWidth(width / (windowDuration / 3600));
2894
+ }
2895
+ }, [fitStart, fitEnd]);
2865
2896
  (0, import_react7.useEffect)(() => {
2866
2897
  if (bodyRef.current) {
2867
2898
  setScrollWidth(