mirror of
https://github.com/Lolendor/reVCDOS.git
synced 2026-10-10 03:43:12 +08:00
Merge pull request #18 from aboelnazer2010-cmd/main
Implement touch controls for mobile devices (Force if touch)
This commit is contained in:
Vendored
+14
@@ -717,6 +717,20 @@
|
||||
// ignore
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
// دالة لإجبار اللعبة على إظهار تحكمات اللمس
|
||||
function forceEnableTouchControls() {
|
||||
document.body.setAttribute('data-is-touch', '1');
|
||||
}
|
||||
|
||||
// 1. تفعيل التحكمات فوراً إذا كان الجهاز يدعم اللمس
|
||||
if ('ontouchstart' in window || navigator.maxTouchPoints > 0 || window.matchMedia("(pointer: coarse)").matches) {
|
||||
forceEnableTouchControls();
|
||||
}
|
||||
|
||||
// 2. كإجراء احتياطي: تفعيل التحكمات بمجرد لمس الشاشة لأول مرة
|
||||
window.addEventListener('touchstart', forceEnableTouchControls, { once: true });
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user