victory-selection-container
Advanced tools
Comparing version 35.8.1 to 35.9.0
{ | ||
"name": "victory-selection-container", | ||
"version": "35.8.1", | ||
"version": "35.9.0", | ||
"description": "Interactive Selection Component for Victory", | ||
@@ -24,3 +24,3 @@ "keywords": [ | ||
"prop-types": "^15.5.8", | ||
"victory-core": "^35.8.1" | ||
"victory-core": "^35.9.0" | ||
}, | ||
@@ -27,0 +27,0 @@ "scripts": { |
@@ -37,3 +37,7 @@ import { Selection, Data, Helpers } from "victory-core"; | ||
}; | ||
return Helpers.reduceChildren(React.Children.toArray(props.children), iteratee, props); | ||
return Helpers.reduceChildren( | ||
React.Children.toArray(props.children), | ||
iteratee, | ||
props | ||
); | ||
}, | ||
@@ -84,3 +88,4 @@ | ||
evt.preventDefault(); | ||
const { activateSelectedData, allowSelection, polar, selectedData } = targetProps; | ||
const { activateSelectedData, allowSelection, polar, selectedData } = | ||
targetProps; | ||
if (!allowSelection) { | ||
@@ -92,6 +97,18 @@ return {}; | ||
const { x, y } = Selection.getSVGEventCoordinates(evt, parentSVG); | ||
const x1 = polar || dimension !== "y" ? x : Selection.getDomainCoordinates(targetProps).x[0]; | ||
const y1 = polar || dimension !== "x" ? y : Selection.getDomainCoordinates(targetProps).y[0]; | ||
const x2 = polar || dimension !== "y" ? x : Selection.getDomainCoordinates(targetProps).x[1]; | ||
const y2 = polar || dimension !== "x" ? y : Selection.getDomainCoordinates(targetProps).y[1]; | ||
const x1 = | ||
polar || dimension !== "y" | ||
? x | ||
: Selection.getDomainCoordinates(targetProps).x[0]; | ||
const y1 = | ||
polar || dimension !== "x" | ||
? y | ||
: Selection.getDomainCoordinates(targetProps).y[0]; | ||
const x2 = | ||
polar || dimension !== "y" | ||
? x | ||
: Selection.getDomainCoordinates(targetProps).x[1]; | ||
const y2 = | ||
polar || dimension !== "x" | ||
? y | ||
: Selection.getDomainCoordinates(targetProps).y[1]; | ||
@@ -126,4 +143,10 @@ const mutatedProps = { x1, y1, select: true, x2, y2, parentSVG }; | ||
const { x, y } = Selection.getSVGEventCoordinates(evt, parentSVG); | ||
const x2 = polar || dimension !== "y" ? x : Selection.getDomainCoordinates(targetProps).x[1]; | ||
const y2 = polar || dimension !== "x" ? y : Selection.getDomainCoordinates(targetProps).y[1]; | ||
const x2 = | ||
polar || dimension !== "y" | ||
? x | ||
: Selection.getDomainCoordinates(targetProps).x[1]; | ||
const y2 = | ||
polar || dimension !== "x" | ||
? y | ||
: Selection.getDomainCoordinates(targetProps).y[1]; | ||
return { | ||
@@ -167,3 +190,7 @@ target: "parent", | ||
selectedData && isFunction(targetProps.onSelection) | ||
? targetProps.onSelection(selectedData, bounds, defaults({}, mutatedProps, targetProps)) | ||
? targetProps.onSelection( | ||
selectedData, | ||
bounds, | ||
defaults({}, mutatedProps, targetProps) | ||
) | ||
: {}; | ||
@@ -170,0 +197,0 @@ const parentMutation = [ |
@@ -39,18 +39,30 @@ import PropTypes from "prop-types"; | ||
onMouseDown: (evt, targetProps) => { | ||
return props.disable ? {} : SelectionHelpers.onMouseDown(evt, targetProps); | ||
return props.disable | ||
? {} | ||
: SelectionHelpers.onMouseDown(evt, targetProps); | ||
}, | ||
onTouchStart: (evt, targetProps) => { | ||
return props.disable ? {} : SelectionHelpers.onMouseDown(evt, targetProps); | ||
return props.disable | ||
? {} | ||
: SelectionHelpers.onMouseDown(evt, targetProps); | ||
}, | ||
onMouseMove: (evt, targetProps) => { | ||
return props.disable ? {} : SelectionHelpers.onMouseMove(evt, targetProps); | ||
return props.disable | ||
? {} | ||
: SelectionHelpers.onMouseMove(evt, targetProps); | ||
}, | ||
onTouchMove: (evt, targetProps) => { | ||
return props.disable ? {} : SelectionHelpers.onMouseMove(evt, targetProps); | ||
return props.disable | ||
? {} | ||
: SelectionHelpers.onMouseMove(evt, targetProps); | ||
}, | ||
onMouseUp: (evt, targetProps) => { | ||
return props.disable ? {} : SelectionHelpers.onMouseUp(evt, targetProps); | ||
return props.disable | ||
? {} | ||
: SelectionHelpers.onMouseUp(evt, targetProps); | ||
}, | ||
onTouchEnd: (evt, targetProps) => { | ||
return props.disable ? {} : SelectionHelpers.onMouseUp(evt, targetProps); | ||
return props.disable | ||
? {} | ||
: SelectionHelpers.onMouseUp(evt, targetProps); | ||
} | ||
@@ -63,3 +75,4 @@ } | ||
getRect(props) { | ||
const { x1, x2, y1, y2, selectionStyle, selectionComponent, name } = props; | ||
const { x1, x2, y1, y2, selectionStyle, selectionComponent, name } = | ||
props; | ||
const width = Math.abs(x2 - x1) || 1; | ||
@@ -66,0 +79,0 @@ const height = Math.abs(y2 - y1) || 1; |
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
1221327
22251
Updatedvictory-core@^35.9.0