>> Now, the first thing we do is actually set the viewRect width and height
equal to the canvas size. This way we know that the viewRect is actually going
to encompass everything that the canvas can actually see. From here, we actually
translate the x and y value of the viewRect by offsetting it by half of the
canvas size. Now, what this is going to do is effectively shift the viewRect,
such the x and y value are at the center. Of the viewRect, meaning that it's at
the center of what the canvas will draw.
La primera cosa que haremos es poner
los valores viewRect de ancho y altura
iguales al tamaño del lienzo.
Así sabemos que el viewRect
va a abarcar todo cuanto el lienzo
en realidad puede ver. A partir de aquí,
traducimos los valores X y Y
de la viewRect contrarestándolos
a la mitad del tamaño. Lo que esto
va a hacer es cambiar la viewRect,
de modo que los valores X y Y
queden en el centro de la viewRect;
o sea, que está en el centro
de lo que el lienzo dibujará.
A primeira coisa que temos que fazer é
igualar a largura e a altura do viewRect
ao tamanho do canvas. Deste modo,
sabemos que o ViewRect irá efetivamente
abranger tudo o que o canvas pode ver.
Depois iremos trasladar
o valor de x e y do viewRect, compensando
pela metade do tamanho do canvas.
O que resultará numa mudança de posição de
viewRect fazendo com que
os valores de x e y estejam no centro.
Ou seja, no centro do ViewRect, que
significa o centro do desenho no canvas.