@osrd-project/ui-charts 0.0.78 → 0.0.80
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.esm.js +329 -209
- package/dist/index.esm.js.map +1 -1
- package/dist/manchette/components/Manchette.d.ts +1 -0
- package/dist/manchette/components/Waypoint.d.ts +2 -1
- package/dist/manchette/consts.d.ts +0 -1
- package/dist/spaceTimeChart/components/Quadrilateral.d.ts +8 -2
- package/dist/spaceTimeChart/utils/canvas.d.ts +14 -2
- package/dist/spaceTimeChart/utils/colors.d.ts +3 -0
- package/dist/speedSpaceChart/components/common/SettingsPanel.d.ts +2 -2
- package/dist/speedSpaceChart/components/const.d.ts +5 -0
- package/dist/speedSpaceChart/components/helpers/layersManager.d.ts +1 -0
- package/dist/speedSpaceChart/components/layers/ReticleLayer.d.ts +2 -3
- package/dist/speedSpaceChart/components/utils.d.ts +0 -13
- package/dist/theme.css +4089 -4144
- package/dist/theme.css.map +1 -1
- package/package.json +7 -8
package/dist/index.esm.js
CHANGED
|
@@ -3,7 +3,7 @@ import cx from 'classnames';
|
|
|
3
3
|
import { clamp as clamp$1, isEqual, inRange, last, flatten, sortBy, sum } from 'lodash';
|
|
4
4
|
import chroma from 'chroma-js';
|
|
5
5
|
import { ZoomOut, ZoomIn, Iterations, Plus, Dash, KebabHorizontal, X } from '@osrd-project/ui-icons';
|
|
6
|
-
import { Checkbox } from '@osrd-project/ui-core';
|
|
6
|
+
import { Checkbox, Slider } from '@osrd-project/ui-core';
|
|
7
7
|
import * as d3selection from 'd3-selection';
|
|
8
8
|
import * as d3zoom from 'd3-zoom';
|
|
9
9
|
|
|
@@ -239,6 +239,63 @@ function drawAliasedDisc(imageData, { x: centerX, y: centerY }, radius, [r, g, b
|
|
|
239
239
|
}
|
|
240
240
|
}
|
|
241
241
|
}
|
|
242
|
+
/**
|
|
243
|
+
* Draws an aliased quadrilateral
|
|
244
|
+
*
|
|
245
|
+
* vertices[0] ________ vertices[1]
|
|
246
|
+
* / /
|
|
247
|
+
* vertices[3] /________/ vertices[2]
|
|
248
|
+
*
|
|
249
|
+
*/
|
|
250
|
+
function drawAliasedQuadrilateral(imageData, points, [r, g, b], scalingRatio = 1) {
|
|
251
|
+
const vertices = points.map((point) => ({
|
|
252
|
+
x: Math.round(point.x * scalingRatio),
|
|
253
|
+
y: Math.round(point.y * scalingRatio),
|
|
254
|
+
}));
|
|
255
|
+
let { x: xmin, x: xmax, y: ymin, y: ymax } = vertices[0];
|
|
256
|
+
for (let i = 1; i < vertices.length; i++) {
|
|
257
|
+
const { x, y } = vertices[i];
|
|
258
|
+
if (x < xmin)
|
|
259
|
+
xmin = x;
|
|
260
|
+
else if (x > xmax)
|
|
261
|
+
xmax = x;
|
|
262
|
+
if (y < ymin)
|
|
263
|
+
ymin = y;
|
|
264
|
+
else if (y > ymax)
|
|
265
|
+
ymax = y;
|
|
266
|
+
}
|
|
267
|
+
xmin = clamp$1(xmin, 0, imageData.width - 1);
|
|
268
|
+
ymin = clamp$1(ymin, 0, imageData.height - 1);
|
|
269
|
+
xmax = clamp$1(xmax, 0, imageData.width - 1);
|
|
270
|
+
ymax = clamp$1(ymax, 0, imageData.height - 1);
|
|
271
|
+
for (let y = ymin; y < ymax; y++) {
|
|
272
|
+
for (let x = xmin; x < xmax; x++) {
|
|
273
|
+
// Compute whether the point is inside the quadrilateral
|
|
274
|
+
// using the Ray casting algorithm (see https://en.wikipedia.org/wiki/Point_in_polygon)
|
|
275
|
+
let isInside = false;
|
|
276
|
+
for (let i = 0; i < vertices.length; i++) {
|
|
277
|
+
const pointA = vertices[i];
|
|
278
|
+
const pointB = i === vertices.length - 1 ? vertices[0] : vertices[i + 1];
|
|
279
|
+
// Line equation from A to B: y(x) = m * x + c
|
|
280
|
+
const m = (pointB.y - pointA.y) / (pointB.x - pointA.x);
|
|
281
|
+
const c = pointB.y - m * pointB.x;
|
|
282
|
+
// Invert the equation: x(y) = (y - c) / m
|
|
283
|
+
// Look only for points that are on the left of the line, so for a given y, x < (y - c) / m
|
|
284
|
+
if (pointA.y > y != pointB.y > y && x < (y - c) / m) {
|
|
285
|
+
isInside = !isInside;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
// If the point is inside the quadrilateral, allow interactions with it
|
|
289
|
+
if (isInside) {
|
|
290
|
+
const index = (y * imageData.width + x) * 4;
|
|
291
|
+
imageData.data[index] = r;
|
|
292
|
+
imageData.data[index + 1] = g;
|
|
293
|
+
imageData.data[index + 2] = b;
|
|
294
|
+
imageData.data[index + 3] = 255;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
242
299
|
function drawAliasedRect(imageData, { x, y }, width, height, [r, g, b], scalingRatio = 1) {
|
|
243
300
|
x = Math.round(x * scalingRatio);
|
|
244
301
|
y = Math.round(y * scalingRatio);
|
|
@@ -339,14 +396,17 @@ function computeVisibleTimeMarkers(minT, maxT, timeRanges, gridlinesLevels, form
|
|
|
339
396
|
* To get crisp horizontal or vertical lines on a canvas, we must draw them as thin as possible, in
|
|
340
397
|
* terms of actual pixels on screen.
|
|
341
398
|
* The best way for this is:
|
|
342
|
-
* - To center lines 1, 3, 5... pixels wide in the middle of a pixel
|
|
343
|
-
* - To center lines 2, 4, 6... pixels wide between two pixels
|
|
399
|
+
* - To center lines 1, 3, 5... pixels wide in the middle of a pixel (0.5, 1.5, 2.5...)
|
|
400
|
+
* - To center lines 2, 4, 6... pixels wide between two pixels (0, 1, 2, 3...)
|
|
401
|
+
* Also, for HiDPi screens:
|
|
402
|
+
* - To center lines of "integer thicknesses" between two screen pixels (0, 0.5, 1, 1.5, 2...)
|
|
403
|
+
* - To center lines with `n + 0.5` thicknesses in the middle of a screen pixel (0.25, 0.75, 1.25, 1.75...)
|
|
344
404
|
* @param rawCoordinate Any input coordinate to fix
|
|
345
405
|
* @param lineWidth The width of the line to draw
|
|
346
406
|
* @param devicePixelRatio
|
|
347
407
|
*/
|
|
348
408
|
function getCrispLineCoordinate(rawCoordinate, lineWidth, devicePixelRatio = window.devicePixelRatio || 1) {
|
|
349
|
-
const centerOffset = lineWidth / 2;
|
|
409
|
+
const centerOffset = Math.ceil(lineWidth * devicePixelRatio) / devicePixelRatio / 2;
|
|
350
410
|
return (Math.round((rawCoordinate - centerOffset) * devicePixelRatio) / devicePixelRatio + centerOffset);
|
|
351
411
|
}
|
|
352
412
|
/**
|
|
@@ -367,6 +427,9 @@ function fillRect(ctx, { timeStart, timeEnd, spaceStart, spaceEnd }, { getPoint
|
|
|
367
427
|
|
|
368
428
|
const COLORS_TO_INDICES = {};
|
|
369
429
|
const INDICES_TO_COLORS = {};
|
|
430
|
+
const WHITE_ALPHA_75 = '#ffffffbf';
|
|
431
|
+
const BLACK_ALPHA_25 = '#00000025';
|
|
432
|
+
const GREY_50$3 = '#797671';
|
|
370
433
|
/**
|
|
371
434
|
* This function returns a unique hex color corresponding to the given index. The colors are
|
|
372
435
|
* generated as #000001, #000002 ... #0000ff, #000100 etc.
|
|
@@ -589,7 +652,7 @@ function useCanvas$1(dom, inputStcContext, position) {
|
|
|
589
652
|
useEffect(() => {
|
|
590
653
|
// Cache latest context in ref:
|
|
591
654
|
stcContextRef.current = inputStcContext;
|
|
592
|
-
|
|
655
|
+
scheduleRendering();
|
|
593
656
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
594
657
|
}, [inputStcContext.fingerprint]);
|
|
595
658
|
// Handle resizing:
|
|
@@ -605,6 +668,8 @@ function useCanvas$1(dom, inputStcContext, position) {
|
|
|
605
668
|
canvas.style.height = size.height + 'px';
|
|
606
669
|
canvas.setAttribute('width', Math.max(1, size.width * ratio) + 'px');
|
|
607
670
|
canvas.setAttribute('height', Math.max(1, size.height * ratio) + 'px');
|
|
671
|
+
if (isPicking)
|
|
672
|
+
canvas.style.imageRendering = 'pixelated';
|
|
608
673
|
if (!isPicking) {
|
|
609
674
|
// Reset the transform to identity, then apply the new scale
|
|
610
675
|
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
|
@@ -764,7 +829,7 @@ const MINUTE = 60 * SECOND;
|
|
|
764
829
|
const HOUR = 60 * MINUTE;
|
|
765
830
|
const DEFAULT_THEME = {
|
|
766
831
|
background: 'white',
|
|
767
|
-
breakpoints: [0.2, 0.
|
|
832
|
+
breakpoints: [0.2, 0.4, 0.7, 2, 6, 20, 60, Infinity],
|
|
768
833
|
timeRanges: [
|
|
769
834
|
10 * SECOND,
|
|
770
835
|
30 * SECOND,
|
|
@@ -871,20 +936,19 @@ const DEFAULT_THEME = {
|
|
|
871
936
|
4: {
|
|
872
937
|
width: 0.5,
|
|
873
938
|
color: BLUE,
|
|
874
|
-
opacity: 0.
|
|
939
|
+
opacity: 0.7,
|
|
875
940
|
dashArray: [16, 4],
|
|
876
941
|
},
|
|
877
942
|
5: {
|
|
878
943
|
width: 0.5,
|
|
879
944
|
color: BLUE,
|
|
880
|
-
opacity: 0.
|
|
945
|
+
opacity: 0.7,
|
|
881
946
|
dashArray: [8, 8],
|
|
882
947
|
},
|
|
883
948
|
6: {
|
|
884
|
-
width: 0.
|
|
949
|
+
width: 0.5,
|
|
885
950
|
color: BLUE,
|
|
886
|
-
opacity: 0.
|
|
887
|
-
dashArray: [2, 8],
|
|
951
|
+
opacity: 0.25,
|
|
888
952
|
},
|
|
889
953
|
},
|
|
890
954
|
};
|
|
@@ -956,9 +1020,13 @@ const TimeCaptions = () => {
|
|
|
956
1020
|
// Render caption background:
|
|
957
1021
|
ctx.fillStyle = background;
|
|
958
1022
|
if (!swapAxis) {
|
|
1023
|
+
ctx.fillStyle = WHITE_ALPHA_75;
|
|
1024
|
+
ctx.fillRect(0, 0, width, 24);
|
|
1025
|
+
ctx.fillStyle = background;
|
|
959
1026
|
ctx.fillRect(0, spaceAxisSize, timeAxisSize, captionSize);
|
|
960
1027
|
}
|
|
961
1028
|
else {
|
|
1029
|
+
ctx.fillStyle = background;
|
|
962
1030
|
ctx.fillRect(0, 0, captionSize, timeAxisSize);
|
|
963
1031
|
}
|
|
964
1032
|
// Render time captions:
|
|
@@ -973,13 +1041,24 @@ const TimeCaptions = () => {
|
|
|
973
1041
|
ctx.font = `${styles.fontWeight || 'normal'} ${styles.font}`;
|
|
974
1042
|
const timePixel = getCrispLineCoordinate(getTimePixel(time), ctx.lineWidth);
|
|
975
1043
|
if (!swapAxis) {
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
1044
|
+
ctx.beginPath();
|
|
1045
|
+
ctx.strokeStyle = timeCaptionsStyles[1].color;
|
|
1046
|
+
ctx.lineWidth = 1;
|
|
1047
|
+
let tickHeight = 4;
|
|
1048
|
+
const mod = time % (60 * 60 * 1000);
|
|
1049
|
+
if (mod === 0) {
|
|
1050
|
+
tickHeight = 8;
|
|
981
1051
|
}
|
|
982
|
-
|
|
1052
|
+
else if (mod % (30 * 60 * 1000) === 0) {
|
|
1053
|
+
tickHeight = 6;
|
|
1054
|
+
}
|
|
1055
|
+
ctx.moveTo(timePixel, spaceAxisSize);
|
|
1056
|
+
ctx.lineTo(timePixel, spaceAxisSize + tickHeight);
|
|
1057
|
+
ctx.moveTo(timePixel, 0);
|
|
1058
|
+
ctx.lineTo(timePixel, tickHeight);
|
|
1059
|
+
ctx.stroke();
|
|
1060
|
+
ctx.fillStyle = timeCaptionsStyles[1].color;
|
|
1061
|
+
ctx.fillText(text, timePixel, styles.topOffset || 0);
|
|
983
1062
|
ctx.fillText(text, timePixel, spaceAxisSize + (styles.topOffset || 0));
|
|
984
1063
|
}
|
|
985
1064
|
else {
|
|
@@ -1014,7 +1093,9 @@ const TimeCaptions = () => {
|
|
|
1014
1093
|
};
|
|
1015
1094
|
|
|
1016
1095
|
const TimeGraduations = () => {
|
|
1017
|
-
const
|
|
1096
|
+
const { position, isHover } = useContext(MouseContext);
|
|
1097
|
+
const mouseX = position.x;
|
|
1098
|
+
const drawingFunction = useCallback((ctx, { timeScale, timeOrigin, timePixelOffset, spacePixelOffset, getTimePixel, getTime, swapAxis, width, height, theme: { breakpoints, timeRanges, timeGraduationsStyles, timeGraduationsPriorities }, }) => {
|
|
1018
1099
|
const timeAxisSize = !swapAxis ? width : height;
|
|
1019
1100
|
const spaceAxisSize = !swapAxis ? height : width;
|
|
1020
1101
|
const minT = timeOrigin - timeScale * timePixelOffset;
|
|
@@ -1035,8 +1116,8 @@ const TimeGraduations = () => {
|
|
|
1035
1116
|
const styles = timeGraduationsStyles[level];
|
|
1036
1117
|
ctx.strokeStyle = styles.color;
|
|
1037
1118
|
ctx.lineWidth = styles.width;
|
|
1038
|
-
ctx.globalAlpha = styles.opacity
|
|
1039
|
-
ctx.setLineDash(styles.dashArray
|
|
1119
|
+
ctx.globalAlpha = styles.opacity ?? 1;
|
|
1120
|
+
ctx.setLineDash(styles.dashArray ?? []);
|
|
1040
1121
|
if (styles.dashArray) {
|
|
1041
1122
|
ctx.lineDashOffset = -spacePixelOffset;
|
|
1042
1123
|
}
|
|
@@ -1052,10 +1133,40 @@ const TimeGraduations = () => {
|
|
|
1052
1133
|
}
|
|
1053
1134
|
ctx.stroke();
|
|
1054
1135
|
});
|
|
1136
|
+
if (!swapAxis && isHover && mouseX != null && !isNaN(mouseX)) {
|
|
1137
|
+
const crispX = getCrispLineCoordinate(mouseX, 1);
|
|
1138
|
+
const timeValue = getTime(crispX);
|
|
1139
|
+
const timeLabel = new Date(timeValue).toLocaleTimeString();
|
|
1140
|
+
ctx.globalAlpha = 1;
|
|
1141
|
+
// Vertical line:
|
|
1142
|
+
ctx.strokeStyle = BLACK_ALPHA_25;
|
|
1143
|
+
ctx.lineWidth = 1;
|
|
1144
|
+
ctx.setLineDash([]);
|
|
1145
|
+
ctx.beginPath();
|
|
1146
|
+
ctx.moveTo(crispX, 0);
|
|
1147
|
+
ctx.lineTo(crispX, spaceAxisSize);
|
|
1148
|
+
ctx.stroke();
|
|
1149
|
+
// Label
|
|
1150
|
+
const padding = 4;
|
|
1151
|
+
const fontSize = 12;
|
|
1152
|
+
const fontWeight = '400';
|
|
1153
|
+
const fontFamily = 'IBM Plex Sans, sans-regular';
|
|
1154
|
+
ctx.font = `${fontWeight} ${fontSize}px ${fontFamily}`;
|
|
1155
|
+
const textWidth = ctx.measureText(timeLabel).width;
|
|
1156
|
+
const labelX = Math.min(Math.max(crispX - textWidth / 2 - padding, 0), width - textWidth - padding * 2);
|
|
1157
|
+
const labelY = spaceAxisSize - 50;
|
|
1158
|
+
// Label background
|
|
1159
|
+
ctx.fillStyle = '#FFFFFF';
|
|
1160
|
+
ctx.fillRect(labelX, labelY - fontSize - 2, textWidth + padding * 2, fontSize + 4);
|
|
1161
|
+
// Text
|
|
1162
|
+
ctx.fillStyle = GREY_50$3;
|
|
1163
|
+
ctx.fillText(timeLabel, labelX + padding, labelY);
|
|
1164
|
+
}
|
|
1165
|
+
// Reset
|
|
1055
1166
|
ctx.setLineDash([]);
|
|
1056
1167
|
ctx.lineDashOffset = 0;
|
|
1057
1168
|
ctx.globalAlpha = 1;
|
|
1058
|
-
}, []);
|
|
1169
|
+
}, [mouseX, isHover]);
|
|
1059
1170
|
useDraw('graduations', drawingFunction);
|
|
1060
1171
|
return null;
|
|
1061
1172
|
};
|
|
@@ -2061,6 +2172,21 @@ const SpaceTimeChart = (props) => {
|
|
|
2061
2172
|
showTicks,
|
|
2062
2173
|
hideDates,
|
|
2063
2174
|
]);
|
|
2175
|
+
const pickingState = useMemo(() => {
|
|
2176
|
+
const pickingElements = [];
|
|
2177
|
+
const resetPickingElements = () => {
|
|
2178
|
+
pickingElements.length = 0;
|
|
2179
|
+
};
|
|
2180
|
+
const registerPickingElement = (element) => {
|
|
2181
|
+
pickingElements.push(element);
|
|
2182
|
+
return pickingElements.length - 1;
|
|
2183
|
+
};
|
|
2184
|
+
return {
|
|
2185
|
+
pickingElements,
|
|
2186
|
+
resetPickingElements,
|
|
2187
|
+
registerPickingElement,
|
|
2188
|
+
};
|
|
2189
|
+
}, []);
|
|
2064
2190
|
const contextState = useMemo(() => {
|
|
2065
2191
|
const spaceScaleTree = spaceScalesToBinaryTree(spaceOrigin, spaceScales);
|
|
2066
2192
|
const flatSteps = getFlatSteps(spaceScales);
|
|
@@ -2083,15 +2209,8 @@ const SpaceTimeChart = (props) => {
|
|
|
2083
2209
|
const getTime = getPixelToTime(timeOrigin, timePixelOffset, timeScale);
|
|
2084
2210
|
const getSpace = getPixelToSpace(spacePixelOffset, spaceScaleTree);
|
|
2085
2211
|
const getData = getPointToData(getTime, getSpace, timeAxis, spaceAxis);
|
|
2086
|
-
const pickingElements = [];
|
|
2087
|
-
const resetPickingElements = () => {
|
|
2088
|
-
pickingElements.length = 0;
|
|
2089
|
-
};
|
|
2090
|
-
const registerPickingElement = (element) => {
|
|
2091
|
-
pickingElements.push(element);
|
|
2092
|
-
return pickingElements.length - 1;
|
|
2093
|
-
};
|
|
2094
2212
|
return {
|
|
2213
|
+
...pickingState,
|
|
2095
2214
|
fingerprint,
|
|
2096
2215
|
width,
|
|
2097
2216
|
height,
|
|
@@ -2101,9 +2220,6 @@ const SpaceTimeChart = (props) => {
|
|
|
2101
2220
|
getTime,
|
|
2102
2221
|
getSpace,
|
|
2103
2222
|
getData,
|
|
2104
|
-
pickingElements,
|
|
2105
|
-
resetPickingElements,
|
|
2106
|
-
registerPickingElement,
|
|
2107
2223
|
operationalPoints,
|
|
2108
2224
|
spaceOrigin,
|
|
2109
2225
|
spaceScaleTree,
|
|
@@ -2127,7 +2243,7 @@ const SpaceTimeChart = (props) => {
|
|
|
2127
2243
|
: fullTheme.dateCaptionsSize + fullTheme.timeCaptionsSize,
|
|
2128
2244
|
};
|
|
2129
2245
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2130
|
-
}, [fingerprint]);
|
|
2246
|
+
}, [fingerprint, pickingState]);
|
|
2131
2247
|
const mouseState = useMouseTracking(root);
|
|
2132
2248
|
const { position, down, isHover } = mouseState;
|
|
2133
2249
|
const { canvasContext, hoveredItem } = useCanvas$1(canvasesRoot, contextState, position);
|
|
@@ -2215,7 +2331,7 @@ const ConflictLayer = ({ conflicts }) => {
|
|
|
2215
2331
|
return null;
|
|
2216
2332
|
};
|
|
2217
2333
|
|
|
2218
|
-
const Tooltip$1 = ({ position, children }) => (React.createElement("div", { className: "spacetimechart-tooltip", style: { left: position.x, top: position.y } }, children));
|
|
2334
|
+
const Tooltip$1 = ({ position, children }) => (React.createElement("div", { className: "ui-spacetimechart-tooltip", style: { left: position.x, top: position.y } }, children));
|
|
2219
2335
|
|
|
2220
2336
|
const formatDistance = (meters) => {
|
|
2221
2337
|
const km = meters / 1000;
|
|
@@ -2305,6 +2421,9 @@ const WorkScheduleLayer = ({ workSchedules, imageUrl }) => {
|
|
|
2305
2421
|
return workSchedules.flatMap((ws) => ws.spaceRanges.map(([spaceStart, spaceEnd]) => (React.createElement(PatternRect, { key: `${ws.type}-${ws.timeStart}-${ws.timeEnd}-${spaceStart}-${spaceEnd}`, timeStart: ws.timeStart, timeEnd: ws.timeEnd, spaceStart: spaceStart, spaceEnd: spaceEnd, imageElement: imageElement }))));
|
|
2306
2422
|
};
|
|
2307
2423
|
|
|
2424
|
+
function isQuadrilaterPickingElement(element) {
|
|
2425
|
+
return element.type === 'quadrilateral';
|
|
2426
|
+
}
|
|
2308
2427
|
/**
|
|
2309
2428
|
* Draws a quadrilateral in the space time chart
|
|
2310
2429
|
* Position correspond to each point of the quadrilateral
|
|
@@ -2314,7 +2433,7 @@ const WorkScheduleLayer = ({ workSchedules, imageUrl }) => {
|
|
|
2314
2433
|
* vertices[3] /________/ vertices[2]
|
|
2315
2434
|
*
|
|
2316
2435
|
*/
|
|
2317
|
-
const Quadrilateral = ({ vertices, style }) => {
|
|
2436
|
+
const Quadrilateral = ({ id, vertices, style }) => {
|
|
2318
2437
|
const drawRegion = useCallback((ctx, { getSpacePixel, getTimePixel }) => {
|
|
2319
2438
|
ctx.save();
|
|
2320
2439
|
ctx.fillStyle = style.backgroundColor ?? 'lightblue';
|
|
@@ -2330,6 +2449,17 @@ const Quadrilateral = ({ vertices, style }) => {
|
|
|
2330
2449
|
ctx.restore();
|
|
2331
2450
|
}, [vertices, style]);
|
|
2332
2451
|
useDraw('background', drawRegion);
|
|
2452
|
+
const drawPicking = useCallback((imageData, { registerPickingElement, getTimePixel, getSpacePixel }, scalingRatio) => {
|
|
2453
|
+
const points = vertices.map((vertice) => ({
|
|
2454
|
+
x: getTimePixel(vertice.time),
|
|
2455
|
+
y: getSpacePixel(vertice.position),
|
|
2456
|
+
}));
|
|
2457
|
+
const pickingElement = { type: 'quadrilateral', id };
|
|
2458
|
+
const index = registerPickingElement(pickingElement);
|
|
2459
|
+
const color = hexToRgb(indexToColor(index));
|
|
2460
|
+
drawAliasedQuadrilateral(imageData, points, color, scalingRatio);
|
|
2461
|
+
}, [id, vertices]);
|
|
2462
|
+
usePicking('paths', drawPicking);
|
|
2333
2463
|
return null;
|
|
2334
2464
|
};
|
|
2335
2465
|
|
|
@@ -2429,6 +2559,7 @@ function isPathOnScreen(width, height, points) {
|
|
|
2429
2559
|
|
|
2430
2560
|
const INITIAL_OP_LIST_HEIGHT = 521;
|
|
2431
2561
|
const BASE_WAYPOINT_HEIGHT = 32;
|
|
2562
|
+
const INITIAL_SPACE_TIME_CHART_HEIGHT = INITIAL_OP_LIST_HEIGHT + 40;
|
|
2432
2563
|
const MIN_ZOOM_MS_PER_PX = 600_000;
|
|
2433
2564
|
const MAX_ZOOM_MS_PER_PX = 625;
|
|
2434
2565
|
const DEFAULT_ZOOM_MS_PER_PX = 7_500;
|
|
@@ -2458,17 +2589,17 @@ function getDistance(a, b) {
|
|
|
2458
2589
|
};
|
|
2459
2590
|
}
|
|
2460
2591
|
|
|
2461
|
-
const Waypoint = ({ waypoint: { name, secondaryCode, id, position, onClick }, waypointRef, isActive, isMenuActive, }) => (React.createElement("div", { className: cx('flex waypoint items-baseline', {
|
|
2592
|
+
const Waypoint = ({ waypoint: { name, secondaryCode, id, position, onClick }, waypointRef, isActive, isMenuActive, testIdPrefix, }) => (React.createElement("div", { "data-testid": testIdPrefix ? `${testIdPrefix}-base-info` : undefined, className: cx('flex waypoint items-baseline', {
|
|
2462
2593
|
'waypoint-active': isActive,
|
|
2463
2594
|
'menu-active': isMenuActive,
|
|
2464
2595
|
}), id: id, ref: waypointRef, onClick: () => {
|
|
2465
2596
|
if (onClick && !isMenuActive)
|
|
2466
2597
|
onClick(id);
|
|
2467
2598
|
} },
|
|
2468
|
-
React.createElement("div", { className: "waypoint-position justify-self-start text-end" }, positionMmToKm(position)),
|
|
2469
|
-
React.createElement("div", { className: "waypoint-name mx-2 justify-self-start" }, name),
|
|
2599
|
+
React.createElement("div", { "data-testid": testIdPrefix ? `${testIdPrefix}-position` : undefined, className: "waypoint-position justify-self-start text-end" }, positionMmToKm(position)),
|
|
2600
|
+
React.createElement("div", { "data-testid": testIdPrefix ? `${testIdPrefix}-name` : undefined, className: "waypoint-name mx-2 justify-self-start" }, name),
|
|
2470
2601
|
React.createElement("div", { className: "waypoint-separator" }),
|
|
2471
|
-
React.createElement("div", { className: "waypoint-ch font-mono justify-self-end" }, secondaryCode),
|
|
2602
|
+
React.createElement("div", { "data-testid": testIdPrefix ? `${testIdPrefix}-ch` : undefined, className: "waypoint-ch font-mono justify-self-end" }, secondaryCode),
|
|
2472
2603
|
React.createElement("div", { className: "waypoint-separator" }),
|
|
2473
2604
|
React.createElement("div", { className: "waypoint-type" }),
|
|
2474
2605
|
React.createElement("div", { className: "waypoint-separator" })));
|
|
@@ -2571,24 +2702,24 @@ const getScales = (waypoints, { isProportional, yZoom, height }, minZoomMillimet
|
|
|
2571
2702
|
};
|
|
2572
2703
|
const isInteractiveWaypoint = (item) => item != null && typeof item === 'object' && 'id' in item && 'position' in item;
|
|
2573
2704
|
|
|
2574
|
-
const Manchette = ({ zoomYIn, zoomYOut, resetZoom, yZoom = 1, contents, activeWaypointId, activeWaypointRef, isProportional = true, toggleMode, children, height = INITIAL_OP_LIST_HEIGHT, }) => (React.createElement("div", { className: "manchette-container" },
|
|
2705
|
+
const Manchette = ({ zoomYIn, zoomYOut, resetZoom, yZoom = 1, contents, activeWaypointId, activeWaypointRef, isProportional = true, toggleMode, children, height = INITIAL_OP_LIST_HEIGHT, }) => (React.createElement("div", { className: "ui-manchette-container" },
|
|
2575
2706
|
React.createElement("div", { className: "bg-white-100 border-r border-grey-30 relative", style: { minHeight: `${height}px` } },
|
|
2576
2707
|
React.createElement("div", { className: "waypoints-list" },
|
|
2577
2708
|
contents.map((content, index) => isInteractiveWaypoint(content) ? (React.createElement("div", { key: index, className: "waypoint-wrapper flex justify-start", style: content.styles },
|
|
2578
|
-
React.createElement(Waypoint, { waypoint: content, waypointRef: activeWaypointId === content.id ? activeWaypointRef : undefined, isActive: activeWaypointId === content.id, isMenuActive: !!activeWaypointId }))) : (React.createElement(Fragment, { key: index }, content))),
|
|
2709
|
+
React.createElement(Waypoint, { waypoint: content, waypointRef: activeWaypointId === content.id ? activeWaypointRef : undefined, isActive: activeWaypointId === content.id, isMenuActive: !!activeWaypointId, testIdPrefix: "waypoint" }))) : (React.createElement(Fragment, { key: index }, content))),
|
|
2579
2710
|
children)),
|
|
2580
|
-
React.createElement("div", { className: "manchette-actions" },
|
|
2711
|
+
React.createElement("div", { "data-testid": "manchette-actions", className: "manchette-actions" },
|
|
2581
2712
|
React.createElement("div", { className: "zoom-buttons" },
|
|
2582
|
-
React.createElement("button", { className: "zoom-out", onClick: zoomYOut, disabled: yZoom <= MIN_ZOOM_Y || !!activeWaypointId },
|
|
2713
|
+
React.createElement("button", { "data-testid": "zoom-out-button", className: "zoom-out", onClick: zoomYOut, disabled: yZoom <= MIN_ZOOM_Y || !!activeWaypointId },
|
|
2583
2714
|
React.createElement(ZoomOut, null)),
|
|
2584
|
-
React.createElement("button", { className: "zoom-in", onClick: zoomYIn, disabled: yZoom >= MAX_ZOOM_Y || !!activeWaypointId },
|
|
2715
|
+
React.createElement("button", { "data-testid": "zoom-in-button", className: "zoom-in", onClick: zoomYIn, disabled: yZoom >= MAX_ZOOM_Y || !!activeWaypointId },
|
|
2585
2716
|
React.createElement(ZoomIn, null)),
|
|
2586
|
-
React.createElement("button", { disabled: !!activeWaypointId, className: "zoom-reset", onClick: resetZoom }, "Fit")),
|
|
2717
|
+
React.createElement("button", { "data-testid": "reset-zoom-button", disabled: !!activeWaypointId, className: "zoom-reset", onClick: resetZoom }, "Fit")),
|
|
2587
2718
|
React.createElement("div", { className: "flex items-center ml-auto text-sans font-semibold" },
|
|
2588
2719
|
React.createElement("button", { disabled: !!activeWaypointId, className: "toggle-mode", onClick: toggleMode },
|
|
2589
2720
|
React.createElement("div", { className: "flex flex-col items-end pr-2" },
|
|
2590
|
-
React.createElement("span", { className: cx({ 'text-grey-30': !isProportional }) }, "Km"),
|
|
2591
|
-
React.createElement("span", { className: cx({ 'text-grey-30': isProportional }) }, "Lin\u00E9aire")))))));
|
|
2721
|
+
React.createElement("span", { className: cx({ 'text-grey-30': !isProportional }), "data-testid": "km-mode-button" }, "Km"),
|
|
2722
|
+
React.createElement("span", { className: cx({ 'text-grey-30': isProportional }), "data-testid": "linear-mode-button" }, "Lin\u00E9aire")))))));
|
|
2592
2723
|
|
|
2593
2724
|
const DEFAULT_MANCHETTE_WITH_SPACE_TIME_CHART_OPTIONS = {
|
|
2594
2725
|
displayTimeCaptions: true,
|
|
@@ -2596,7 +2727,7 @@ const DEFAULT_MANCHETTE_WITH_SPACE_TIME_CHART_OPTIONS = {
|
|
|
2596
2727
|
enableSpacePan: true,
|
|
2597
2728
|
enableTimeZoom: true,
|
|
2598
2729
|
};
|
|
2599
|
-
const useManchetteWithSpaceTimeChart = ({ waypoints, manchetteWithSpaceTimeChartRef, height =
|
|
2730
|
+
const useManchetteWithSpaceTimeChart = ({ waypoints, manchetteWithSpaceTimeChartRef, height = INITIAL_SPACE_TIME_CHART_HEIGHT, spaceTimeChartRef, defaultTimeOrigin = 0, defaultSpaceOrigin = 0, defaultXOffset = 0, verticalPadding = BASE_WAYPOINT_HEIGHT / 2, splitPoints = [], options = {}, }) => {
|
|
2600
2731
|
const { displayTimeCaptions, enableTimePan, enableSpacePan, enableTimeZoom } = useMemo(() => ({
|
|
2601
2732
|
...DEFAULT_MANCHETTE_WITH_SPACE_TIME_CHART_OPTIONS,
|
|
2602
2733
|
...options,
|
|
@@ -2618,7 +2749,7 @@ const useManchetteWithSpaceTimeChart = ({ waypoints, manchetteWithSpaceTimeChart
|
|
|
2618
2749
|
waypointsChart: [],
|
|
2619
2750
|
scales: [],
|
|
2620
2751
|
});
|
|
2621
|
-
const { xZoom, yZoom, timeOrigin, spaceOrigin, xOffset, yOffset, scrollTo, panning, zoomMode, rect,
|
|
2752
|
+
const { xZoom, yZoom, timeOrigin, spaceOrigin, xOffset, yOffset, scrollTo, panning, zoomMode, rect, isProportional, } = state;
|
|
2622
2753
|
/** used when we change the train dataset for example to center the chart on the new data */
|
|
2623
2754
|
const setTimeOrigin = useCallback((newTimeOrigin) => {
|
|
2624
2755
|
setState((prev) => ({ ...prev, timeOrigin: newTimeOrigin }));
|
|
@@ -2628,100 +2759,61 @@ const useManchetteWithSpaceTimeChart = ({ waypoints, manchetteWithSpaceTimeChart
|
|
|
2628
2759
|
const drawingHeightWithoutBothPadding = canvasDrawingHeight - BASE_WAYPOINT_HEIGHT; // 489
|
|
2629
2760
|
const totalDistance = calcTotalDistance(waypoints);
|
|
2630
2761
|
const { minZoomMillimeterPerPx, maxZoomMillimeterPerPx } = getExtremaScales(drawingHeightWithoutTopPadding, drawingHeightWithoutBothPadding, totalDistance);
|
|
2631
|
-
const
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2762
|
+
const handleRectZoomEnd = useCallback((prev) => {
|
|
2763
|
+
if (!prev.rect || !spaceTimeChartRef?.current) {
|
|
2764
|
+
return {};
|
|
2765
|
+
}
|
|
2766
|
+
const { timeStart, timeEnd, spaceStart, spaceEnd } = prev.rect;
|
|
2767
|
+
const timeRange = Math.abs(Number(timeEnd) - Number(timeStart)); // width of rect in ms
|
|
2768
|
+
const spaceRange = Math.abs(spaceEnd - spaceStart); // height of rect in mm
|
|
2769
|
+
const chosenTimeScale = timeRange / spaceTimeChartRef.current.clientWidth;
|
|
2770
|
+
const newTimeScale = clamp$1(chosenTimeScale, MAX_ZOOM_MS_PER_PX, MIN_ZOOM_MS_PER_PX);
|
|
2771
|
+
const newXZoom = timeScaleToZoomValue(newTimeScale);
|
|
2772
|
+
const newXOffset = sideOffset(prev.timeOrigin, newTimeScale, prev.rect.timeStart, prev.rect.timeEnd, spaceTimeChartRef.current.clientWidth);
|
|
2773
|
+
let newYZoom = prev.yZoom;
|
|
2774
|
+
let newYOffset = prev.yOffset;
|
|
2775
|
+
if (prev.isProportional) {
|
|
2776
|
+
const chosenSpaceScale = spaceRange / drawingHeightWithoutTopPadding;
|
|
2777
|
+
const newSpaceScale = clamp$1(chosenSpaceScale, maxZoomMillimeterPerPx, minZoomMillimeterPerPx);
|
|
2778
|
+
// we don’t need to handle this case and compute an offset
|
|
2779
|
+
// this condition happens when we draw a rectangle
|
|
2780
|
+
// larger than the entire chart (minus padding)
|
|
2781
|
+
// that would actually zoom OUT if it wasn’t clamped.
|
|
2782
|
+
if (newSpaceScale !== minZoomMillimeterPerPx) {
|
|
2783
|
+
newYZoom = spaceScaleToZoomValue(minZoomMillimeterPerPx, maxZoomMillimeterPerPx, newSpaceScale);
|
|
2784
|
+
newYOffset = Math.abs(sideOffset(prev.spaceOrigin, newSpaceScale, prev.rect.spaceStart, prev.rect.spaceEnd, height, verticalPadding));
|
|
2651
2785
|
}
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2786
|
+
}
|
|
2787
|
+
else if (prev.pixelRect) {
|
|
2788
|
+
const currentStopHeight = BASE_WAYPOINT_HEIGHT * prev.yZoom;
|
|
2789
|
+
const { yStart, yEnd } = prev.pixelRect;
|
|
2790
|
+
const numberOfStopsInRect = Math.abs(yEnd - yStart) / currentStopHeight;
|
|
2791
|
+
let newStopHeight = drawingHeightWithoutTopPadding / numberOfStopsInRect;
|
|
2792
|
+
// at maximum zoom, we want 3 stops displayed
|
|
2793
|
+
const maxStopHeight = drawingHeightWithoutTopPadding / (2 + BASE_WAYPOINT_HEIGHT / newStopHeight);
|
|
2794
|
+
newStopHeight = Math.min(newStopHeight, maxStopHeight);
|
|
2795
|
+
newYZoom = newStopHeight / BASE_WAYPOINT_HEIGHT;
|
|
2796
|
+
const rectTop = prev.yOffset + Math.min(yStart, yEnd) - WAYPOINT_LINE_HEIGHT;
|
|
2797
|
+
const numberOfStopsBeforeRectTop = rectTop / currentStopHeight;
|
|
2798
|
+
newYOffset = numberOfStopsBeforeRectTop * newStopHeight;
|
|
2799
|
+
}
|
|
2800
|
+
return {
|
|
2801
|
+
xZoom: newXZoom,
|
|
2802
|
+
yZoom: newYZoom,
|
|
2803
|
+
xOffset: newXOffset,
|
|
2804
|
+
yOffset: newYOffset,
|
|
2805
|
+
scrollTo: newYOffset,
|
|
2806
|
+
rect: null,
|
|
2807
|
+
pixelRect: null,
|
|
2808
|
+
};
|
|
2662
2809
|
}, [
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
minZoomMillimeterPerPx,
|
|
2810
|
+
spaceTimeChartRef,
|
|
2811
|
+
drawingHeightWithoutTopPadding,
|
|
2666
2812
|
maxZoomMillimeterPerPx,
|
|
2667
|
-
|
|
2668
|
-
yZoom,
|
|
2813
|
+
minZoomMillimeterPerPx,
|
|
2669
2814
|
height,
|
|
2670
|
-
spaceTimeChartRef,
|
|
2671
2815
|
verticalPadding,
|
|
2672
2816
|
]);
|
|
2673
|
-
useEffect(() => {
|
|
2674
|
-
if (rect && !zoomMode && spaceTimeChartRef?.current) {
|
|
2675
|
-
const { timeStart, timeEnd, spaceStart, spaceEnd } = rect;
|
|
2676
|
-
const timeRange = Math.abs(Number(timeEnd) - Number(timeStart)); // width of rect in ms
|
|
2677
|
-
const spaceRange = Math.abs(spaceEnd - spaceStart); // height of rect in mm
|
|
2678
|
-
const chosenTimeScale = timeRange / spaceTimeChartRef.current.clientWidth;
|
|
2679
|
-
if (isProportional) {
|
|
2680
|
-
const chosenSpaceScale = spaceRange / drawingHeightWithoutTopPadding;
|
|
2681
|
-
handleRectangleZoom({
|
|
2682
|
-
scales: { chosenTimeScale, chosenSpaceScale },
|
|
2683
|
-
overrideState: { rect: null },
|
|
2684
|
-
});
|
|
2685
|
-
}
|
|
2686
|
-
else if (pixelRect) {
|
|
2687
|
-
const currentStopHeight = BASE_WAYPOINT_HEIGHT * yZoom;
|
|
2688
|
-
const { yStart, yEnd } = pixelRect;
|
|
2689
|
-
const numberOfStopsInRect = Math.abs(yEnd - yStart) / currentStopHeight;
|
|
2690
|
-
let newStopHeight = drawingHeightWithoutTopPadding / numberOfStopsInRect;
|
|
2691
|
-
// at maximum zoom, we want 3 stops displayed
|
|
2692
|
-
const maxStopHeight = drawingHeightWithoutTopPadding / (2 + BASE_WAYPOINT_HEIGHT / newStopHeight);
|
|
2693
|
-
newStopHeight = Math.min(newStopHeight, maxStopHeight);
|
|
2694
|
-
const newYZoom = newStopHeight / BASE_WAYPOINT_HEIGHT;
|
|
2695
|
-
const rectTop = yOffset + Math.min(yStart, yEnd) - WAYPOINT_LINE_HEIGHT;
|
|
2696
|
-
const numberOfStopsBeforeRectTop = rectTop / currentStopHeight;
|
|
2697
|
-
const newYOffset = numberOfStopsBeforeRectTop * newStopHeight;
|
|
2698
|
-
handleRectangleZoom({
|
|
2699
|
-
scales: {
|
|
2700
|
-
chosenTimeScale,
|
|
2701
|
-
},
|
|
2702
|
-
overrideState: {
|
|
2703
|
-
rect: null,
|
|
2704
|
-
pixelRect: null,
|
|
2705
|
-
yZoom: newYZoom,
|
|
2706
|
-
yOffset: newYOffset,
|
|
2707
|
-
scrollTo: newYOffset,
|
|
2708
|
-
},
|
|
2709
|
-
});
|
|
2710
|
-
}
|
|
2711
|
-
}
|
|
2712
|
-
}, [
|
|
2713
|
-
state.rect,
|
|
2714
|
-
state.zoomMode,
|
|
2715
|
-
handleRectangleZoom,
|
|
2716
|
-
drawingHeightWithoutTopPadding,
|
|
2717
|
-
isProportional,
|
|
2718
|
-
pixelRect,
|
|
2719
|
-
rect,
|
|
2720
|
-
spaceTimeChartRef,
|
|
2721
|
-
yOffset,
|
|
2722
|
-
yZoom,
|
|
2723
|
-
zoomMode,
|
|
2724
|
-
]);
|
|
2725
2817
|
const zoomYIn = useCallback(() => {
|
|
2726
2818
|
const maxZoom = isProportional
|
|
2727
2819
|
? MAX_ZOOM_Y
|
|
@@ -2983,6 +3075,7 @@ const useManchetteWithSpaceTimeChart = ({ waypoints, manchetteWithSpaceTimeChart
|
|
|
2983
3075
|
if (!isPanning) {
|
|
2984
3076
|
return {
|
|
2985
3077
|
...prev,
|
|
3078
|
+
...(prev.zoomMode && prev.rect ? handleRectZoomEnd(prev) : {}),
|
|
2986
3079
|
panning: null,
|
|
2987
3080
|
zoomMode: false,
|
|
2988
3081
|
};
|
|
@@ -3060,6 +3153,7 @@ const useManchetteWithSpaceTimeChart = ({ waypoints, manchetteWithSpaceTimeChart
|
|
|
3060
3153
|
yOffset,
|
|
3061
3154
|
waypointsToDisplay,
|
|
3062
3155
|
splitPoints,
|
|
3156
|
+
displayTimeCaptions,
|
|
3063
3157
|
xZoom,
|
|
3064
3158
|
xOffset,
|
|
3065
3159
|
verticalPadding,
|
|
@@ -3074,13 +3168,13 @@ const useManchetteWithSpaceTimeChart = ({ waypoints, manchetteWithSpaceTimeChart
|
|
|
3074
3168
|
minZoomMillimeterPerPx,
|
|
3075
3169
|
maxZoomMillimeterPerPx,
|
|
3076
3170
|
setTimeOrigin,
|
|
3077
|
-
displayTimeCaptions,
|
|
3078
3171
|
isShiftPressed,
|
|
3079
3172
|
panning,
|
|
3173
|
+
manchetteWithSpaceTimeChartRef,
|
|
3080
3174
|
enableTimePan,
|
|
3081
3175
|
enableSpacePan,
|
|
3176
|
+
handleRectZoomEnd,
|
|
3082
3177
|
canvasDrawingHeight,
|
|
3083
|
-
manchetteWithSpaceTimeChartRef,
|
|
3084
3178
|
]);
|
|
3085
3179
|
};
|
|
3086
3180
|
|
|
@@ -3101,7 +3195,7 @@ const usePaths = (projectPathTrainResult) => useMemo(() => projectPathTrainResul
|
|
|
3101
3195
|
* This only covers basic usage. For more advanced control over the manchette
|
|
3102
3196
|
* and space time chart, the useManchetteWithSpaceTimeChart() hook can be used.
|
|
3103
3197
|
*/
|
|
3104
|
-
const ManchetteWithSpaceTimeChart = ({ waypoints, projectPathTrainResult, height =
|
|
3198
|
+
const ManchetteWithSpaceTimeChart = ({ waypoints, projectPathTrainResult, height = INITIAL_SPACE_TIME_CHART_HEIGHT, children, header, manchetteProps: additionalManchetteProps, spaceTimeChartProps: additionalSpaceTimeChartProps, splitPoints, }) => {
|
|
3105
3199
|
const manchetteWithSpaceTimeChartRef = useRef(null);
|
|
3106
3200
|
const spaceTimeChartRef = useRef(null);
|
|
3107
3201
|
const paths = usePaths(projectPathTrainResult);
|
|
@@ -3113,9 +3207,9 @@ const ManchetteWithSpaceTimeChart = ({ waypoints, projectPathTrainResult, height
|
|
|
3113
3207
|
splitPoints,
|
|
3114
3208
|
defaultTimeOrigin: Math.min(...projectPathTrainResult.map((p) => +p.departureTime)),
|
|
3115
3209
|
});
|
|
3116
|
-
return (React.createElement("div", { className: "manchette-space-time-chart-wrapper" },
|
|
3210
|
+
return (React.createElement("div", { className: "ui-manchette-space-time-chart-wrapper" },
|
|
3117
3211
|
React.createElement("div", { className: "header bg-ambientB-5 w-full border-b border-grey-30", style: { height: '40px' } }, header),
|
|
3118
|
-
React.createElement("div", { ref: manchetteWithSpaceTimeChartRef, className: "manchette flex",
|
|
3212
|
+
React.createElement("div", { ref: manchetteWithSpaceTimeChartRef, className: "manchette flex", onScroll: handleScroll },
|
|
3119
3213
|
React.createElement(Manchette, { ...manchetteProps, ...additionalManchetteProps }),
|
|
3120
3214
|
React.createElement("div", { className: "space-time-chart-container w-full sticky", ref: spaceTimeChartRef },
|
|
3121
3215
|
React.createElement(SpaceTimeChart, { className: "inset-0 absolute h-full", ...spaceTimeChartProps, ...additionalSpaceTimeChartProps },
|
|
@@ -3161,9 +3255,6 @@ const LINEAR_LAYERS_HEIGHTS = {
|
|
|
3161
3255
|
POWER_RESTRICTIONS_HEIGHT: 40,
|
|
3162
3256
|
SPEED_LIMIT_TAGS_HEIGHT: 40,
|
|
3163
3257
|
};
|
|
3164
|
-
const LINEAR_LAYERS_HEIGHTS_BY_NAME = {
|
|
3165
|
-
electricalProfiles: LINEAR_LAYERS_HEIGHTS.ELECTRICAL_PROFILES_HEIGHT,
|
|
3166
|
-
powerRestrictions: LINEAR_LAYERS_HEIGHTS.POWER_RESTRICTIONS_HEIGHT};
|
|
3167
3258
|
const LINEAR_LAYER_SEPARATOR_HEIGHT = 1;
|
|
3168
3259
|
const LINEAR_LAYERS_BACKGROUND_COLOR = {
|
|
3169
3260
|
FIRST: 'rgb(250, 249, 245)',
|
|
@@ -3205,6 +3296,11 @@ const COLOR_DICTIONARY = {
|
|
|
3205
3296
|
'#EAA72B': '#EAA72B',
|
|
3206
3297
|
'#94918E': '#94918E',
|
|
3207
3298
|
};
|
|
3299
|
+
const ZOOM_CONFIG = {
|
|
3300
|
+
MIN_RATIO: 1,
|
|
3301
|
+
MAX_RATIO: 50,
|
|
3302
|
+
SLIDER_WIDTH: 100,
|
|
3303
|
+
};
|
|
3208
3304
|
|
|
3209
3305
|
const getGraphOffsets = (width, height, declivities) => {
|
|
3210
3306
|
const WIDTH_OFFSET = declivities ? width - 102 : width - 60; // +2px so that the tick appears on the right of the chart
|
|
@@ -3236,34 +3332,6 @@ const maxPositionValue = (speeds) => {
|
|
|
3236
3332
|
const clearCanvas = (ctx, width, height) => {
|
|
3237
3333
|
ctx.clearRect(0, 0, width, height);
|
|
3238
3334
|
};
|
|
3239
|
-
/**
|
|
3240
|
-
* Calculates the adaptive height based on the height supplied and the lineaires displayed.
|
|
3241
|
-
* @param height - The initial height value.
|
|
3242
|
-
* @param layersDisplay - The linear display options.
|
|
3243
|
-
* @param isIncludingLinearLayers - A flag to add or remove layers. Default is true.
|
|
3244
|
-
* @returns The calculated adaptive height.
|
|
3245
|
-
*/
|
|
3246
|
-
const getAdaptiveHeight = (height, layersDisplay, isIncludingLinearLayers = true) => {
|
|
3247
|
-
const adjustment = [
|
|
3248
|
-
layersDisplay.electricalProfiles ? LINEAR_LAYERS_HEIGHTS.ELECTRICAL_PROFILES_HEIGHT : 0,
|
|
3249
|
-
layersDisplay.powerRestrictions ? LINEAR_LAYERS_HEIGHTS.POWER_RESTRICTIONS_HEIGHT : 0,
|
|
3250
|
-
layersDisplay.speedLimitTags ? LINEAR_LAYERS_HEIGHTS.SPEED_LIMIT_TAGS_HEIGHT : 0,
|
|
3251
|
-
].reduce((acc, curr) => acc + curr, 0);
|
|
3252
|
-
return (height += isIncludingLinearLayers ? adjustment : -adjustment);
|
|
3253
|
-
};
|
|
3254
|
-
/**
|
|
3255
|
-
* Calculates the top position for the linear layers based on the height and the layers displayed.
|
|
3256
|
-
* The speed limit tags linear layer needs to call this function with the isSpeedLimitByTag flag set to true.
|
|
3257
|
-
*/
|
|
3258
|
-
const getLinearLayerMarginTop = (height, layersDisplay, isSpeedLimitByTag = false) => {
|
|
3259
|
-
let adjustment = 0;
|
|
3260
|
-
const { electricalProfiles, powerRestrictions } = layersDisplay;
|
|
3261
|
-
if (electricalProfiles)
|
|
3262
|
-
adjustment = LINEAR_LAYERS_HEIGHTS_BY_NAME.electricalProfiles;
|
|
3263
|
-
if (powerRestrictions && isSpeedLimitByTag)
|
|
3264
|
-
adjustment += LINEAR_LAYERS_HEIGHTS_BY_NAME.powerRestrictions;
|
|
3265
|
-
return height + adjustment - MARGINS.MARGIN_BOTTOM;
|
|
3266
|
-
};
|
|
3267
3335
|
/**
|
|
3268
3336
|
* Calculates the position on the graph scale based on the given parameters.
|
|
3269
3337
|
* @param position - The current position.
|
|
@@ -3496,9 +3564,7 @@ const getSnappedStop = (cursorX, width, store) => {
|
|
|
3496
3564
|
};
|
|
3497
3565
|
|
|
3498
3566
|
const SETTINGS_PANEL_BASE_HEIGHT = 442;
|
|
3499
|
-
const
|
|
3500
|
-
const SettingsPanel = ({ globalHeight, color, store, setStore, setIsMouseHoveringSettingsPanel, translations, testIdPrefix, }) => {
|
|
3501
|
-
const [height, setHeight] = useState(`${SETTINGS_PANEL_BASE_HEIGHT}px`);
|
|
3567
|
+
const SettingsPanel = ({ color, store, setStore, setIsMouseHoveringSettingsPanel, adjustHeightOnLayerChange, translations, testIdPrefix, }) => {
|
|
3502
3568
|
const closeSettingsPanel = () => {
|
|
3503
3569
|
setIsMouseHoveringSettingsPanel(false);
|
|
3504
3570
|
setStore((prev) => ({
|
|
@@ -3506,13 +3572,10 @@ const SettingsPanel = ({ globalHeight, color, store, setStore, setIsMouseHoverin
|
|
|
3506
3572
|
isSettingsPanelOpened: false,
|
|
3507
3573
|
}));
|
|
3508
3574
|
};
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
}
|
|
3514
|
-
}, [globalHeight, store.layersDisplay]);
|
|
3515
|
-
return (React.createElement("div", { id: "settings-panel", style: { background: `rgba(${color.substring(4, color.length - 1)}, 0.4)`, height }, className: "font-sans", onMouseEnter: () => setIsMouseHoveringSettingsPanel(true), onMouseLeave: () => setIsMouseHoveringSettingsPanel(false) },
|
|
3575
|
+
return (React.createElement("div", { id: "settings-panel", style: {
|
|
3576
|
+
background: `rgba(${color.substring(4, color.length - 1)}, 0.4)`,
|
|
3577
|
+
height: `${SETTINGS_PANEL_BASE_HEIGHT}px`,
|
|
3578
|
+
}, className: "font-sans", onMouseEnter: () => setIsMouseHoveringSettingsPanel(true), onMouseLeave: () => setIsMouseHoveringSettingsPanel(false) },
|
|
3516
3579
|
React.createElement("div", { className: "settings-panel-section" },
|
|
3517
3580
|
React.createElement("div", { className: "settings-panel-section-title" },
|
|
3518
3581
|
React.createElement("span", null, translations?.layersDisplay.context || 'Context')),
|
|
@@ -3525,6 +3588,11 @@ const SettingsPanel = ({ globalHeight, color, store, setStore, setIsMouseHoverin
|
|
|
3525
3588
|
[selection]: !prev.layersDisplay[selection],
|
|
3526
3589
|
},
|
|
3527
3590
|
}));
|
|
3591
|
+
if (selection === 'electricalProfiles' ||
|
|
3592
|
+
selection === 'powerRestrictions' ||
|
|
3593
|
+
selection === 'speedLimitTags') {
|
|
3594
|
+
adjustHeightOnLayerChange(selection, store.layersDisplay[selection]);
|
|
3595
|
+
}
|
|
3528
3596
|
} }))))),
|
|
3529
3597
|
React.createElement("div", { className: "settings-panel-section right" },
|
|
3530
3598
|
React.createElement("div", { className: "settings-panel-section-title" },
|
|
@@ -3567,6 +3635,12 @@ const zoom = (setStore) => d3zoom
|
|
|
3567
3635
|
canvas.call(resetZoom);
|
|
3568
3636
|
}
|
|
3569
3637
|
});
|
|
3638
|
+
const computeLeftOffsetOnZoom = (value) => {
|
|
3639
|
+
const canvas = d3selection.select(FRONT_INTERACTIVITY_LAYER_ID);
|
|
3640
|
+
const transform = d3zoom.zoomIdentity.scale(value);
|
|
3641
|
+
d3zoom.zoom().transform(canvas, transform);
|
|
3642
|
+
return transform.x;
|
|
3643
|
+
};
|
|
3570
3644
|
|
|
3571
3645
|
const { MARGIN_LEFT: MARGIN_LEFT$6, MARGIN_RIGHT: MARGIN_RIGHT$5, MARGIN_TOP: MARGIN_TOP$5, MARGIN_BOTTOM: MARGIN_BOTTOM$6 } = MARGINS;
|
|
3572
3646
|
const STEP_HEIGHT = 6;
|
|
@@ -4162,8 +4236,7 @@ const drawCursor = ({ ctx, width, height, store }) => {
|
|
|
4162
4236
|
let reticleY = 0;
|
|
4163
4237
|
const maxSpeed = maxSpeedValue(store);
|
|
4164
4238
|
const maxPosition = maxPositionValue(store.speeds);
|
|
4165
|
-
const
|
|
4166
|
-
const cursorBoxHeight = heightWithoutLayers - MARGIN_BOTTOM$3 - MARGIN_TOP$2;
|
|
4239
|
+
const cursorBoxHeight = height - MARGIN_BOTTOM$3 - MARGIN_TOP$2;
|
|
4167
4240
|
const cursorBoxWidth = width - MARGIN_LEFT$3 - MARGIN_RIGHT$2;
|
|
4168
4241
|
const xPositionReference = (ref) => ref * ((cursorBoxWidth - CURVE_MARGIN_SIDES$1) / maxPosition) * ratioX +
|
|
4169
4242
|
leftOffset +
|
|
@@ -4321,15 +4394,14 @@ const drawCursor = ({ ctx, width, height, store }) => {
|
|
|
4321
4394
|
};
|
|
4322
4395
|
};
|
|
4323
4396
|
|
|
4324
|
-
const ReticleLayer = ({ width, height,
|
|
4397
|
+
const ReticleLayer = ({ width, internalHeight: height, store }) => {
|
|
4325
4398
|
const canvas = useRef(null);
|
|
4326
4399
|
const [trainDetails, setTrainDetails] = useState(null);
|
|
4327
|
-
const maxCursorHeight = getAdaptiveHeight(heightOffset, store.layersDisplay, false);
|
|
4328
4400
|
useEffect(() => {
|
|
4329
4401
|
const currentCanvas = canvas.current;
|
|
4330
4402
|
const ctx = currentCanvas.getContext('2d');
|
|
4331
4403
|
// The tooltip shouldn't be displayed when hovering on the linear layers
|
|
4332
|
-
if (store.cursor.y && store.cursor.y <
|
|
4404
|
+
if (store.cursor.y && store.cursor.y < height - MARGINS.MARGIN_TOP - MARGINS.MARGIN_BOTTOM) {
|
|
4333
4405
|
const detailsBox = drawCursor({ ctx, width, height, store });
|
|
4334
4406
|
setTrainDetails(detailsBox || null);
|
|
4335
4407
|
}
|
|
@@ -4337,7 +4409,7 @@ const ReticleLayer = ({ width, height, heightOffset, store }) => {
|
|
|
4337
4409
|
clearCanvas(ctx, width, height);
|
|
4338
4410
|
setTrainDetails(null);
|
|
4339
4411
|
}
|
|
4340
|
-
}, [width, height, store
|
|
4412
|
+
}, [width, height, store]);
|
|
4341
4413
|
return (React.createElement(React.Fragment, null,
|
|
4342
4414
|
React.createElement("canvas", { id: "cursor-layer", className: "absolute", ref: canvas, width: width, height: height }),
|
|
4343
4415
|
trainDetails && React.createElement(DetailsBox, { width: width, height: height, store: store, ...trainDetails })));
|
|
@@ -4788,9 +4860,37 @@ const SpeedSpaceChart = ({ width, height, backgroundColor, data, setHeight, tran
|
|
|
4788
4860
|
},
|
|
4789
4861
|
isSettingsPanelOpened: false,
|
|
4790
4862
|
});
|
|
4791
|
-
const {
|
|
4792
|
-
|
|
4793
|
-
|
|
4863
|
+
const { mainChartHeight, powerRestrictionsTop, speedLimitTagsTop, electricalProfileLayerHeight, interactivityLayerHeight, } = useMemo(() => {
|
|
4864
|
+
const _electricalProfilesOffset = store.layersDisplay.electricalProfiles
|
|
4865
|
+
? LINEAR_LAYERS_HEIGHTS.ELECTRICAL_PROFILES_HEIGHT
|
|
4866
|
+
: 0;
|
|
4867
|
+
const _powerRestrictionsOffset = store.layersDisplay.powerRestrictions
|
|
4868
|
+
? LINEAR_LAYERS_HEIGHTS.POWER_RESTRICTIONS_HEIGHT
|
|
4869
|
+
: 0;
|
|
4870
|
+
const _speedLimitTagsOffset = store.layersDisplay.speedLimitTags
|
|
4871
|
+
? LINEAR_LAYERS_HEIGHTS.SPEED_LIMIT_TAGS_HEIGHT
|
|
4872
|
+
: 0;
|
|
4873
|
+
// Height of the speedSpaceChart only (without the linear layers below) + top and bottom margins
|
|
4874
|
+
// TODO: remove the top and bottom margins from _mainChartHeight
|
|
4875
|
+
const _mainChartHeight = height - (_electricalProfilesOffset + _powerRestrictionsOffset + _speedLimitTagsOffset);
|
|
4876
|
+
const _baseLayerPosition = _mainChartHeight - MARGINS.MARGIN_BOTTOM;
|
|
4877
|
+
const _powerRestrictionsTop = _baseLayerPosition + _electricalProfilesOffset;
|
|
4878
|
+
const _speedLimitTagsTop = _powerRestrictionsTop + _powerRestrictionsOffset;
|
|
4879
|
+
const _interactivityLayerHeight = _mainChartHeight -
|
|
4880
|
+
MARGINS.MARGIN_BOTTOM -
|
|
4881
|
+
MARGINS.MARGIN_TOP +
|
|
4882
|
+
_electricalProfilesOffset +
|
|
4883
|
+
_powerRestrictionsOffset +
|
|
4884
|
+
_speedLimitTagsOffset;
|
|
4885
|
+
return {
|
|
4886
|
+
mainChartHeight: _mainChartHeight,
|
|
4887
|
+
powerRestrictionsTop: _powerRestrictionsTop,
|
|
4888
|
+
speedLimitTagsTop: _speedLimitTagsTop,
|
|
4889
|
+
electricalProfileLayerHeight: _mainChartHeight + LINEAR_LAYERS_HEIGHTS.ELECTRICAL_PROFILES_HEIGHT,
|
|
4890
|
+
interactivityLayerHeight: _interactivityLayerHeight,
|
|
4891
|
+
};
|
|
4892
|
+
}, [height, store.layersDisplay]);
|
|
4893
|
+
const { WIDTH_OFFSET, HEIGHT_OFFSET } = getGraphOffsets(width, mainChartHeight, store.layersDisplay.declivities);
|
|
4794
4894
|
const { OFFSET_RIGHT_AXIS } = MARGINS;
|
|
4795
4895
|
const adjustedWidthRightAxis = store.layersDisplay.declivities
|
|
4796
4896
|
? width - OFFSET_RIGHT_AXIS
|
|
@@ -4810,36 +4910,56 @@ const SpeedSpaceChart = ({ width, height, backgroundColor, data, setHeight, tran
|
|
|
4810
4910
|
isSettingsPanelOpened: true,
|
|
4811
4911
|
}));
|
|
4812
4912
|
};
|
|
4913
|
+
const adjustHeightOnLayerChange = useCallback((layerName, isCurrentlyActive) => {
|
|
4914
|
+
let adjustment;
|
|
4915
|
+
if (layerName === 'electricalProfiles') {
|
|
4916
|
+
adjustment = LINEAR_LAYERS_HEIGHTS.ELECTRICAL_PROFILES_HEIGHT;
|
|
4917
|
+
}
|
|
4918
|
+
else if (layerName === 'powerRestrictions') {
|
|
4919
|
+
adjustment = LINEAR_LAYERS_HEIGHTS.POWER_RESTRICTIONS_HEIGHT;
|
|
4920
|
+
}
|
|
4921
|
+
else {
|
|
4922
|
+
adjustment = LINEAR_LAYERS_HEIGHTS.SPEED_LIMIT_TAGS_HEIGHT;
|
|
4923
|
+
}
|
|
4924
|
+
setHeight((prevHeight) => prevHeight + (isCurrentlyActive ? -adjustment : adjustment));
|
|
4925
|
+
}, [setHeight]);
|
|
4813
4926
|
useEffect(() => {
|
|
4814
4927
|
setStore((prev) => ({
|
|
4815
4928
|
...prev,
|
|
4816
4929
|
...data,
|
|
4817
4930
|
}));
|
|
4818
4931
|
}, [data]);
|
|
4819
|
-
useEffect(() => {
|
|
4820
|
-
setHeight(dynamicHeight);
|
|
4821
|
-
}, [setHeight, dynamicHeight]);
|
|
4822
4932
|
return (React.createElement("div", { style: {
|
|
4823
4933
|
width: `${width}px`,
|
|
4824
|
-
height: `${
|
|
4934
|
+
height: `${height}px`,
|
|
4825
4935
|
backgroundColor: `${backgroundColor}`,
|
|
4936
|
+
position: 'relative',
|
|
4826
4937
|
}, tabIndex: 0 },
|
|
4938
|
+
React.createElement("div", { className: "speed-space-slider-container" },
|
|
4939
|
+
React.createElement(Slider, { className: "speed-space-slider", width: ZOOM_CONFIG.SLIDER_WIDTH, min: Math.log(ZOOM_CONFIG.MIN_RATIO) / Math.log(1.1), max: Math.log(ZOOM_CONFIG.MAX_RATIO) / Math.log(1.1), value: Math.log(store.ratioX) / Math.log(1.1), onChange: (e) => {
|
|
4940
|
+
const value = clamp(Math.pow(1.1, Number(e.target.value)), ZOOM_CONFIG.MIN_RATIO, ZOOM_CONFIG.MAX_RATIO);
|
|
4941
|
+
setStore((prev) => ({
|
|
4942
|
+
...prev,
|
|
4943
|
+
ratioX: value,
|
|
4944
|
+
leftOffset: computeLeftOffsetOnZoom(value),
|
|
4945
|
+
}));
|
|
4946
|
+
} })),
|
|
4827
4947
|
React.createElement("div", { className: "flex justify-end absolute base-margin-top", style: { width: adjustedWidthRightAxis } },
|
|
4828
4948
|
React.createElement(InteractionButtons, { reset: reset, openSettingsPanel: openSettingsPanel, store: store, testIdPrefix: "interaction" })),
|
|
4829
4949
|
store.isSettingsPanelOpened && (React.createElement("div", { className: "flex justify-end absolute ml-2 base-margin-top", style: { width: adjustedWidthRightAxis } },
|
|
4830
|
-
React.createElement(SettingsPanel, {
|
|
4950
|
+
React.createElement(SettingsPanel, { color: backgroundColor, store: store, setStore: setStore, setIsMouseHoveringSettingsPanel: setIsMouseHoveringSettingsPanel, translations: translations, testIdPrefix: "settings-panel", adjustHeightOnLayerChange: adjustHeightOnLayerChange }))),
|
|
4831
4951
|
store.layersDisplay.declivities && (React.createElement(DeclivityLayer, { width: WIDTH_OFFSET, height: HEIGHT_OFFSET, store: store })),
|
|
4832
4952
|
React.createElement(CurveLayer, { width: WIDTH_OFFSET, height: HEIGHT_OFFSET, store: store }),
|
|
4833
|
-
store.layersDisplay.speedLimits && (React.createElement(SpeedLimitsLayer, { width: adjustedWidthRightAxis, height:
|
|
4834
|
-
store.layersDisplay.steps && (React.createElement(StepsLayer, { width: adjustedWidthRightAxis, height:
|
|
4835
|
-
React.createElement(AxisLayerY, { width: width, height:
|
|
4836
|
-
store.layersDisplay.electricalProfiles && (React.createElement(ElectricalProfileLayer, { width: adjustedWidthRightAxis, height:
|
|
4837
|
-
store.layersDisplay.powerRestrictions && (React.createElement(PowerRestrictionsLayer, { width: adjustedWidthRightAxis, marginTop:
|
|
4838
|
-
store.layersDisplay.speedLimitTags && (React.createElement(SpeedLimitTagsLayer, { width: adjustedWidthRightAxis, marginTop:
|
|
4839
|
-
React.createElement(TickLayerX, { width: adjustedWidthRightAxis, height:
|
|
4840
|
-
store.layersDisplay.declivities && (React.createElement(TickLayerYRight, { width: width, height:
|
|
4841
|
-
!isMouseHoveringSettingsPanel && (React.createElement(ReticleLayer, { width: adjustedWidthRightAxis,
|
|
4842
|
-
React.createElement(FrontInteractivityLayer, { width: WIDTH_OFFSET, height:
|
|
4953
|
+
store.layersDisplay.speedLimits && (React.createElement(SpeedLimitsLayer, { width: adjustedWidthRightAxis, height: mainChartHeight, store: store })),
|
|
4954
|
+
store.layersDisplay.steps && (React.createElement(StepsLayer, { width: adjustedWidthRightAxis, height: mainChartHeight, store: store })),
|
|
4955
|
+
React.createElement(AxisLayerY, { width: width, height: mainChartHeight, store: store }),
|
|
4956
|
+
store.layersDisplay.electricalProfiles && (React.createElement(ElectricalProfileLayer, { width: adjustedWidthRightAxis, height: electricalProfileLayerHeight, store: store })),
|
|
4957
|
+
store.layersDisplay.powerRestrictions && (React.createElement(PowerRestrictionsLayer, { width: adjustedWidthRightAxis, marginTop: powerRestrictionsTop, store: store })),
|
|
4958
|
+
store.layersDisplay.speedLimitTags && (React.createElement(SpeedLimitTagsLayer, { width: adjustedWidthRightAxis, marginTop: speedLimitTagsTop, store: store })),
|
|
4959
|
+
React.createElement(TickLayerX, { width: adjustedWidthRightAxis, height: height, store: store }),
|
|
4960
|
+
store.layersDisplay.declivities && (React.createElement(TickLayerYRight, { width: width, height: mainChartHeight, store: store })),
|
|
4961
|
+
!isMouseHoveringSettingsPanel && (React.createElement(ReticleLayer, { width: adjustedWidthRightAxis, internalHeight: mainChartHeight, store: store })),
|
|
4962
|
+
React.createElement(FrontInteractivityLayer, { width: WIDTH_OFFSET, height: interactivityLayerHeight, store: store, setStore: setStore })));
|
|
4843
4963
|
};
|
|
4844
4964
|
|
|
4845
4965
|
const TRACK_HEIGHT_CONTAINER = 100;
|
|
@@ -5500,7 +5620,7 @@ const TrackOccupancyStandalone = ({ tracks, occupancyZones, selectedTrainId, onS
|
|
|
5500
5620
|
return (React.createElement("div", { className: "track-occupancy-standalone flex flex-col" },
|
|
5501
5621
|
React.createElement("div", { className: "bg-ambientB-5 flex flex-col justify-center main-container-header grow-0 shrink-0" },
|
|
5502
5622
|
React.createElement(KebabHorizontal, null)),
|
|
5503
|
-
React.createElement("div", { className: "manchette-space-time-chart-wrapper", style: { maxHeight: height } },
|
|
5623
|
+
React.createElement("div", { className: "ui-manchette-space-time-chart-wrapper", style: { maxHeight: height } },
|
|
5504
5624
|
React.createElement("div", { ref: manchetteWithSpaceTimeChartRef, className: "manchette flex h-100", onScroll: handleScroll, style: { height } },
|
|
5505
5625
|
React.createElement(Manchette, { ...manchetteProps }),
|
|
5506
5626
|
React.createElement("div", { className: "space-time-chart-container w-full sticky", ref: spaceTimeChartRef },
|
|
@@ -5517,5 +5637,5 @@ const TrackOccupancyStandalone = ({ tracks, occupancyZones, selectedTrainId, onS
|
|
|
5517
5637
|
}) }))))));
|
|
5518
5638
|
};
|
|
5519
5639
|
|
|
5520
|
-
export { BASE_WAYPOINT_HEIGHT, CANVAS_PADDING, COLORS, CanvasContext, ConflictLayer, ConflictTooltip, DEFAULT_LEVEL, DEFAULT_THEME, DEFAULT_ZOOM_MS_PER_PX, FONTS, MINUTES_TEXT_OFFSET, Manchette, ManchetteWithSpaceTimeChart, MouseContext, OCCUPANCY_ZONE_HEIGHT, OCCUPANCY_ZONE_Y_START, OccupancyBlockLayer, PathLayer, PatternRect, Quadrilateral, STATION_TEXT_OFFSET, SpaceTimeChart, SpaceTimeChartContext, SpeedSpaceChart, TICKS_PATTERN, TICKS_PRIORITIES, TRACK_HEIGHT_CONTAINER, TimeCaptions, Tooltip$1 as Tooltip, TrackOccupancyCanvas, TrackOccupancyManchette, TrackOccupancyStandalone, Waypoint as WaypointComponent, WorkScheduleLayer, ZoomRect, computeRectZoomOffsets, getCrispLineCoordinate, getSpaceAtTime, isConflictPickingElement, isInteractiveWaypoint, isOccupancyPickingElement, isPathOnScreen, isPointPickingElement, isSegmentPickingElement, positionKmToMm, positionMmToKm, timeScaleToZoomValue, useDraw, useManchetteWithSpaceTimeChart, usePaths, usePicking };
|
|
5640
|
+
export { BASE_WAYPOINT_HEIGHT, CANVAS_PADDING, COLORS, CanvasContext, ConflictLayer, ConflictTooltip, DEFAULT_LEVEL, DEFAULT_THEME, DEFAULT_ZOOM_MS_PER_PX, FONTS, MINUTES_TEXT_OFFSET, Manchette, ManchetteWithSpaceTimeChart, MouseContext, OCCUPANCY_ZONE_HEIGHT, OCCUPANCY_ZONE_Y_START, OccupancyBlockLayer, PathLayer, PatternRect, Quadrilateral, STATION_TEXT_OFFSET, SpaceTimeChart, SpaceTimeChartContext, SpeedSpaceChart, TICKS_PATTERN, TICKS_PRIORITIES, TRACK_HEIGHT_CONTAINER, TimeCaptions, Tooltip$1 as Tooltip, TrackOccupancyCanvas, TrackOccupancyManchette, TrackOccupancyStandalone, Waypoint as WaypointComponent, WorkScheduleLayer, ZoomRect, computeRectZoomOffsets, getCrispLineCoordinate, getSpaceAtTime, isConflictPickingElement, isInteractiveWaypoint, isOccupancyPickingElement, isPathOnScreen, isPointPickingElement, isQuadrilaterPickingElement, isSegmentPickingElement, positionKmToMm, positionMmToKm, timeScaleToZoomValue, useDraw, useManchetteWithSpaceTimeChart, usePaths, usePicking };
|
|
5521
5641
|
//# sourceMappingURL=index.esm.js.map
|