awesome-timeline-react 0.4.1 → 0.4.3
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 +42 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +42 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -788,7 +788,7 @@ var HANDLE_BAR_WIDTH = 3;
|
|
|
788
788
|
var HANDLE_BAR_GAP = 1;
|
|
789
789
|
var HANDLE_BAR_HEIGHT = 10;
|
|
790
790
|
var roundedRect = (ctx, x, y, width, height, radius) => {
|
|
791
|
-
const r = Math.min(radius, width / 2, height / 2);
|
|
791
|
+
const r = Math.max(0, Math.min(radius, width / 2, height / 2));
|
|
792
792
|
ctx.beginPath();
|
|
793
793
|
if (typeof ctx.roundRect === "function") {
|
|
794
794
|
ctx.roundRect(x, y, width, height, r);
|
|
@@ -959,6 +959,7 @@ var drawEvents = (ctx, view, scene, font, animator) => {
|
|
|
959
959
|
const paintEvent = (event, rect, state, opts) => {
|
|
960
960
|
var _a2, _b, _c, _d, _e;
|
|
961
961
|
ctx.save();
|
|
962
|
+
ctx.globalAlpha = 1;
|
|
962
963
|
if (opts.elevate) {
|
|
963
964
|
ctx.translate(0, -view.theme.selectionElevation);
|
|
964
965
|
ctx.shadowColor = view.theme.selectionShadowColor;
|
|
@@ -2789,9 +2790,17 @@ var Timeline = forwardRef3(
|
|
|
2789
2790
|
(_a = rendererRef.current) == null ? void 0 : _a.animator.reset();
|
|
2790
2791
|
}, [scene, rows]);
|
|
2791
2792
|
useEffect6(() => {
|
|
2792
|
-
var _a;
|
|
2793
|
+
var _a, _b, _c;
|
|
2793
2794
|
scene.setEvents([...events].sort(sort_events_default));
|
|
2794
2795
|
(_a = rendererRef.current) == null ? void 0 : _a.animator.reset();
|
|
2796
|
+
const survivors = [...selectionRef.current].filter(
|
|
2797
|
+
(id) => scene.getEvent(id) !== void 0
|
|
2798
|
+
);
|
|
2799
|
+
if (survivors.length !== selectionRef.current.size) {
|
|
2800
|
+
selectionRef.current = new Set(survivors);
|
|
2801
|
+
(_b = rendererRef.current) == null ? void 0 : _b.setView({ selectedEventIds: selectionRef.current });
|
|
2802
|
+
(_c = onSelectionChangeRef.current) == null ? void 0 : _c.call(onSelectionChangeRef, survivors);
|
|
2803
|
+
}
|
|
2795
2804
|
}, [scene, events]);
|
|
2796
2805
|
useEffect6(() => {
|
|
2797
2806
|
scene.setStaticEvents(staticEvents ? [...staticEvents] : []);
|
|
@@ -2850,6 +2859,37 @@ var Timeline = forwardRef3(
|
|
|
2850
2859
|
);
|
|
2851
2860
|
}
|
|
2852
2861
|
}, []);
|
|
2862
|
+
const fitStart = new Date(
|
|
2863
|
+
startDate.getFullYear(),
|
|
2864
|
+
startDate.getMonth(),
|
|
2865
|
+
startDate.getDate(),
|
|
2866
|
+
startDate.getHours(),
|
|
2867
|
+
0,
|
|
2868
|
+
0
|
|
2869
|
+
).getTime() / 1e3;
|
|
2870
|
+
const fitEnd = new Date(
|
|
2871
|
+
endDate.getFullYear(),
|
|
2872
|
+
endDate.getMonth(),
|
|
2873
|
+
endDate.getDate(),
|
|
2874
|
+
endDate.getHours(),
|
|
2875
|
+
0,
|
|
2876
|
+
0
|
|
2877
|
+
).getTime() / 1e3;
|
|
2878
|
+
const lastFitRef = useRef7([fitStart, fitEnd]);
|
|
2879
|
+
useEffect6(() => {
|
|
2880
|
+
var _a;
|
|
2881
|
+
if (lastFitRef.current[0] === fitStart && lastFitRef.current[1] === fitEnd) {
|
|
2882
|
+
return;
|
|
2883
|
+
}
|
|
2884
|
+
lastFitRef.current = [fitStart, fitEnd];
|
|
2885
|
+
setWindowTime([fitStart, fitEnd]);
|
|
2886
|
+
const width = (_a = contentRef.current) == null ? void 0 : _a.getBoundingClientRect().width;
|
|
2887
|
+
if (width) {
|
|
2888
|
+
const windowDuration = fitEnd - fitStart;
|
|
2889
|
+
setTick(windowDuration / width);
|
|
2890
|
+
setCellWidth(width / (windowDuration / 3600));
|
|
2891
|
+
}
|
|
2892
|
+
}, [fitStart, fitEnd]);
|
|
2853
2893
|
useEffect6(() => {
|
|
2854
2894
|
if (bodyRef.current) {
|
|
2855
2895
|
setScrollWidth(
|