Compare commits

..

No commits in common. "deb5f29cee814bc0a7c8b40c417d62bcd4f1acc5" and "80c1abd5fe5164ddfcaf5093d173f8e8ef8a1877" have entirely different histories.

2 changed files with 35 additions and 44 deletions

View File

@ -144,7 +144,7 @@ function PrintScreen(WhatPassedIn=-1)
if (ui_helplevel == 2) tmp_queryhighlight = returnHighlightShape("square", rect, "yellow", "none", 0.3); if (ui_helplevel == 2) tmp_queryhighlight = returnHighlightShape("square", rect, "yellow", "none", 0.3);
if (ui_helplevel == 3) tmp_queryhighlight = returnHighlightShape("square", rect, "green", "none", 0.3); if (ui_helplevel == 3) tmp_queryhighlight = returnHighlightShape("square", rect, "green", "none", 0.3);
if (tmp_queryhighlight == null) { } if (tmp_queryhighlight == null) { }
else drawhighlight(tmp_queryhighlight); else drawshape(tmp_queryhighlight);
MainCanvas_ctx.drawImage(imageFromName("queryuser"), rect.sx, rect.sy, rect.deltax, rect.deltay); MainCanvas_ctx.drawImage(imageFromName("queryuser"), rect.sx, rect.sy, rect.deltax, rect.deltay);
@ -181,7 +181,7 @@ function PrintScreen(WhatPassedIn=-1)
else { else {
//console.log("We have something selected."); //console.log("We have something selected.");
var tmp_select = returnHighlightShape("selectbox", ui_selectRect, "green", "none", 0.8); var tmp_select = returnHighlightShape("selectbox", ui_selectRect, "green", "none", 0.8);
drawhighlight(tmp_select); drawshape(tmp_select);
} }
drawSelectMenu(); drawSelectMenu();
@ -492,7 +492,7 @@ function PrintNetworkDevice(ToPrint)
if (deviceHasProblem(ToPrint)) { if (deviceHasProblem(ToPrint)) {
var thshape = returnHighlightShape("square", actionrect, "red", "problem", 0.2); var thshape = returnHighlightShape("square", actionrect, "red", "problem", 0.2);
drawhighlight(thshape); drawshape(thshape);
} }
MainCanvas_ctx.drawImage(imageFromName(dname), rect.spoint.x, rect.spoint.y, rect.width, rect.height); MainCanvas_ctx.drawImage(imageFromName(dname), rect.spoint.x, rect.spoint.y, rect.width, rect.height);
@ -727,57 +727,48 @@ function printHighlights(countof="mouseover") {
var highlight = ui_HighlightArray[index]; var highlight = ui_HighlightArray[index];
//console.log("trying to highlight something: " + JSON.stringify(highlight)); //console.log("trying to highlight something: " + JSON.stringify(highlight));
if (highlight.shapeName == countof) count++; if (highlight.shapeName == countof) count++;
drawhighlight(highlight); drawshape(highlight);
} }
return countof; //the count of the item we were supposed to count return countof; //the count of the item we were supposed to count
} }
function drawhighlight(highlight, canvas = null) { function drawshape(highlight) {
if (canvas == null) MainCanvas_ctx.fillStyle = highlight.shapeColor;
canvas = MainCanvas_ctx; MainCanvas_ctx.globalAlpha = highlight.opaciticy; //mostly transparent
canvas.fillStyle = highlight.shapeColor;
canvas.globalAlpha = highlight.opaciticy; //mostly transparent
var oldWidth; var oldWidth;
if (highlight.shapeText == "square") if (highlight.shapeText == "square")
canvas.fillRect(highlight.shapePoints.sx, highlight.shapePoints.sy, highlight.shapePoints.deltax, highlight.shapePoints.deltay); MainCanvas_ctx.fillRect(highlight.shapePoints.sx, highlight.shapePoints.sy, highlight.shapePoints.deltax, highlight.shapePoints.deltay);
else if (highlight.shapeText == "line") { else if (highlight.shapeText == "line") {
oldWidth = canvas.lineWidth; oldWidth = MainCanvas_ctx.lineWidth;
canvas.lineWidth += 6; MainCanvas_ctx.lineWidth += 6;
canvas.strokeStyle = highlight.shapeColor; MainCanvas_ctx.strokeStyle = highlight.shapeColor;
canvas.beginPath(); MainCanvas_ctx.beginPath();
canvas.moveTo(highlight.shapePoints.sx, highlight.shapePoints.sy); MainCanvas_ctx.moveTo(highlight.shapePoints.sx, highlight.shapePoints.sy);
canvas.lineTo(highlight.shapePoints.dx, highlight.shapePoints.dy); MainCanvas_ctx.lineTo(highlight.shapePoints.dx, highlight.shapePoints.dy);
canvas.stroke(); MainCanvas_ctx.stroke();
canvas.lineWidth = oldWidth; MainCanvas_ctx.lineWidth = oldWidth;
canvas.strokeStyle = "black"; MainCanvas_ctx.strokeStyle = "black";
} }
else if (highlight.shapeText == "selectbox") { else if (highlight.shapeText == "selectbox") {
//console.log("Printing a selectbox"); //console.log("Printing a selectbox");
canvas.fillStyle = "green"; MainCanvas_ctx.fillStyle = "green";
oldWidth = canvas.lineWidth; oldWidth = MainCanvas_ctx.lineWidth;
canvas.lineWidth += 2; MainCanvas_ctx.lineWidth += 2;
canvas.strokeStyle = "green"; MainCanvas_ctx.strokeStyle = "green";
canvas.beginPath(); MainCanvas_ctx.beginPath();
canvas.moveTo(highlight.shapePoints.sx, highlight.shapePoints.sy); MainCanvas_ctx.moveTo(highlight.shapePoints.sx, highlight.shapePoints.sy);
canvas.lineTo(highlight.shapePoints.dx, highlight.shapePoints.sy); MainCanvas_ctx.lineTo(highlight.shapePoints.dx, highlight.shapePoints.sy);
canvas.lineTo(highlight.shapePoints.dx, highlight.shapePoints.dy); MainCanvas_ctx.lineTo(highlight.shapePoints.dx, highlight.shapePoints.dy);
canvas.lineTo(highlight.shapePoints.sx, highlight.shapePoints.dy); MainCanvas_ctx.lineTo(highlight.shapePoints.sx, highlight.shapePoints.dy);
canvas.lineTo(highlight.shapePoints.sx, highlight.shapePoints.sy); MainCanvas_ctx.lineTo(highlight.shapePoints.sx, highlight.shapePoints.sy);
canvas.stroke(); MainCanvas_ctx.stroke();
canvas.lineWidth = oldWidth; MainCanvas_ctx.lineWidth = oldWidth;
canvas.strokeStyle = "black"; MainCanvas_ctx.strokeStyle = "black";
} }
canvas.globalAlpha = 1.0; //reset MainCanvas_ctx.globalAlpha = 1.0; //reset
canvas.fillStyle = "black"; //reset MainCanvas_ctx.fillStyle = "black"; //reset
} }
//We use drawhighlight to draw one-off shapes
function drawshape( shape, rect, color, opaciticy = 0.4, canvas = null) {
if (canvas == null)
canvas = MainCanvas_ctx;
var tmp_queryhighlight = returnHighlightShape(shape, rect, color, "none", opaciticy);
drawhighlight(tmp_queryhighlight, canvas);
}
function countHighlightsNamed(countof = "mouseover") { function countHighlightsNamed(countof = "mouseover") {
var count = 0; var count = 0;