Skip to content

Commit 8e24170

Browse files
committed
(v0.1.4.1-alpha) Dynamic Grid
Now instead of loading fixed amount of grids we now load grids of 5.35rem width and 6rem height and repeat them! so size remains constant!!
1 parent 5da10bc commit 8e24170

File tree

3 files changed

+13
-16
lines changed

3 files changed

+13
-16
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ Your PC has been compromised by a group called the "HackClub". Can you regain co
77
- [ ] Add more stuff to Lockscreen.
88
- [X] Animations in the Lockscreen.
99
- [ ] A loading screen on desktop load and sound
10-
- [ ] Windows Design
10+
- [X] Windows Design + Desktop Design (Done in v0.1.3... & v0.1.4... respectively)
1111
- [X] Minimizing window still takes up the zIndex and prevents from using it.(FIXED IN v0.1.3.3-alpha)
1212
- [X] Clicking app on task bar checks if it is focussed or not then: if focussed minimize it, else focus it. (v0.1.3.3-alpha)
1313
- [X] Bug: Closing all apps still makes one of them active (visual) (FIXED: v0.1.3.4-alpha)
1414
- [X] Windows Lag when moving (FIXED in v0.1.3.5).
1515
- [X] Draggable component throughout (FIXED in v0.1.3.5).
16+
- [X] Dynamic Grid (Fixed in v0.1.4.1)

src/routes/desktop.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ function Desktop() {
3636
}), []);
3737

3838
const handleIconStop = (e, data, id) => {
39-
const gridX = window.innerWidth / 15;
40-
const gridY = (window.innerHeight - 48) / 6;
39+
const gridX = 5.35 * 16;
40+
const gridY = 6 * 16;
4141

42-
const newCol = Math.max(1, Math.min(15, iconPositions[id].col + Math.round(data.x / gridX)));
43-
const newRow = Math.max(1, Math.min(6, iconPositions[id].row + Math.round(data.y / gridY)));
42+
const newCol = Math.max(1, Math.round(data.x / gridX) + iconPositions[id].col) ;
43+
const newRow = Math.max(1, Math.round(data.y / gridY) + iconPositions[id].row);
4444

4545
const isOccupied = Object.entries(iconPositions).some(([appId, pos]) => {
4646
return appId !== id && pos.col === newCol && pos.row === newRow;

src/styles/routes/desktop.css

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,19 @@
1212
height: calc(100vh - 3rem);
1313
width: 100vw;
1414
display: grid;
15-
grid-template-columns: repeat(15, 1fr);
16-
grid-template-rows: repeat(6, 1fr);
15+
16+
grid-template-columns: repeat(auto-fill, 5.35rem);
17+
grid-template-rows: repeat(auto-fill, 6rem);
1718

1819
align-items: center;
1920
justify-items: center;
2021

21-
grid-template-areas:
22-
"a1 b1 c1 d1 e1 f1 g1 h1 i1 j1 k1 l1 m1 n1 o1"
23-
"a2 b2 c2 d2 e2 f2 g2 h2 i2 j2 k2 l2 m2 n2 o2"
24-
"a3 b3 c3 d3 e3 f3 g3 h3 i3 j3 k3 l3 m3 n3 o3"
25-
"a4 b4 c4 d4 e4 f4 g4 h4 i4 j4 k4 l4 m4 n4 o4"
26-
"a5 b5 c5 d5 e5 f5 g5 h5 i5 j5 k5 l5 m5 n5 o5"
27-
"a6 b6 c6 d6 e6 f6 g6 h6 i6 j6 k6 l6 m6 n6 o6";
28-
2922
gap: 0.5rem;
3023
padding: 0.5rem;
31-
margin-right: 0.5rem;
24+
25+
grid-auto-flow: column;
26+
27+
overflow: hidden;
3228
}
3329

3430

0 commit comments

Comments
 (0)