1
1
Fork 0
mirror of https://github.com/boxgaming/qbjs.git synced 2024-09-20 04:24:45 +00:00

Improved Paint color matching, created _strokeThickness constant.

This commit is contained in:
William Barnes 2022-04-27 12:26:17 -04:00
parent b233809f6c
commit ef8dd31757
4 changed files with 6 additions and 3 deletions

BIN
.vs/qbjs/v17/.suo Normal file

Binary file not shown.

BIN
.vs/slnx.sqlite Normal file

Binary file not shown.

BIN
.vs/slnx.sqlite-journal Normal file

Binary file not shown.

9
qb.js
View file

@ -5,7 +5,7 @@ var QB = new function() {
this.LOCAL = Symbol("LOCAL"); this.LOCAL = Symbol("LOCAL");
this.SESSION = Symbol("SESSION"); this.SESSION = Symbol("SESSION");
var _strokeThickness = 2;
var _fgColor = null; var _fgColor = null;
var _bgColor = null; var _bgColor = null;
var _colormap = []; var _colormap = [];
@ -769,6 +769,7 @@ var QB = new function() {
screen.lastY = y; screen.lastY = y;
var ctx = screen.ctx; var ctx = screen.ctx;
ctx.lineWidth = _strokeThickness;
ctx.strokeStyle = color.rgba(); ctx.strokeStyle = color.rgba();
ctx.beginPath(); ctx.beginPath();
if (aspect == undefined) { if (aspect == undefined) {
@ -817,6 +818,7 @@ var QB = new function() {
screen.lastY = ey; screen.lastY = ey;
var ctx = screen.ctx; var ctx = screen.ctx;
ctx.lineWidth = _strokeThickness;
if (style == "B") { if (style == "B") {
ctx.strokeStyle = color.rgba(); ctx.strokeStyle = color.rgba();
@ -956,8 +958,9 @@ var QB = new function() {
var g = dat[p+1]; var g = dat[p+1];
var b = dat[p+2]; var b = dat[p+2];
//var a = dat[p+3]; //var a = dat[p+3];
if ((r == c1.r) && (g == c1.g) && (b == c1.b)) { return false; } var thresh = 2;
if ((r == c2.r) && (g == c2.g) && (b == c2.b)) { return false; } if ((Math.abs(r - c1.r) < thresh) && (Math.abs(g - c1.g) < thresh) && (Math.abs(b - c1.b) < thresh)) { return false; }
if ((Math.abs(r - c2.r) < thresh) && (Math.abs(g - c2.g) < thresh) && (Math.abs(b - c2.b) < thresh)) { return false; }
return true; return true;
} }