MCPcopy Create free account
hub / github.com/devforth/painterro / matchClickedColor

Method matchClickedColor

js/paintBucket.js:85–93  ·  view source on GitHub ↗
(r, g, b, a)

Source from the content-addressed store, hash-verified

83 }
84
85 matchClickedColor(r, g, b, a) {
86 const limit = this.main.params.bucketSensivity;
87 var matchedR = (Math.abs(r - this.clickedOnColor.r) < limit);
88 var matchedG = (Math.abs(g - this.clickedOnColor.g) < limit);
89 var matchedB = (Math.abs(b - this.clickedOnColor.b) < limit);
90 var matchedA = (Math.abs(a - this.clickedOnColor.a) < limit);
91 var v = (matchedR && matchedG && matchedB && matchedA);
92 return v;
93 }
94
95 getClickedOnColor(x, y) {
96 var pixelPos = (y * this.canvasWidth + x) * 4;

Callers 1

matchStartColorMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected