improved layout part anchor logic