factorize code in `updateTransform()`