a function to convert a value in pixels to value in UI units