MZ Anyone knows how the camera works in RMMZ?

I'm trying to develop a map zoom plugin for my game (and for anyone that wants it), you can see the las version in: https://forums.rpgmakerweb.com/index.php?threads/map-zoom.126012/

But not I'm stuck. I do not fully understand the how the camera works in RMMZ. The scroll is good. The zoom and touch input is good. And in looped maps it works always well. But, when the map is size-limited trasferring, close the main menu, or other similar action in a map edge breaks all. I suspect that is something related to Game_Map.prototype.setDisplayPos but I don't get the key.

Help of an experienced developer will be fully appreciated.
@Hudell - @TWings - @Raizen - @Tsukihime
Display position is used to determine the origin of the map sprite.

Which part of the map to display basically.
It's based on the player's position on the map and whether you've reached the corner or edge. You should mess around with the display position logic and see what the math is doing
Thanks a lot for your clue, Tsukihime. Somehow now works with no-looped maps but only when I do not limit the camera on the edges of the map. But I prefer fix it in order to emulate the standard camera.

Original thread: https://forums.rpgmakerweb.com/threads/anyone-knows-how-the-camera-works-in-rmmz.126037/