Skip to content

Commit

Permalink
fix: added unit conversions
Browse files Browse the repository at this point in the history
  • Loading branch information
privateOmega committed Jun 3, 2020
1 parent 3d0ea2f commit e6d546b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/utils/unit-conversion.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,19 @@ export const HIPToTWIP = (HIPValue) => {
export const TWIPToHIP = (TWIPValue) => {
return Math.round(TWIPValue / 10);
};

export const pixelsToTWIP = (pixelValue) => {
return EMUToTWIP(pixelsToEMU(pixelValue));
};

export const TWIPToPixels = (TWIPValue) => {
return EMUToPixels(TWIPToEMU(TWIPValue));
};

export const pixelsToHIP = (pixelValue) => {
return TWIPToHIP(EMUToTWIP(pixelsToEMU(pixelValue)));
};

export const HIPToPixels = (HIPValue) => {
return EMUToPixels(TWIPToEMU(HIPToTWIP(HIPValue)));
};

0 comments on commit e6d546b

Please sign in to comment.