I have a canvas being manipulated by a matrix. Im trying to set the maximum zoom/scale so the user wont be able to zoom into my image more than i want them to using multitouch. However, i cant seem to get this right

. I tried using matrix.getValues(tempArray) to dump the values into an array, and manually set the x and y zoom to 1.7 (the max zoom level i will allow) then i would use setValues to put the values back into the matrix before the matrix is concatenated. When i do this the user cant zoom past that point, but once they reach that point the canvas starts to translate downward and to the right

. postScale is responsible, and its because even though i manually set the zoom factor, it still applies the scale which for some reason is effecting image translation

. Does anyone know how i could get it to stop zooming past a certain point without moving, or know how my scale value is being applied to the x and y translation so i could counter it and fix this problem? thank you.