How to use the @freesewing/utils/roundMm function in @freesewing/utils

To help you get started, we’ve selected a few @freesewing/utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github freesewing / freesewing / packages / components / src / DraftConfigurator / PatternOptionMillimeter / index.js View on Github external
const update = (name, newValue, evt) => {
    newValue = roundMm(newValue, props.units);
    // Sometimes, when sliding, the rapid succession of updates
    // causes a weird timing issue to result in a value that is NaN.
    // If that's the case, just ignore this update and keep the
    // previous one instead
    if (!isNaN(newValue)) {
      setValue(newValue);
      if (evt.type !== "mousemove") props.updateValue(props.name, newValue);
    } else {
      if (evt.type !== "mousemove") props.updateValue(props.name, value);
    }
  };
github freesewing / freesewing / packages / components / src / DraftConfigurator / DraftSettingMargin / index.js View on Github external
const update = (name, newValue, evt) => {
    newValue = roundMm(newValue)
    // Sometimes, when sliding, the rapid succession of updates
    // causes a weird timing issue to result in a value that is NaN.
    // If that's the case, just ignore this update and keep the
    // previous one instead
    if (!isNaN(newValue)) {
      setValue(newValue)
      if (evt.type !== 'mousemove') props.updateValue('margin', newValue)
    } else {
      props.updateValue('margin', value)
    }
  }
github freesewing / freesewing / packages / components / src / DraftConfigurator / DraftSettingSa / index.js View on Github external
const updateCustom = (name, newValue, evt) => {
    newValue = roundMm(newValue)
    // Sometimes, when sliding, the rapid succession of updates
    // causes a weird timing issue to result in a value that is NaN.
    // If that's the case, just ignore this update and keep the
    // previous one instead
    if (!isNaN(newValue)) {
      setSaValue(newValue)
      setCustomValue(newValue)
      if (evt.type !== 'mousemove') props.updateValue('sa', newValue)
    } else {
      props.updateValue('sa', customValue)
    }
  }