Skip to content

Commit

Permalink
Update search trace format
Browse files Browse the repository at this point in the history
  • Loading branch information
spaaaacccee committed Oct 25, 2023
1 parent 2d8a6e3 commit 8b59272
Show file tree
Hide file tree
Showing 25 changed files with 711,515 additions and 8 deletions.
24 changes: 16 additions & 8 deletions client/src/components/layer-editor/layers/traceLayerSource.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,8 @@ function use2DPath(layer?: TraceLayer, step: number = 0) {

const { x, y } = pivot;

const pivotX = x ? parseString(x) : (c: Partial<TraceEvent>) => c.x;
const pivotY = y ? parseString(y) : (c: Partial<TraceEvent>) => c.y;
const pivotX = x ? parseString(x) : (c: Partial<TraceEvent>) => c.event.x;
const pivotY = y ? parseString(y) : (c: Partial<TraceEvent>) => c.event.y;

const events = map(
getPath(step),
Expand All @@ -280,25 +280,33 @@ function use2DPath(layer?: TraceLayer, step: number = 0) {
const primitive = [
{
$: "rect",
x: pivotX({ x: 0, y: 0, ...head(events) }) - (2 * scale) / 2,
y: pivotY({ x: 0, y: 0, ...head(events) }) - (2 * scale) / 2,
x:
pivotX({ event: { x: 0, y: 0, ...head(events) } }) -
(2 * scale) / 2,
y:
pivotY({ event: { x: 0, y: 0, ...head(events) } }) -
(2 * scale) / 2,
fill: getColorHex("destination"),
width: 2 * scale,
height: 2 * scale,
},
{
$: "rect",
x: pivotX({ x: 0, y: 0, ...last(events) }) - (2 * scale) / 2,
y: pivotY({ x: 0, y: 0, ...last(events) }) - (2 * scale) / 2,
x:
pivotX({ event: { x: 0, y: 0, ...last(events) } }) -
(2 * scale) / 2,
y:
pivotY({ event: { x: 0, y: 0, ...last(events) } }) -
(2 * scale) / 2,
fill: getColorHex("source"),
width: 2 * scale,
height: 2 * scale,
},
{
$: "path",
points: events.map((c) => ({
x: pivotX({ x: 0, y: 0, ...c }),
y: pivotY({ x: 0, y: 0, ...c }),
x: pivotX({ event: { x: 0, y: 0, ...c } }),
y: pivotY({ event: { x: 0, y: 0, ...c } }),
})),
fill: palette.primary.main,
alpha: 1,
Expand Down
Loading

0 comments on commit 8b59272

Please sign in to comment.