1
0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2024-06-21 19:12:45 +02:00

added isPointInPath and isPointInStroke to the readout-API list

This commit is contained in:
kkapsner 2018-04-01 22:47:57 +02:00
parent 6f8f9a7e9c
commit a7e472f298
2 changed files with 37 additions and 1 deletions

View File

@ -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){

View File

@ -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