Skip to content

Commit

Permalink
let the selection function disable!
Browse files Browse the repository at this point in the history
  • Loading branch information
pawsnana committed Dec 9, 2023
1 parent 74ff2fb commit f374a38
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
14 changes: 10 additions & 4 deletions projects/project-03/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ document.addEventListener("DOMContentLoaded", function() {
let clientY = e.clientY || e.touches[0].clientY;
offsetX = clientX - background.offsetLeft;
offsetY = clientY - background.offsetTop;
background.style.cursor = 'grab';
}

function doDragBackground(e) {
Expand All @@ -26,11 +27,14 @@ document.addEventListener("DOMContentLoaded", function() {

// to make the icons looks like floating trial 1
updateIconPositions(newX, newY);

background.style.cursor = 'grabbing';
}
}

function endDragBackground() {
isDraggingBackground = false;
background.style.cursor = 'default';
}

// this function is to update icon position when i move the background
Expand Down Expand Up @@ -114,21 +118,23 @@ document.addEventListener("DOMContentLoaded", function() {
let iconsInDivision = division.querySelectorAll('.icon');
let divisionId = division.id;
let correctIconsForDivisions = {
'div1_TD': ['icon_akali', 'icon_ekko', 'icon_senna'],
'TD_pickdroplot': ['icon_akali', 'icon_ekko', 'icon_senna'],
'div2_K': ['icon_akali', 'icon_ahri', 'icon_kaisa'],

};

let correctIcons = correctIconsForDivisions[divisionId] || [];
let correctCount = 0;
iconsInDivision.forEach(icon => {
if (correctIcons.includes(icon.id)) {
correctCount++;
}
});


console.log(`Division: ${divisionId}, Correct Count: ${correctCount}`);

if (correctCount >= 3) {
division.style.backgroundImage = 'url(backgrounds/TD_1.png)';
console.log(`Background image set for division: ${divisionId}`);
}
}
});
17 changes: 12 additions & 5 deletions projects/project-03/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ body, html {
height: 100%;
margin: 0;
overflow: hidden; /* won't scroll i think */

user-select: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;

}

/* for making view port default at 489 and 479 */
Expand Down Expand Up @@ -86,11 +92,11 @@ body, html {
}


.container {
/* .container {
position: relative;
width: 2638px;
height: 2075px;
}
} */

.division {
position: absolute;
Expand All @@ -110,9 +116,9 @@ body, html {

}

.pick_drop_lot {
#TD_pickdroplot {
height: 500px;
width: 750px;;
width: 750px;
z-index: 1;
position: absolute;
top: 400px;
Expand All @@ -124,14 +130,15 @@ body, html {

}

#TD_pickdroplot_1, #TD_pickdroplot_2 #TD_pickdroplot_3 {
#TD_pickdroplot_1 {
width: 65px;
height: 65px;
border-radius: 50%;
background-color: rgb(255, 104, 215);
z-index: 1;

display: inline-block;

}


Expand Down

0 comments on commit f374a38

Please sign in to comment.