Skip to content

Commit 0ae2f23

Browse files
committed
bar hitbox larger
1 parent ec4df84 commit 0ae2f23

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

scripts/svg.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
const container = document.getElementById("sheet-container");
22
const icons = document.querySelectorAll(".icon");
3-
const width = container.clientWidth - 100;
3+
const width = container.clientWidth - 50;
44
const height = 11*width/8.5; // based on average paper sizes
55
var noteSize = 0.03*width;
6-
var barSize = 0.05*width;
6+
var barHeight = 0.05*width;
7+
var barWidth = 0.35*barHeight;
78
const allPages = [];
89

910
const iconMap = { // object matching icon types to creating an SVG on the page
1011
bar: (x, y, page) => {
11-
const l = page.line(x, y, x, y+barSize).stroke({ width: 1, color: "black" });
12-
l.draggable();
12+
const g = page.group();
13+
g.add(page.rect(barWidth, barHeight).fill("transparent").center(x, y+(0.5*barHeight)));
14+
g.add(page.line(x, y, x, y+barHeight).stroke({ width: 1, color: "black" }));
15+
g.draggable();
1316
},
1417
note1: (x, y, page) => {
1518
const g = page.group(); // create a group so you can add stuff to it later

0 commit comments

Comments
 (0)