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 #307 from FormidableLabs/default-classname
Browse files Browse the repository at this point in the history
add default class name, fix bug
  • Loading branch information
boygirl authored Oct 3, 2017
2 parents e019de3 + fea1971 commit 97bbfe2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
5 changes: 3 additions & 2 deletions src/victory-container/victory-container.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export default class VictoryContainer extends React.Component {
}

static defaultProps = {
className: "VictoryContainer",
portalComponent: <Portal/>,
portalZIndex: 99,
responsive: true
Expand Down Expand Up @@ -101,7 +102,7 @@ export default class VictoryContainer extends React.Component {
const { title, desc, portalComponent, className, width, height, portalZIndex } = props;
const children = this.getChildren(props);
const divStyle = { pointerEvents: "none", touchAction: "none", position: "relative" };
const svgStyle = { width: "100%", height: "100%", top: 0, left: 0 };
const svgStyle = { width: "100%", height: "100%" };
const portalProps = {
width, height, viewBox: svgProps.viewBox, style: assign({}, svgStyle, { overflow: "visible" })
};
Expand All @@ -112,7 +113,7 @@ export default class VictoryContainer extends React.Component {
{desc ? <desc id={this.getIdForElement("desc")}>{desc}</desc> : null}
{children}
</svg>
<div style={{ ...svgStyle, zIndex: portalZIndex, position: "absolute" }}>
<div style={{ ...svgStyle, zIndex: portalZIndex, position: "absolute", top: 0, left: 0 }}>
{React.cloneElement(portalComponent, { ...portalProps, ref: this.savePortalRef })}
</div>
</div>
Expand Down
13 changes: 7 additions & 6 deletions src/victory-util/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@ import React from "react";
export default {
getPoint(datum) {
const exists = (val) => val !== undefined;
const { x, _x, _x1, _x0, _voronoiX, y, _y, _y1, _y0, _voronoiY } = datum;
const defaultX = exists(_x1) ? _x1 : _x || x;
const defaultY = exists(_y1) ? _y1 : _y || y;
return {
const { _x, _x1, _x0, _voronoiX, _y, _y1, _y0, _voronoiY } = datum;
const defaultX = exists(_x1) ? _x1 : _x;
const defaultY = exists(_y1) ? _y1 : _y;
const point = {
x: exists(_voronoiX) ? _voronoiX : defaultX,
x0: exists(_x0) ? _x0 : _x || x,
x0: exists(_x0) ? _x0 : _x,
y: exists(_voronoiY) ? _voronoiY : defaultY,
y0: exists(_y0) ? _y0 : _y || y
y0: exists(_y0) ? _y0 : _y
};
return defaults({}, point, datum);
},

scalePoint(props, datum) {
Expand Down

0 comments on commit 97bbfe2

Please sign in to comment.