Skip to content

Commit

Permalink
merge master
Browse files Browse the repository at this point in the history
  • Loading branch information
boygirl committed Aug 19, 2018
2 parents ff8db09 + 30b50d3 commit a8ad448
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions demo/components/victory-label-demo.js
Expand Up @@ -13,7 +13,7 @@ export default class App extends React.Component {

<circle cx="0" cy="0" r="2" fill="red"/>
<VictoryLabel
style={{ direction: "ltr" }}
transform="translate(50)"
x={0} y={0}
text={"Victory is awesome.\nThis is default anchoring.\nسلام?"}
/>
Expand Down Expand Up @@ -101,7 +101,7 @@ export default class App extends React.Component {
<VictoryLabel x={0} y={1800} textAnchor="start" verticalAnchor="start"
text={["Use", "dx", "attribute", "to", "shift", "labels", "relative to one another."]}
inline
dx={"10"}
dx={10}
/>

{/**
Expand Down
5 changes: 3 additions & 2 deletions packages/victory-brush-container/src/brush-helpers.js
Expand Up @@ -246,8 +246,9 @@ const Helpers = {
const {
x1, y1, x2, y2, onBrushDomainChange, onBrushCleared, domain, allowResize, defaultBrushArea
} = targetProps;
// if the mouse hasn't moved since a mouseDown event, select the whole domain region
if (allowResize && x1 === x2 || y1 === y2) {
// if the mouse hasn't moved since a mouseDown event, select the default brush area
const defaultBrushHasArea = defaultBrushArea !== undefined && defaultBrushArea !== "none";
if ((allowResize || defaultBrushHasArea) && (x1 === x2 || y1 === y2)) {
const cachedDomain = targetProps.cachedCurrentDomain || targetProps.currentDomain;
const currentDomain = this.getDefaultBrushArea(defaultBrushArea, domain, cachedDomain);
const mutatedProps = { isPanning: false, isSelecting: false, currentDomain };
Expand Down
7 changes: 3 additions & 4 deletions packages/victory-core/src/victory-util/style.js
@@ -1,4 +1,3 @@

/**
* Given an object with CSS/SVG transform definitions, return the string value
* for use with the `transform` CSS property or SVG attribute. Note that we
Expand All @@ -12,9 +11,9 @@ const toTransformString = function (obj, ...more) {
if (more.length > 0) {
return more.reduce((memo, currentObj) => {
return [memo, toTransformString(currentObj)].join(" ");
}, toTransformString(obj));
}, toTransformString(obj)).trim();
} else {
if (!obj || typeof obj === "string") {
if (obj === undefined || obj === null || typeof obj === "string") {
return obj;
}
const transforms = [];
Expand All @@ -24,7 +23,7 @@ const toTransformString = function (obj, ...more) {
transforms.push(`${key}(${value})`);
}
}
return transforms.join(" ");
return transforms.join(" ").trim();
}
};

Expand Down
4 changes: 2 additions & 2 deletions test/client/spec/victory-core/victory-util/style.spec.js
Expand Up @@ -19,7 +19,7 @@ describe("toTransformString", () => {

it("returns at least the subsequent transforms if the first is undefined", () => {
expect(Style.toTransformString(
null, { skewY: [65] }
)).to.contain("skewY(65)");
undefined, { skewY: [65] }
)).to.equal("skewY(65)");
});
});

0 comments on commit a8ad448

Please sign in to comment.