summaryrefslogtreecommitdiff
path: root/play.js
diff options
context:
space:
mode:
authoriainp5 <iain.pearce.ip@gmail.com>2024-10-03 09:51:53 +0100
committeriainp5 <iain.pearce.ip@gmail.com>2024-10-03 09:51:53 +0100
commit8a22654f577467fa36b5312884a754c7e7348fff (patch)
tree7ccb9fde6e78bdbe4e46944e48eeb4fa7f1524fd /play.js
parentd365aebd952f1ded9753bb9eb53e2a45bdbaa978 (diff)
download1989-dawn-of-freedom-8a22654f577467fa36b5312884a754c7e7348fff.tar.gz
Updates to visuals on loading
Diffstat (limited to 'play.js')
-rw-r--r--play.js25
1 files changed, 16 insertions, 9 deletions
diff --git a/play.js b/play.js
index 90eebb2..d7f9f75 100644
--- a/play.js
+++ b/play.js
@@ -121,6 +121,8 @@ const spaceCharacteristicsElement = document.getElementById('space-characteristi
// CREATE CARDS
+ const is_mobile = window.matchMedia("(pointer: coarse)").matches
+
for (let c = 1; c <= last_card; ++c) {
const hand_card = document.createElement('img');
@@ -129,14 +131,17 @@ const spaceCharacteristicsElement = document.getElementById('space-characteristi
hand_card.src = `cards/e${c}.gif`
hand_card.my_card = c;
hand_card.addEventListener('mousedown', on_click_card);
- hand_card.addEventListener('mouseenter', () => {
- hover_timeout = setTimeout(() => {
- hand_card.classList.add('zoom');
- }, 500) })
- hand_card.addEventListener('mouseleave', () => {
- clearTimeout(hover_timeout);
- hand_card.classList.remove('zoom');
- });
+
+ if(!is_mobile) {
+ hand_card.addEventListener('mouseenter', () => {
+ hover_timeout = setTimeout(() => {
+ hand_card.classList.add('zoom');
+ }, 500) })
+ hand_card.addEventListener('mouseleave', () => {
+ clearTimeout(hover_timeout);
+ hand_card.classList.remove('zoom');
+ });
+ }
ui.cards.push(hand_card);
}
@@ -274,6 +279,7 @@ let ui = {
}
+
function on_update() {
//console.log('on_update called')
//console.log('view.valid_spaces: ', view.valid_spaces)
@@ -291,7 +297,6 @@ function on_update() {
});
//Check influence values
- //const pieces = view.pieces
for (let i = 1; i < spaces.length; i ++) {
@@ -357,10 +362,12 @@ function on_update() {
marker.classList.remove('held')
marker.style.display = 'block'
times_held.classList.add('outlined_text')
+ times_held.classList.remove('hide')
} else if (view.times_held[find_country_index(country)] > 0 ) {
//console.log('setting ', country)
marker.classList.add('held')
marker.style.display = 'block'
+ times_held.classList.remove('hide')
times_held.innerHTML = view.times_held[find_country_index(country)]
}
else {marker.style.display = 'none'}