Skip to content

Commit

Permalink
feat: information on empty canvas
Browse files Browse the repository at this point in the history
  • Loading branch information
iffse committed May 16, 2023
1 parent e57511f commit 65b5a9e
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src-qml/BoundaryPanel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,23 @@ ApplicationWindow {
width: previewRoot.contentWidth
property var boundaryTags: []
property var boundaryCoordinates: []
onAvailableChanged: {
var ctx = getContext("2d");
ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.fillStyle = Material.theme == Material.Dark ? "white" : "black";
ctx.textAlign = "center";
var font = ctx.font.split(",")[0];
console.log(font)
ctx.font = "16px " + font;

if (grid.children.length === 0) {
ctx.fillText(qsTr("No boundary"), canvas.width / 2, 50);
canvas.requestPaint();
return;
}
ctx.fillText(qsTr("Click on a boundary button"), canvas.width / 2, 50);
canvas.requestPaint();
}

Component.onCompleted: {
if (grid.children.length === 0) {
Expand Down

0 comments on commit 65b5a9e

Please sign in to comment.