@@ -44,7 +44,9 @@ import {
4444 useBlockHoverState ,
4545 useBlockSetAttributesContext ,
4646} from '~stackable/hooks'
47- import { extractNumbersAndUnits , getCSSVarName } from '~stackable/util'
47+ import {
48+ extractNumbersAndUnits , getCSSVarName , convertToPxIfUnsupported ,
49+ } from '~stackable/util'
4850
4951const isEqualInitial = ( props , value , firstValue ) => {
5052 let isEqual = true
@@ -364,6 +366,9 @@ const FourRangeControl = memo( props => {
364366 [ _value , _unit ] = extractNumbersAndUnits ( mark . value ) [ 0 ]
365367 } else {
366368 [ _value , _unit ] = extractNumbersAndUnits ( mark . size ) [ 0 ]
369+ const converted = convertToPxIfUnsupported ( props . units , _unit , _value )
370+ _value = converted . value
371+ _unit = converted . unit
367372 }
368373 return _value === initialValue && ( _unit === '' || _unit === unit )
369374 } )
@@ -376,12 +381,11 @@ const FourRangeControl = memo( props => {
376381 const markValue = props . marks [ value ] ?. [ property ] || '0'
377382 let [ newValue , unit ] = extractNumbersAndUnits ( markValue ) [ 0 ]
378383
379- // If the attribute has no support for rem, and the
380- // preset units is rem, convert to px
381- if ( ( ! hasUnits || ( hasUnits && ! props . units . includes ( 'rem' ) ) ) && unit === 'rem' ) {
382- newValue = `${ parseFloat ( newValue ) * 16 } `
383- unit = 'px'
384- }
384+ // If the attribute has no support for rem or em, and the
385+ // preset units is rem or em, convert to px
386+ const converted = convertToPxIfUnsupported ( props . units , unit , newValue )
387+ newValue = converted . value
388+ unit = converted . unit
385389
386390 // Update the unit.
387391 if ( unit ) {
0 commit comments