Automatic Scale formula

if i call the zoomToFit within the transaction it does not work.
Also, i i call it after committing.
It works only when i settimout(200) AFTER committing