Skip to content

Commit

Permalink
ref: omit offset for spans that dont span the width of the trace (#76304
Browse files Browse the repository at this point in the history
)

This improves the offset check by ensuring we dont offset very wide
spans (as they will be visible anyways)
  • Loading branch information
JonasBa authored Aug 28, 2024
1 parent e2ff918 commit 4eab7c4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,7 @@ describe('VirtualizedViewManger', () => {
manager.view.setTraceSpace([0, 0, 100, 1]);
manager.view.setTracePhysicalSpace([0, 0, 1000, 1], [0, 0, 1000, 1]);

expect(manager.computeSpanCSSMatrixTransform([0, 100])).toEqual([
1, 0, 0, 1, -2, 0,
]);
expect(manager.computeSpanCSSMatrixTransform([0, 100])).toEqual([1, 0, 0, 1, 0, 0]);
});

it('computes x position correctly', () => {
Expand All @@ -194,7 +192,7 @@ describe('VirtualizedViewManger', () => {
manager.view.setTracePhysicalSpace([0, 0, 1000, 1], [0, 0, 1000, 1]);

expect(manager.computeSpanCSSMatrixTransform([50, 1000])).toEqual([
1, 0, 0, 1, 48, 0,
1, 0, 0, 1, 50, 0,
]);
});

Expand All @@ -212,7 +210,7 @@ describe('VirtualizedViewManger', () => {
manager.view.setTracePhysicalSpace([0, 0, 1000, 1], [0, 0, 1000, 1]);

expect(manager.computeSpanCSSMatrixTransform([50, 1000])).toEqual([
1, 0, 0, 1, 48, 0,
1, 0, 0, 1, 50, 0,
]);
});

Expand All @@ -231,7 +229,7 @@ describe('VirtualizedViewManger', () => {
manager.view.setTracePhysicalSpace([0, 0, 1000, 1], [0, 0, 1000, 1]);

expect(manager.computeSpanCSSMatrixTransform([100, 100])).toEqual([
1, 0, 0, 1, -2, 0,
1, 0, 0, 1, 0, 0,
]);
});
it('computes x position correctly when view is offset', () => {
Expand All @@ -248,7 +246,7 @@ describe('VirtualizedViewManger', () => {
manager.view.setTracePhysicalSpace([0, 0, 1000, 1], [0, 0, 1000, 1]);

expect(manager.computeSpanCSSMatrixTransform([100, 100])).toEqual([
1, 0, 0, 1, -2, 0,
1, 0, 0, 1, 0, 0,
]);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -882,9 +882,10 @@ export class VirtualizedViewManager {

// if span ends less than 1px before the end of the view, we move it back by 1px and prevent it from being clipped
if (
space[0] - this.view.to_origin > this.view.trace_space.width / 2 &&
(this.view.to_origin + this.view.trace_space.width - space[0] - space[1]) /
this.span_to_px[0] <=
1
1
) {
// 1px for the span and 1px for the border
this.span_matrix[4] = this.span_matrix[4] - 2;
Expand Down

0 comments on commit 4eab7c4

Please sign in to comment.