diff --git a/lib/modifiedAPI.js b/lib/modifiedAPI.js index 169ed75..a6a9973 100644 --- a/lib/modifiedAPI.js +++ b/lib/modifiedAPI.js @@ -304,6 +304,42 @@ }; } }, + isPointInPath: { + type: "readout", + getStatus: function(obj, status){ + status = Object.create(status); + status.active = hasType(status, "readout"); + return status; + }, + object: "CanvasRenderingContext2D", + fakeGenerator: function(prefs, notify, window, original){ + return function isPointInPath(x, y){ + var rng = randomSupply.getRng(1, window); + var originalValue = original.apply(this, window.Array.from(arguments)); + var value = rng(originalValue, x + this.width * y); + notify.call(this, "fakedReadout"); + return !!(value & 1); + }; + } + }, + isPointInStroke: { + type: "readout", + getStatus: function(obj, status){ + status = Object.create(status); + status.active = hasType(status, "readout"); + return status; + }, + object: "CanvasRenderingContext2D", + fakeGenerator: function(prefs, notify, window, original){ + return function isPointInStroke(x, y){ + var rng = randomSupply.getRng(1, window); + var originalValue = original.apply(this, window.Array.from(arguments)); + var value = rng(originalValue, x + this.width * y); + notify.call(this, "fakedReadout"); + return !!(value & 1); + }; + } + }, fillText: { type: "input", getStatus: function(obj, status){ diff --git a/releaseNotes.txt b/releaseNotes.txt index 3eb9a32..51c9895 100644 --- a/releaseNotes.txt +++ b/releaseNotes.txt @@ -1,6 +1,6 @@ Version 0.4.5: changes: - - + - added isPointInPath and isPointInStroke to the readout-API list new features: - Added way to inspect canvas content in ask mode while being asked