Skip to content

Commit 5e221d6

Browse files
authored
Merge branch 'main' into feat-filtering
2 parents 4a7629f + 6cc387c commit 5e221d6

File tree

10 files changed

+6993
-18
lines changed

10 files changed

+6993
-18
lines changed

.github/workflows/test.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Build and test
2+
on:
3+
push:
4+
branches: [main]
5+
pull_request:
6+
types: [opened, reopened, synchronize]
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v4
14+
- name: Use Node.js
15+
uses: actions/setup-node@v4
16+
with:
17+
node-version: "20.x"
18+
cache: "npm"
19+
- name: Install dependencies
20+
run: npm install
21+
- name: Run tests
22+
run: npm test

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules/

jest.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export default {
2+
transform: {},
3+
testEnvironment: "jsdom",
4+
};

js/objects.js

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -128,29 +128,21 @@ export class InfoBox {
128128
}
129129

130130
isHere(mouseX, mouseY) {
131-
if (
131+
return (
132132
mouseX > this.x &&
133133
mouseX < this.x + this.width &&
134134
mouseY > this.y &&
135135
mouseY < this.y + this.height
136-
) {
137-
return true;
138-
}
139-
140-
return false;
136+
);
141137
}
142138

143139
isVisible(x, y, width, height) {
144-
if (
140+
return (
145141
x + width > this.x &&
146142
x < this.x + this.width &&
147143
y + height > this.y &&
148144
y < this.y + this.height
149-
) {
150-
return true;
151-
}
152-
153-
return false;
145+
);
154146
}
155147
}
156148

@@ -254,15 +246,11 @@ export class Link {
254246
console.log("boxHeight: ", this.boxHeight);
255247
*/
256248

257-
if (
249+
return (
258250
x + width > boxX &&
259251
x < boxX + boxWidth &&
260252
y + height > boxY &&
261253
y < boxY + boxHeight
262-
) {
263-
return true;
264-
}
265-
266-
return false;
254+
);
267255
}
268256
}

0 commit comments

Comments
 (0)