fixed #2795 fixed bug for _calculateLayerOffset.