add onMeasure to adjust preview size