added bigger warning when there are errors

This commit is contained in:
BroodjeAap 2022-11-21 19:25:30 +00:00
parent dc3d786f60
commit 9ced8e75f2
2 changed files with 57 additions and 3 deletions

View file

@ -547,6 +547,7 @@ var Diagrams = /** @class */ (function () {
}
finally { if (e_5) throw e_5.error; }
}
this.drawWarning();
this.mouseState.leftUp = false;
this.mouseState.click = false;
};
@ -605,6 +606,36 @@ var Diagrams = /** @class */ (function () {
this.ctx.lineWidth = 5;
this.ctx.strokeRect(0, 0, this.canvas.width, this.canvas.height);
};
Diagrams.prototype.drawWarning = function () {
var e_7, _a;
var nodeWithLogs = null;
try {
for (var _b = __values(this.nodes.values()), _c = _b.next(); !_c.done; _c = _b.next()) {
var node = _c.value;
if (node.logs.length > 0) {
nodeWithLogs = node;
break;
}
}
}
catch (e_7_1) { e_7 = { error: e_7_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b["return"])) _a.call(_b);
}
finally { if (e_7) throw e_7.error; }
}
if (nodeWithLogs == null) {
return;
}
var warningString = "Check log of '" + nodeWithLogs.label + "' Filter!";
this.ctx.font = "30px Helvetica";
var warningSize = this.ctx.measureText(warningString);
this.ctx.fillStyle = "orange";
this.ctx.fillRect(this.canvas.width - warningSize.width - 30, 0, warningSize.width + 30, 50);
this.ctx.fillStyle = "#000";
this.ctx.fillText(warningString, this.canvas.width - warningSize.width - 15, 35);
};
Diagrams.prototype.addNode = function (id, x, y, label, meta, results, logs) {
if (meta === void 0) { meta = {}; }
if (results === void 0) { results = new Array(); }
@ -629,7 +660,7 @@ var Diagrams = /** @class */ (function () {
this.connections.push(new NodeConnection(A, B));
};
Diagrams.prototype.removeConnection = function (A, B) {
var e_7, _a;
var e_8, _a;
var index = 0;
try {
for (var _b = __values(this.connections), _c = _b.next(); !_c.done; _c = _b.next()) {
@ -642,12 +673,12 @@ var Diagrams = /** @class */ (function () {
index++;
}
}
catch (e_7_1) { e_7 = { error: e_7_1 }; }
catch (e_8_1) { e_8 = { error: e_8_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b["return"])) _a.call(_b);
}
finally { if (e_7) throw e_7.error; }
finally { if (e_8) throw e_8.error; }
}
};
Diagrams.prototype.onresize = function () {

View file

@ -597,6 +597,7 @@ class Diagrams {
for (let node of this.nodes.values()){
node.draw(this.ctx, this.mouseState);
}
this.drawWarning();
this.mouseState.leftUp = false;
this.mouseState.click = false;
}
@ -651,6 +652,28 @@ class Diagrams {
this.ctx.strokeRect(0, 0, this.canvas.width, this.canvas.height);
}
drawWarning(){
let nodeWithLogs: DiagramNode | null = null;
for (let node of this.nodes.values()){
if (node.logs.length > 0) {
nodeWithLogs = node;
break;
}
}
if (nodeWithLogs == null){
return
}
let warningString = `Check log of '${nodeWithLogs.label}' Filter!`
this.ctx.font = "30px Helvetica";
let warningSize = this.ctx.measureText(warningString);
this.ctx.fillStyle = "orange";
this.ctx.fillRect(this.canvas.width - warningSize.width - 30, 0, warningSize.width + 30, 50);
this.ctx.fillStyle = "#000";
this.ctx.fillText(warningString, this.canvas.width - warningSize.width - 15, 35)
}
addNode(
id: number,
x: number,