From 6b6e56bba4c786167df7784623b533ccacd8cff3 Mon Sep 17 00:00:00 2001 From: Simon-Mong <30740101+Simon-Mong@users.noreply.github.com> Date: Sat, 21 Aug 2021 22:07:12 +0800 Subject: [PATCH] Correct the distance to mouse-pointer block. Correct the distance to mouse-pointer block. --- stitchcode/threads.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/stitchcode/threads.js b/stitchcode/threads.js index c1f0bca0..6ecd5fb2 100644 --- a/stitchcode/threads.js +++ b/stitchcode/threads.js @@ -55,3 +55,14 @@ Process.prototype.reportPi = function (min, max) { Process.prototype.reportProxiedURL = function (url) { return this.reportURL(this.proxy + '/' + url); }; + +Process.prototype.origReportDistanceTo = Process.prototype.reportDistanceTo; +Process.prototype.reportDistanceTo = function (name) { + var thisObj = this.blockReceiver(); + if (thisObj && this.inputOption(name) === 'mouse-pointer') { + return new Point(thisObj.xPosition(), thisObj.yPosition()) + .distanceTo(new Point(this.reportMouseX(), this.reportMouseY())); + } else { + return this.origReportDistanceTo(name); + } +};