简化Layer.attachTo的实现

Fixed #233