victory-selection-container
Advanced tools
Comparing version 31.2.0 to 32.0.0
@@ -22,2 +22,12 @@ import _includes from "lodash/includes"; | ||
var SelectionHelpers = { | ||
getDimension: function (props) { | ||
var horizontal = props.horizontal, | ||
selectionDimension = props.selectionDimension; | ||
if (!horizontal || !selectionDimension) { | ||
return selectionDimension; | ||
} | ||
return selectionDimension === "x" ? "y" : "x"; | ||
}, | ||
getDatasets: function (props) { | ||
@@ -74,19 +84,3 @@ if (props.data) { | ||
}, | ||
getPoint: function (props, point) { | ||
if (!props.horizontal) { | ||
return point; | ||
} | ||
return { | ||
_x: point._y, | ||
_y: point._x, | ||
_x1: point._y1, | ||
_y1: point._x1, | ||
_x0: point._y0, | ||
_y0: point._x0 | ||
}; | ||
}, | ||
getSelectedData: function (props, dataset) { | ||
var _this2 = this; | ||
var x1 = props.x1, | ||
@@ -98,5 +92,3 @@ y1 = props.y1, | ||
var withinBounds = function (d) { | ||
var point = _this2.getPoint(props, d); | ||
var scaledPoint = Helpers.scalePoint(props, point); | ||
var scaledPoint = Helpers.scalePoint(props, d); | ||
return scaledPoint.x >= Math.min(x1, x2) && scaledPoint.x <= Math.max(x1, x2) && scaledPoint.y >= Math.min(y1, y2) && scaledPoint.y <= Math.max(y1, y2); | ||
@@ -136,3 +128,3 @@ }; | ||
var dimension = targetProps.selectionDimension; | ||
var dimension = this.getDimension(targetProps); | ||
var parentSVG = targetProps.parentSVG || Selection.getParentSVG(evt); | ||
@@ -183,3 +175,3 @@ | ||
polar = targetProps.polar; | ||
var dimension = targetProps.selectionDimension; | ||
var dimension = this.getDimension(targetProps); | ||
@@ -186,0 +178,0 @@ if (!allowSelection || !select) { |
@@ -37,2 +37,12 @@ "use strict"; | ||
var SelectionHelpers = { | ||
getDimension: function (props) { | ||
var horizontal = props.horizontal, | ||
selectionDimension = props.selectionDimension; | ||
if (!horizontal || !selectionDimension) { | ||
return selectionDimension; | ||
} | ||
return selectionDimension === "x" ? "y" : "x"; | ||
}, | ||
getDatasets: function (props) { | ||
@@ -90,19 +100,3 @@ if (props.data) { | ||
}, | ||
getPoint: function (props, point) { | ||
if (!props.horizontal) { | ||
return point; | ||
} | ||
return { | ||
_x: point._y, | ||
_y: point._x, | ||
_x1: point._y1, | ||
_y1: point._x1, | ||
_x0: point._y0, | ||
_y0: point._x0 | ||
}; | ||
}, | ||
getSelectedData: function (props, dataset) { | ||
var _this2 = this; | ||
var x1 = props.x1, | ||
@@ -114,6 +108,4 @@ y1 = props.y1, | ||
var withinBounds = function (d) { | ||
var point = _this2.getPoint(props, d); | ||
var scaledPoint = _victoryCore.Helpers.scalePoint(props, d); | ||
var scaledPoint = _victoryCore.Helpers.scalePoint(props, point); | ||
return scaledPoint.x >= Math.min(x1, x2) && scaledPoint.x <= Math.max(x1, x2) && scaledPoint.y >= Math.min(y1, y2) && scaledPoint.y <= Math.max(y1, y2); | ||
@@ -153,3 +145,3 @@ }; | ||
var dimension = targetProps.selectionDimension; | ||
var dimension = this.getDimension(targetProps); | ||
@@ -201,3 +193,3 @@ var parentSVG = targetProps.parentSVG || _victoryCore.Selection.getParentSVG(evt); | ||
polar = targetProps.polar; | ||
var dimension = targetProps.selectionDimension; | ||
var dimension = this.getDimension(targetProps); | ||
@@ -204,0 +196,0 @@ if (!allowSelection || !select) { |
{ | ||
"name": "victory-selection-container", | ||
"version": "31.2.0", | ||
"version": "32.0.0", | ||
"description": "Interactive Selection Component for Victory", | ||
@@ -24,3 +24,3 @@ "keywords": [ | ||
"prop-types": "^15.5.8", | ||
"victory-core": "^31.2.0" | ||
"victory-core": "^32.0.0" | ||
}, | ||
@@ -27,0 +27,0 @@ "scripts": { |
@@ -6,2 +6,10 @@ import { Selection, Data, Helpers } from "victory-core"; | ||
const SelectionHelpers = { | ||
getDimension(props) { | ||
const { horizontal, selectionDimension } = props; | ||
if (!horizontal || !selectionDimension) { | ||
return selectionDimension; | ||
} | ||
return selectionDimension === "x" ? "y" : "x"; | ||
}, | ||
getDatasets(props) { | ||
@@ -48,21 +56,6 @@ if (props.data) { | ||
getPoint(props, point) { | ||
if (!props.horizontal) { | ||
return point; | ||
} | ||
return { | ||
_x: point._y, | ||
_y: point._x, | ||
_x1: point._y1, | ||
_y1: point._x1, | ||
_x0: point._y0, | ||
_y0: point._x0 | ||
}; | ||
}, | ||
getSelectedData(props, dataset) { | ||
const { x1, y1, x2, y2 } = props; | ||
const withinBounds = (d) => { | ||
const point = this.getPoint(props, d); | ||
const scaledPoint = Helpers.scalePoint(props, point); | ||
const scaledPoint = Helpers.scalePoint(props, d); | ||
return ( | ||
@@ -96,3 +89,3 @@ scaledPoint.x >= Math.min(x1, x2) && | ||
} | ||
const dimension = targetProps.selectionDimension; | ||
const dimension = this.getDimension(targetProps); | ||
const parentSVG = targetProps.parentSVG || Selection.getParentSVG(evt); | ||
@@ -127,3 +120,3 @@ const { x, y } = Selection.getSVGEventCoordinates(evt, parentSVG); | ||
const { allowSelection, select, polar } = targetProps; | ||
const dimension = targetProps.selectionDimension; | ||
const dimension = this.getDimension(targetProps); | ||
if (!allowSelection || !select) { | ||
@@ -130,0 +123,0 @@ return null; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1183515
21636
+ Addedvictory-core@32.3.7(transitive)
- Removedvictory-core@31.2.0(transitive)
Updatedvictory-core@^32.0.0