Trash button only shows up on sheet page

This commit is contained in:
dylan 2023-05-07 10:04:50 -07:00
parent cc03a0e765
commit 87d3e6fc9b

View File

@ -32,6 +32,9 @@ const makeTabButton = (tabname: TabName | "sheet", x: number, y: number, icon: A
const makeTrashButton = (x: number, y: number, icon: Array<number>) => {
buttons.push({
update() {
if (page.tab !== "sheet") {
return
}
if (mouseClick()) {
const {x: mouseX, y: mouseY} = mousePos();
if (inRect(mouseX, mouseY, x, y, 8, 8)) {
@ -41,6 +44,9 @@ const makeTrashButton = (x: number, y: number, icon: Array<number>) => {
}
},
draw() {
if (page.tab !== "sheet") {
return
}
drawIcon(x, y, icon, COLOR.BLACK);
}
})