From 57d0a64b2c0c578e3d1bd29fc9b8f55bcb9e8a7e Mon Sep 17 00:00:00 2001 From: bees Date: Wed, 15 Aug 2018 16:05:56 -0500 Subject: [PATCH 1/6] fix conditional statment, add check for brush area --- packages/victory-brush-container/src/brush-helpers.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/victory-brush-container/src/brush-helpers.js b/packages/victory-brush-container/src/brush-helpers.js index 84a0ffde0..75fa5bef8 100644 --- a/packages/victory-brush-container/src/brush-helpers.js +++ b/packages/victory-brush-container/src/brush-helpers.js @@ -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 }; From 6783e39baaaea63756e7ab0388d38a69169a5783 Mon Sep 17 00:00:00 2001 From: boygirl Date: Sat, 18 Aug 2018 19:33:43 -0700 Subject: [PATCH 2/6] fix trailing zero bug in transforms --- packages/victory-core/src/victory-util/style.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/victory-core/src/victory-util/style.js b/packages/victory-core/src/victory-util/style.js index 196a4eba7..863092d48 100644 --- a/packages/victory-core/src/victory-util/style.js +++ b/packages/victory-core/src/victory-util/style.js @@ -1,4 +1,4 @@ - +import { isPlainObject } from "lodash"; /** * 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 @@ -14,7 +14,7 @@ const toTransformString = function (obj, ...more) { return [memo, toTransformString(currentObj)].join(" "); }, toTransformString(obj)); } else { - if (!obj || typeof obj === "string") { + if (obj === undefined || typeof obj === "string") { return obj; } const transforms = []; From 00a466d6421dbbec0aabd52178f0472e1f6c2fb6 Mon Sep 17 00:00:00 2001 From: boygirl Date: Sat, 18 Aug 2018 19:51:40 -0700 Subject: [PATCH 3/6] trim transform strings --- packages/victory-core/src/victory-util/style.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/victory-core/src/victory-util/style.js b/packages/victory-core/src/victory-util/style.js index 863092d48..7e94e48a1 100644 --- a/packages/victory-core/src/victory-util/style.js +++ b/packages/victory-core/src/victory-util/style.js @@ -12,9 +12,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 === undefined || typeof obj === "string") { + if (obj === undefined || obj === null || typeof obj === "string") { return obj; } const transforms = []; @@ -24,7 +24,7 @@ const toTransformString = function (obj, ...more) { transforms.push(`${key}(${value})`); } } - return transforms.join(" "); + return transforms.join(" ").trim(); } }; From c5f3f128b26c37c86931d843bf5eed06029b8e6e Mon Sep 17 00:00:00 2001 From: boygirl Date: Sat, 18 Aug 2018 19:51:54 -0700 Subject: [PATCH 4/6] more specific test --- test/client/spec/victory-core/victory-util/style.spec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/client/spec/victory-core/victory-util/style.spec.js b/test/client/spec/victory-core/victory-util/style.spec.js index 356349a6d..6d86f397b 100644 --- a/test/client/spec/victory-core/victory-util/style.spec.js +++ b/test/client/spec/victory-core/victory-util/style.spec.js @@ -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)"); }); }); From 2566775b434247706d38316429e8136438e7aa0c Mon Sep 17 00:00:00 2001 From: boygirl Date: Sat, 18 Aug 2018 19:53:28 -0700 Subject: [PATCH 5/6] clean up demo --- demo/components/victory-label-demo.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/demo/components/victory-label-demo.js b/demo/components/victory-label-demo.js index 8c8b1bf80..0526cb92e 100644 --- a/demo/components/victory-label-demo.js +++ b/demo/components/victory-label-demo.js @@ -13,6 +13,7 @@ export default class App extends React.Component { @@ -104,7 +105,7 @@ export default class App extends React.Component { {/** From 0bf6f9c7ceabddba44afe3f52735a51cf2deae20 Mon Sep 17 00:00:00 2001 From: boygirl Date: Sat, 18 Aug 2018 19:54:28 -0700 Subject: [PATCH 6/6] lint --- packages/victory-core/src/victory-util/style.js | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/victory-core/src/victory-util/style.js b/packages/victory-core/src/victory-util/style.js index 7e94e48a1..f3f8a431c 100644 --- a/packages/victory-core/src/victory-util/style.js +++ b/packages/victory-core/src/victory-util/style.js @@ -1,4 +1,3 @@ -import { isPlainObject } from "lodash"; /** * 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