File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
src/components/advanced-range-control Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -189,13 +189,12 @@ const AdvancedRangeControl = props => {
189189 const [ _value , _unit ] = extractNumberAndUnit ( mark . value )
190190 return _value === derivedValue
191191 } )
192- rangeOnChange = value => {
192+ rangeOnChange = ( value , property = 'value' ) => {
193193 if ( value === '' ) {
194194 return _onChange ( value )
195195 }
196-
197196 // Extract the unit and value.
198- const markValue = props . marks [ value ] ?. value || '0'
197+ const markValue = props . marks [ value ] ?. [ property ] || '0'
199198 const [ _newValue , unit ] = extractNumberAndUnit ( markValue )
200199 const newValue = _newValue
201200
@@ -229,7 +228,13 @@ const AdvancedRangeControl = props => {
229228 className = "stk-range-control__custom-button"
230229 size = "small"
231230 variant = "tertiary"
232- onClick = { ( ) => setIsMarkMode ( ! isMarkMode ) }
231+ onClick = { ( ) => {
232+ // Set the value when changing from mark mode to custom
233+ if ( isMarkMode && rangeValue ) {
234+ rangeOnChange ( rangeValue , 'size' )
235+ }
236+ setIsMarkMode ( ! isMarkMode )
237+ } }
233238 icon = { settings }
234239 >
235240 </ Button >
You can’t perform that action at this time.
0 commit comments