
export function pxToUnit(px, unit) {
  const setting = this.$dataStore.get("setting");
  if (!unit) {
    if (setting) {
      unit = setting.unit;
    }
  }
  if (unit === "mm") {
    px = Number((px * 0.84183).toFixed(1));
  } else if (unit === "inch") {
    px = Number((px * 0.84183) / 25.4).toFixed(1);
  }
  return px;
}
export function mmToPx(mm) {
  return  Number((Number(mm) / 0.84183).toFixed(1))
}

export function unitToPx(px,unit) {
  const setting = this.$dataStore.get("setting");
  if(!unit){
    unit = setting.unit;
  }
  if (unit === "mm") {
    px = Number((px / 0.84183).toFixed(1));
  } else if (unit === "inch") {
    px = Number((px / 0.84183) * 25.4).toFixed(1);
  }
  return px;
}
