MV Scrolling issues

I decided to try out the plugin EST_STRATEGY_MOUSE_CAM for exploring friendly maps (and the world map) with the mouse. It works great, but there's one major problem: when you click on a space to navigate there, the player starts moving offscreen and the screen never recenters on them.

There's clearly logic in the game to make the screen scroll as the player moves, but it seems it was built with the assumption that the screen is always centered on the player to begin with (which is a little odd, because that's not necessarily true even without a plugin – there's no logic anywhere to recenter the screen after a Scroll Map even command). I want to adjust this logic to make the screen rapidly scroll back the player if they're offscreen and start moving (either via keyboard or mouse). Does anyone know how I could get this working?
I'm still looking for help on this.
Hmmm, doesn't just $gamePlayer.center($gamePlayer.x, $gamePlayer.y); put the display back on the game player? Seems to work for me.

If you don't want it to "jump back", but to scroll back fast, I guess you could check difference between player x and map's _displayX (and same for y) and start a scroll depending on that difference (probably want to put a switch to block the plugin scroll while that is happening though).

But yeah, don't have any motivation to check the scroll logic beyond that, maybe next year LOL.
That sounds helpful. Even if it's not quite a solution itself, I think it should be enough for me to figure something out. Thanks!
Yeah, I was just like thinking that you have a parallel event checking a conditional TouchInput.isPressed() [+ key presses] and then using that center command.

EDIT: And it could only run the code when it also checks that you've scrolled outside of where your player is by checking the _displayX and _displayY, or something.
This almost works:

Code:
const old_executeMove = Game_Player.prototype.executeMove;
Game_Player.prototype.executeMove = function(dir) {
	old_executeMove.call(this, dir);
	let dx = $gameMap.displayX() + $gamePlayer.centerX() - $gamePlayer.x;
	let dy = $gameMap.displayY() + $gamePlayer.centerY() - $gamePlayer.y;
	let w = $gameMap.screenTileX(), h = $gameMap.screenTileY();
	if(Math.abs(dx) > w / 2 || Math.abs(dy) > h / 2) {
		$gamePlayer.center($gamePlayer.x, $gamePlayer.y);
	}
};

With the above code, snapping to the player when moving with the mouse works perfectly. (The intent is to snap only if the player is currently offscreen – otherwise, just let the regular behaviour occur.) However, if I scroll the screen in one direction, but then move in the opposite direction with the keyboard, it doesn't snap. My preliminary investigation shows that updateScroll reverts the change to displayX made by the above function.

This is already a huge improvement, mind you.

I suppose using a parallel common event and putting code similar to that into it might work too… though it feels weird to do this kind of thing in an event…
Hmmm, there's already a isNearTheScreen function. I didn't even fully check how it works, but when I made a similar function where I just divided the last line checks by 2, it seems to work for this purpose. Like you can check if the game player is outside the view area. Seemed to work when I put in an event: if NOT isNearTheScreenNew() + left/right pressed -> Center (only tested it in the x direction though). So this might work, but yeah, didn't check it extensively or anything.

Game_CharacterBase.prototype.isNearTheScreenNew = function() {
var gw = Graphics.width;
var gh = Graphics.height;
var tw = $gameMap.tileWidth();
var th = $gameMap.tileHeight();
var px = this.scrolledX() * tw + tw / 2 - gw / 2;
var py = this.scrolledY() * th + th / 2 - gh / 2;
return px >= -gw/2 && px <= gw/2 && py >= -gh/2 && py <= gh/2;
};

Original thread: https://forums.rpgmakerweb.com/threads/scrolling-issues.180094/