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

Commit

Permalink
Merge pull request #306 from FormidableLabs/alternative-positioning
Browse files Browse the repository at this point in the history
positioning experiment
  • Loading branch information
boygirl authored Oct 2, 2017
2 parents b506bf4 + dbb5ea3 commit 300bd8e
Showing 1 changed file with 3 additions and 5 deletions.
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

0 comments on commit 300bd8e

Please sign in to comment.