Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(coordinate): layout #5447

Merged
merged 1 commit into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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