Spaces:
Running
Running
Upload skyscraper.html
Browse files- skyscraper.html +15 -10
skyscraper.html
CHANGED
|
@@ -791,27 +791,32 @@
|
|
| 791 |
if (this.s.timerActive && this._checkTimer()) return;
|
| 792 |
const l2 = this._getL2(); if (!l2) return;
|
| 793 |
const d = this.s.targetDist, l1 = this.s.line1;
|
| 794 |
-
|
| 795 |
-
|
|
|
|
|
|
|
| 796 |
const px = l1.p1.x + (l1.p2.x - l1.p1.x) * t, py = l1.p1.y + (l1.p2.y - l1.p1.y) * t;
|
| 797 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 798 |
});
|
| 799 |
-
const avg = totalErr / this.s.markerTs.length;
|
| 800 |
if (this.s.phase === 'tutorial') {
|
| 801 |
-
if (
|
| 802 |
this._showPhaseModal('✅', '教學完成!', '垂直距離處處相等 = 平行!\n確認距離一致就代表兩條線平行', '確認,繼續 →', null);
|
| 803 |
this.dom.tbtn.onclick = () => { this.dom.tm.classList.add('hidden'); this.s.lvIdx++; this._genLevel() }
|
| 804 |
}
|
| 805 |
-
else this._showToast(
|
| 806 |
return;
|
| 807 |
}
|
| 808 |
if (this.s.fixMode) {
|
| 809 |
-
if (
|
| 810 |
-
else this._showToast(
|
| 811 |
return;
|
| 812 |
}
|
| 813 |
-
if (
|
| 814 |
-
else this._showToast(
|
| 815 |
}
|
| 816 |
|
| 817 |
judgeAnswer(says) {
|
|
|
|
| 791 |
if (this.s.timerActive && this._checkTimer()) return;
|
| 792 |
const l2 = this._getL2(); if (!l2) return;
|
| 793 |
const d = this.s.targetDist, l1 = this.s.line1;
|
| 794 |
+
// 逐點檢查:每個測量點的四捨五入值必須完全等於 d
|
| 795 |
+
let allMatch = true;
|
| 796 |
+
let mismatchInfo = '';
|
| 797 |
+
this.s.markerTs.forEach((t, idx) => {
|
| 798 |
const px = l1.p1.x + (l1.p2.x - l1.p1.x) * t, py = l1.p1.y + (l1.p2.y - l1.p1.y) * t;
|
| 799 |
+
const measured = Math.round(this._perpDist(px, py, l2.p1, l2.p2));
|
| 800 |
+
if (measured !== d) {
|
| 801 |
+
allMatch = false;
|
| 802 |
+
mismatchInfo = `目標 d = ${d},但有測量點顯示 ${measured}`;
|
| 803 |
+
}
|
| 804 |
});
|
|
|
|
| 805 |
if (this.s.phase === 'tutorial') {
|
| 806 |
+
if (allMatch) {
|
| 807 |
this._showPhaseModal('✅', '教學完成!', '垂直距離處處相等 = 平行!\n確認距離一致就代表兩條線平行', '確認,繼續 →', null);
|
| 808 |
this.dom.tbtn.onclick = () => { this.dom.tm.classList.add('hidden'); this.s.lvIdx++; this._genLevel() }
|
| 809 |
}
|
| 810 |
+
else this._showToast(`還不是完全平行!${mismatchInfo}`, false);
|
| 811 |
return;
|
| 812 |
}
|
| 813 |
if (this.s.fixMode) {
|
| 814 |
+
if (allMatch) { this._onCorrect(80) }
|
| 815 |
+
else this._showToast(`還不是完全平行!${mismatchInfo}`, false);
|
| 816 |
return;
|
| 817 |
}
|
| 818 |
+
if (allMatch) this._onCorrect(100);
|
| 819 |
+
else this._showToast(`還不是完全平行!${mismatchInfo}`, false);
|
| 820 |
}
|
| 821 |
|
| 822 |
judgeAnswer(says) {
|