adding function to calculate the width of the main area in pixels