Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

victory-brush-line

Package Overview
Dependencies
Maintainers
2
Versions
144
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

victory-brush-line - npm Package Compare versions

Comparing version 31.1.0 to 31.2.0

31

es/victory-brush-line.js

@@ -30,2 +30,3 @@ import _pick from "lodash/pick";

import isEqual from "react-fast-compare";
var SMALL_NUMBER = 1 / Number.MAX_SAFE_INTEGER;

@@ -70,5 +71,21 @@ var getScale = function (props) {

var withinBound = function (value, bound) {
return value >= Math.min.apply(Math, _toConsumableArray(bound)) && value <= Math.max.apply(Math, _toConsumableArray(bound));
return value >= Collection.getMinValue(bound) && value <= Collection.getMaxValue(bound);
};
var getBrushDomain = function (brushDomain, fullDomain) {
if (brushDomain) {
var brushMin = Collection.getMinValue(brushDomain);
var brushMax = Collection.getMaxValue(brushDomain);
var domainMin = Collection.getMinValue(fullDomain);
var domainMax = Collection.getMaxValue(fullDomain);
var defaultMin = brushMin < domainMin ? domainMin : domainMax - SMALL_NUMBER;
var defaultMax = brushMax > domainMax ? domainMax : domainMin + SMALL_NUMBER;
var min = withinBound(brushMin, fullDomain) ? brushMin : defaultMin;
var max = withinBound(brushMax, fullDomain) ? brushMax : defaultMax;
return [min, max];
}
return fullDomain;
};
var getActiveHandle = function (props, position, range) {

@@ -94,3 +111,3 @@ var width = props.handleWidth / 2;

var getMinimumDomain = function () {
return [0, 1 / Number.MAX_SAFE_INTEGER];
return [0, SMALL_NUMBER];
};

@@ -155,3 +172,3 @@

brushDomain = props.brushDomain;
domain = domain || brushDomain || getFullDomain(props);
domain = domain || getBrushDomain(brushDomain, getFullDomain(props));
var range = toRange(props, domain);

@@ -199,3 +216,3 @@ var coordinates = dimension === "x" ? {

var brushWidth = props.brushWidth || props.width;
var domain = brushDomain || getFullDomain(props);
var domain = getBrushDomain(brushDomain, getFullDomain(props));
var range = toRange(props, domain);

@@ -421,3 +438,3 @@ var defaultX = Math.min(x1, x2) - brushWidth / 2;

var fullDomain = getFullDomain(targetProps);
var currentDomain = brushDomain || fullDomain;
var currentDomain = getBrushDomain(brushDomain, fullDomain);
var range = toRange(targetProps, currentDomain);

@@ -455,3 +472,3 @@ var activeHandle = allowResize && getActiveHandle(targetProps, position, range);

var fullDomain = getFullDomain(targetProps);
var currentDomain = brushDomain || fullDomain;
var currentDomain = getBrushDomain(brushDomain, fullDomain);
var parentSVG = targetProps.parentSVG || Selection.getParentSVG(evt);

@@ -523,3 +540,3 @@ var position = Selection.getSVGEventCoordinates(evt, parentSVG)[dimension];

var fullDomain = getFullDomain(targetProps);
var domain = brushDomain || fullDomain;
var domain = getBrushDomain(brushDomain, fullDomain);
var initialRange = toRange(targetProps, domain);

@@ -526,0 +543,0 @@ var activeHandle = getActiveHandle(targetProps, position, initialRange);

@@ -46,2 +46,4 @@ "use strict";

var SMALL_NUMBER = 1 / Number.MAX_SAFE_INTEGER;
var getScale = function (props) {

@@ -87,5 +89,25 @@ var _props$scale = props.scale,

var withinBound = function (value, bound) {
return value >= Math.min.apply(Math, _toConsumableArray(bound)) && value <= Math.max.apply(Math, _toConsumableArray(bound));
return value >= _victoryCore.Collection.getMinValue(bound) && value <= _victoryCore.Collection.getMaxValue(bound);
};
var getBrushDomain = function (brushDomain, fullDomain) {
if (brushDomain) {
var brushMin = _victoryCore.Collection.getMinValue(brushDomain);
var brushMax = _victoryCore.Collection.getMaxValue(brushDomain);
var domainMin = _victoryCore.Collection.getMinValue(fullDomain);
var domainMax = _victoryCore.Collection.getMaxValue(fullDomain);
var defaultMin = brushMin < domainMin ? domainMin : domainMax - SMALL_NUMBER;
var defaultMax = brushMax > domainMax ? domainMax : domainMin + SMALL_NUMBER;
var min = withinBound(brushMin, fullDomain) ? brushMin : defaultMin;
var max = withinBound(brushMax, fullDomain) ? brushMax : defaultMax;
return [min, max];
}
return fullDomain;
};
var getActiveHandle = function (props, position, range) {

@@ -111,3 +133,3 @@ var width = props.handleWidth / 2;

var getMinimumDomain = function () {
return [0, 1 / Number.MAX_SAFE_INTEGER];
return [0, SMALL_NUMBER];
};

@@ -172,3 +194,3 @@

brushDomain = props.brushDomain;
domain = domain || brushDomain || getFullDomain(props);
domain = domain || getBrushDomain(brushDomain, getFullDomain(props));
var range = toRange(props, domain);

@@ -216,3 +238,3 @@ var coordinates = dimension === "x" ? {

var brushWidth = props.brushWidth || props.width;
var domain = brushDomain || getFullDomain(props);
var domain = getBrushDomain(brushDomain, getFullDomain(props));
var range = toRange(props, domain);

@@ -431,3 +453,3 @@ var defaultX = Math.min(x1, x2) - brushWidth / 2;

var fullDomain = getFullDomain(targetProps);
var currentDomain = brushDomain || fullDomain;
var currentDomain = getBrushDomain(brushDomain, fullDomain);
var range = toRange(targetProps, currentDomain);

@@ -465,3 +487,3 @@ var activeHandle = allowResize && getActiveHandle(targetProps, position, range);

var fullDomain = getFullDomain(targetProps);
var currentDomain = brushDomain || fullDomain;
var currentDomain = getBrushDomain(brushDomain, fullDomain);

@@ -538,3 +560,3 @@ var parentSVG = targetProps.parentSVG || _victoryCore.Selection.getParentSVG(evt);

var fullDomain = getFullDomain(targetProps);
var domain = brushDomain || fullDomain;
var domain = getBrushDomain(brushDomain, fullDomain);
var initialRange = toRange(targetProps, domain);

@@ -541,0 +563,0 @@ var activeHandle = getActiveHandle(targetProps, position, initialRange);

{
"name": "victory-brush-line",
"version": "31.1.0",
"version": "31.2.0",
"description": "Interactive Brush Line Component for Victory",

@@ -24,3 +24,3 @@ "keywords": [

"prop-types": "^15.5.8",
"victory-core": "^31.1.0"
"victory-core": "^31.2.0"
},

@@ -27,0 +27,0 @@ "scripts": {

@@ -7,2 +7,3 @@ import React from "react";

const SMALL_NUMBER = 1 / Number.MAX_SAFE_INTEGER;
const getScale = (props) => {

@@ -41,5 +42,20 @@ const { scale = {}, dimension = "x" } = props;

const withinBound = (value, bound) => {
return value >= Math.min(...bound) && value <= Math.max(...bound);
return value >= Collection.getMinValue(bound) && value <= Collection.getMaxValue(bound);
};
const getBrushDomain = (brushDomain, fullDomain) => {
if (brushDomain) {
const brushMin = Collection.getMinValue(brushDomain);
const brushMax = Collection.getMaxValue(brushDomain);
const domainMin = Collection.getMinValue(fullDomain);
const domainMax = Collection.getMaxValue(fullDomain);
const defaultMin = brushMin < domainMin ? domainMin : domainMax - SMALL_NUMBER;
const defaultMax = brushMax > domainMax ? domainMax : domainMin + SMALL_NUMBER;
const min = withinBound(brushMin, fullDomain) ? brushMin : defaultMin;
const max = withinBound(brushMax, fullDomain) ? brushMax : defaultMax;
return [min, max];
}
return fullDomain;
};
const getActiveHandle = (props, position, range) => {

@@ -63,3 +79,3 @@ const width = props.handleWidth / 2;

const getMinimumDomain = () => {
return [0, 1 / Number.MAX_SAFE_INTEGER];
return [0, SMALL_NUMBER];
};

@@ -158,3 +174,3 @@

const fullDomain = getFullDomain(targetProps);
const currentDomain = brushDomain || fullDomain;
const currentDomain = getBrushDomain(brushDomain, fullDomain);
const range = toRange(targetProps, currentDomain);

@@ -195,3 +211,3 @@ const activeHandle = allowResize && getActiveHandle(targetProps, position, range);

const fullDomain = getFullDomain(targetProps);
const currentDomain = brushDomain || fullDomain;
const currentDomain = getBrushDomain(brushDomain, fullDomain);
const parentSVG = targetProps.parentSVG || Selection.getParentSVG(evt);

@@ -267,3 +283,3 @@ const position = Selection.getSVGEventCoordinates(evt, parentSVG)[dimension];

const fullDomain = getFullDomain(targetProps);
const domain = brushDomain || fullDomain;
const domain = getBrushDomain(brushDomain, fullDomain);
const initialRange = toRange(targetProps, domain);

@@ -401,3 +417,3 @@ const activeHandle = getActiveHandle(targetProps, position, initialRange);

const { dimension, brushDomain } = props;
domain = domain || brushDomain || getFullDomain(props);
domain = domain || getBrushDomain(brushDomain, getFullDomain(props));
const range = toRange(props, domain);

@@ -434,3 +450,3 @@ const coordinates =

const brushWidth = props.brushWidth || props.width;
const domain = brushDomain || getFullDomain(props);
const domain = getBrushDomain(brushDomain, getFullDomain(props));
const range = toRange(props, domain);

@@ -437,0 +453,0 @@ const defaultX = Math.min(x1, x2) - brushWidth / 2;

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc