updated so the segment edge insets automatically adjust for smaller segments in vertical layout
adjusted demo code