diff --git a/src/components/HomePage/HomePage.html b/src/components/HomePage/HomePage.html
index 38b97c7..a179fb1 100644
--- a/src/components/HomePage/HomePage.html
+++ b/src/components/HomePage/HomePage.html
@@ -1,9 +1,52 @@
-
- Home
- Guest
- Inverti ordine
-
+
+ Nome Home
+ Nome Guest
+
+
+
+
Formazione Home
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Formazione Guest
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inverti ordine
+
Ok
@@ -106,7 +149,7 @@
-
+
diff --git a/src/components/HomePage/HomePage.js b/src/components/HomePage/HomePage.js
index 102b54f..0741da9 100644
--- a/src/components/HomePage/HomePage.js
+++ b/src/components/HomePage/HomePage.js
@@ -24,6 +24,7 @@ export default {
home: ["1", "2", "3", "4", "5", "6"],
guest: ["1", "2", "3", "4", "5", "6"],
},
+ servizioPrecedente: [], // Stack per tracciare i cambi palla
},
}
},
@@ -37,6 +38,11 @@ export default {
}
this.abilitaTastiSpeciali();
},
+ computed: {
+ isPunteggioZeroZero() {
+ return this.sp.punt.home === 0 && this.sp.punt.guest === 0;
+ }
+ },
methods: {
closeApp() {
var win = window.open("", "_self");
@@ -66,6 +72,14 @@ export default {
guest: ["1", "2", "3", "4", "5", "6"],
}
this.sp.striscia = { home: [0], guest: [0] }
+ this.sp.servizioPrecedente = []
+ },
+ cambiaPalla() {
+ if (!this.isPunteggioZeroZero) {
+ this.$waveui.notify("Cambio palla consentito solo a inizio set (0-0)", "warning");
+ return;
+ }
+ this.sp.servHome = !this.sp.servHome;
},
incSet(team) {
if (this.sp.set[team] == 2) {
@@ -89,8 +103,16 @@ export default {
this.sp.striscia.guest.push(this.sp.punt.guest)
this.sp.striscia.home.push(' ')
}
+
+ // Ruota la formazione solo se c'è cambio palla (conquista del servizio)
+ const cambioPalla = (team == "home" && !this.sp.servHome) || (team == "guest" && this.sp.servHome);
+ this.sp.servizioPrecedente.push(cambioPalla); // Salva se c'è stato cambio palla
+
+ if (cambioPalla) {
+ this.sp.form[team].push(this.sp.form[team].shift());
+ }
+
this.sp.servHome = (team == "home");
- this.sp.form[team].push(this.sp.form[team].shift());
},
checkVittoria() {
const puntHome = this.sp.punt.home;
@@ -117,12 +139,20 @@ export default {
if (this.sp.striscia.home.length > 1) {
var tmpHome = this.sp.striscia.home.pop()
var tmpGuest = this.sp.striscia.guest.pop()
+ var cambioPalla = this.sp.servizioPrecedente.pop() // Recupera se c'era stato cambio palla
+
if (tmpHome == ' ') {
this.sp.punt.guest--
- this.sp.form.guest.unshift(this.sp.form.guest.pop());
+ // Ruota indietro solo se c'era stato un cambio palla
+ if (cambioPalla) {
+ this.sp.form.guest.unshift(this.sp.form.guest.pop());
+ }
} else {
this.sp.punt.home--
- this.sp.form.home.unshift(this.sp.form.home.pop());
+ // Ruota indietro solo se c'era stato un cambio palla
+ if (cambioPalla) {
+ this.sp.form.home.unshift(this.sp.form.home.pop());
+ }
}
}
},
@@ -198,7 +228,7 @@ export default {
} else if (e.shiftKey && e.key == "ArrowRight") {
this.incSet("guest")
} else if (e.ctrlKey && e.key == "ArrowLeft") {
- this.sp.servHome = !this.sp.servHome
+ this.cambiaPalla()
} else { return false }
}
}
diff --git a/src/style.css b/src/style.css
index 03f06b1..166e800 100644
--- a/src/style.css
+++ b/src/style.css
@@ -121,4 +121,44 @@ button:focus-visible {
background-color: rgb(206, 247, 3);
color: blue;
border-radius: 5px;
+}
+
+.campo-config {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+}
+
+.campo-pallavolo {
+ border: 3px solid #999;
+ background-color: rgba(205, 133, 63, 0.25);
+ position: relative;
+ width: 220px;
+ height: 220px;
+ display: flex;
+ flex-direction: column;
+ padding: 0;
+}
+
+.fila-anteriore {
+ height: 33.33%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ padding: 5px;
+}
+
+.fila-posteriore {
+ height: 66.67%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ padding: 5px;
+}
+
+.linea-tre-metri {
+ border-top: 2px solid #666;
+ width: 100%;
+ height: 0;
+ margin: 0;
}
\ No newline at end of file