Confused about TouchInput's actual update

So I am trying to do a small TouchInput check.


What I did is something like this:


Scene_Title.prototype.updateTouchX = function() {
if (TouchInput.x >= Graphics.boxWidth - 20 || TouchInput.y >= Graphics.height - 20) {
// function here
} else {
// function here
}
}


Thing is, it does check what I want correctly and properly, however, my only gripe is that it ONLY checks it when I click the mouse. Is there a way to check the mouse's x and y without clicking? I mean a way to check the current, real time x and y of the mouse as is without clicking it?
That's because TouchInput only stores the mouse position when you click, but it's easy to change that:


TouchInput._onMouseMove = function(event) {
var x = Graphics.pageToCanvasX(event.pageX);
var y = Graphics.pageToCanvasY(event.pageY);
if (this._mousePressed) {
this._onMove(x, y);
}
};


This is the original _onMouseMove method. You can store those x and y variables somewhere else, like this:


this.mouseX = x;
this.mouseY = y;


And then check those properties when you need the position without clicking.
Thank you! This works wonders! Now I can do almost anything I want when I use the mouse.

Original thread: https://forums.rpgmakerweb.com/threads/confused-about-touchinputs-actual-update.63549/