StateTimeline: Fix bug with state labels using stale y position cache during panel resize (#88818)

* StateTimeline: Check for change in height

* probably it!

---------

Co-authored-by: Leon Sorokin <leeoniya@gmail.com>
This commit is contained in:
Drew Slobodnjak 2024-06-07 09:12:25 -07:00 committed by GitHub
parent ebe42e1ada
commit 694499ae6d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -311,7 +311,7 @@ export function getConfig(opts: TimelineCoreOptions) {
let discrete = isDiscrete(sidx);
let mappedNull = discrete && hasMappedNull(sidx);
let y = round(yOff + yMids[sidx - 1]);
let y = round(valToPosY(ySplits[sidx - 1], scaleY, yDim, yOff));
for (let ix = 0; ix < dataY.length; ix++) {
if (dataY[ix] != null || mappedNull) {
@ -447,7 +447,6 @@ export function getConfig(opts: TimelineCoreOptions) {
},
};
const yMids: number[] = Array(numSeries).fill(0);
const ySplits: number[] = Array(numSeries).fill(0);
const yRange: uPlot.Range.MinMax = [0, 1];
@ -502,8 +501,8 @@ export function getConfig(opts: TimelineCoreOptions) {
ySplits: (u: uPlot) => {
walk(rowHeight, null, numSeries, u.bbox.height, (iy, y0, hgt) => {
// vertical midpoints of each series' timeline (stored relative to .u-over)
yMids[iy] = round(y0 + hgt / 2);
ySplits[iy] = u.posToVal(yMids[iy] / uPlot.pxRatio, FIXED_UNIT);
let yMid = round(y0 + hgt / 2);
ySplits[iy] = u.posToVal(yMid / uPlot.pxRatio, FIXED_UNIT);
});
return ySplits;