From 127662c1eff1206f676fe984d90e08d459a47a62 Mon Sep 17 00:00:00 2001 From: Marc Date: Wed, 10 Nov 2021 09:56:19 +1100 Subject: [PATCH 1/2] added a third style of track and added the ability of slider marker to both existat same point on slider --- MultiSlider.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/MultiSlider.js b/MultiSlider.js index 24ff948..b9b0c8e 100755 --- a/MultiSlider.js +++ b/MultiSlider.js @@ -491,9 +491,11 @@ export default class MultiSlider extends React.Component { const { selectedStyle, unselectedStyle, + thirdStyle, sliderLength, markerOffsetX, markerOffsetY, + overlap } = this.props; const twoMarkers = this.props.values.length == 2; // when allowOverlap, positionTwo could be 0, identified as string '0' and throwing 'RawText 0 needs to be wrapped in ' error @@ -502,7 +504,7 @@ export default class MultiSlider extends React.Component { ? unselectedStyle : selectedStyle || styles.selectedTrack; const trackThreeLength = twoMarkers ? sliderLength - positionTwo : 0; - const trackThreeStyle = unselectedStyle; + const trackThreeStyle = thirdStyle!=undefined?thirdStyle:unselectedStyle; const trackTwoLength = sliderLength - trackOneLength - trackThreeLength; const trackTwoStyle = twoMarkers ? selectedStyle || styles.selectedTrack @@ -614,7 +616,7 @@ export default class MultiSlider extends React.Component { )} - {twoMarkers && positionOne !== this.props.sliderLength && ( + {twoMarkers && (overlap==true || positionOne !== this.props.sliderLength) && ( Date: Wed, 10 Nov 2021 10:15:34 +1100 Subject: [PATCH 2/2] documentation update --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 7702025..1dd37f7 100644 --- a/README.md +++ b/README.md @@ -87,6 +87,10 @@ Feel free to contribute to this part of the documentation. | step | 1 | number | Step value of the slider. | | optionsArray | | array of numbers | Possible values of the slider. Ignores min and max. | | {container/track/selected/unselected/ markerContainer/marker/pressedMarker/step/stepLabel/StepMarker} Style | | style object | Styles for the slider | +| selectedStyle | | style object | Style for the track right of the marker in the 1 marker case. Style of the track between the 2 markers in the 2 marker case. | +| unselectedStyle | | style object | Style for the track left of the marker in the 1 marker case. Style of the track on either side of the 2 markers in the 2 marker case. | +| thirdStyle | | style object | Style for the track right of the right marker in the 2 marker case. | +| overlap | | boolean | Enables 2 markers to exist at the same slider position. default behaviour right marker disappears. | | valuePrefix | | string | Prefix added to the value. | | valueSuffix | | string | Suffix added to the value. | | enabledOne | true | boolean | Enables the first cursor |