Skip to content

Commit

Permalink
fix(coordinate): layout (#5447)
Browse files Browse the repository at this point in the history
  • Loading branch information
pearmini authored Aug 23, 2023
1 parent c98e176 commit 9607f1d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
8 changes: 3 additions & 5 deletions src/runtime/coordinate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ export function createCoordinate(
insetTop,
insetRight,
insetBottom,
marginLeft,
marginTop,
} = layout;
const { coordinates: partialTransform = [] } = partialOptions;
const transform = inferCoordinate(partialTransform);
Expand All @@ -32,11 +30,11 @@ export function createCoordinate(
// @todo Find a better solution.
// Store more layout information for component.
...layout,
x: insetLeft + marginLeft,
y: insetTop + marginTop,
x: insetLeft,
y: insetTop,
width: innerWidth - insetLeft - insetRight,
height: innerHeight - insetBottom - insetTop,
transformations: transform.map(useCoordinate).flat(),
transformations: transform.flatMap(useCoordinate),
};

const coordinate = isCartesian3D
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/plot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1560,8 +1560,8 @@ async function applyTransform<T extends G2ViewTree>(

function updateBBox(selection: Selection) {
selection
.style('x', (d) => d.paddingLeft)
.style('y', (d) => d.paddingTop)
.style('x', (d) => d.paddingLeft + d.marginLeft)
.style('y', (d) => d.paddingTop + d.marginTop)
.style('width', (d) => d.innerWidth)
.style('height', (d) => d.innerHeight);
}
Expand Down

0 comments on commit 9607f1d

Please sign in to comment.