refactoring Layout.ts and adjust allow height of Context