Skip to content
This repository has been archived by the owner on Feb 19, 2022. It is now read-only.

positioning experiment #306

Merged
merged 1 commit into from
Oct 2, 2017
Merged
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/victory-container/victory-container.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,8 @@ export default class VictoryContainer extends React.Component {
renderContainer(props, svgProps, style) {
const { title, desc, portalComponent, className, width, height, portalZIndex } = props;
const children = this.getChildren(props);
const divStyle = { pointerEvents: "none", touchAction: "none" };
const svgStyle = { width: "100%", height: "100%" };
//eslint-disable-next-line no-magic-numbers
const marginTop = `-${Math.round(100 * height / width)}%`;
const divStyle = { pointerEvents: "none", touchAction: "none", position: "relative" };
const svgStyle = { width: "100%", height: "100%", top: 0, left: 0 };
const portalProps = {
width, height, viewBox: svgProps.viewBox, style: assign({}, svgStyle, { overflow: "visible" })
};
Expand All @@ -114,7 +112,7 @@ export default class VictoryContainer extends React.Component {
{desc ? <desc id={this.getIdForElement("desc")}>{desc}</desc> : null}
{children}
</svg>
<div style={{ ...divStyle, zIndex: portalZIndex, position: "relative", marginTop }}>
<div style={{ ...svgStyle, zIndex: portalZIndex, position: "absolute" }}>
{React.cloneElement(portalComponent, { ...portalProps, ref: this.savePortalRef })}
</div>
</div>
Expand Down