button on card on mobile
Posted: 12 January 2021, 01:16
In Race for the Galaxy, in the Alien Artefacts Orb game, there are Orb cards which you can rotate before placing them. The way it has been implemented (not by me) is that when you select the card, a semi transparent rotating arrow appears on the card. On desktop, when you hover over the arrow, it turns solid and when you click it, the card rotates.
On mobile it doesn't work. The semi-transparent arrow appears, but when you tap it, it unselects the card instead of rotating it.
I've tried changing the .css with .touch-device and .notouch-device to force the arrow opacity to 1 on mobile (since there's no hover). The opacity change works, when I select the card, the solid arrow appears, but tapping it still unselects the card instead of rotating it.
Both the card and the arrow have absolute position. The card has a z-index of 1, I've tried enforcing a higher z-index value to the arrow but no luck.
I am using USB debugging with chrome to debug and inspect the mobile version, but I can't figure it out. Here is an example of an orb card. There's just the card and the rotcommand (which is the arrow).
When the card is created, this is called:
When debugging, this is never called. I can only see the select/unselect events. I suck at this frontend stuff, but I'm trying to get better! What's going on here? Can you help me figure this out? Or should I just add some small rotate buttons below the card because that can't work on mobile?
On mobile it doesn't work. The semi-transparent arrow appears, but when you tap it, it unselects the card instead of rotating it.
I've tried changing the .css with .touch-device and .notouch-device to force the arrow opacity to 1 on mobile (since there's no hover). The opacity change works, when I select the card, the solid arrow appears, but tapping it still unselects the card instead of rotating it.
Both the card and the arrow have absolute position. The card has a z-index of 1, I've tried enforcing a higher z-index value to the arrow but no luck.
I am using USB debugging with chrome to debug and inspect the mobile version, but I can't figure it out. Here is an example of an orb card. There's just the card and the rotcommand (which is the arrow).
Code: Select all
<div id="player_hand_orb_item_2" class="stockitem " style="top: 0px; left: 105px; width: 100px; height: 140px; background-image: url("https://en.1.studio.boardgamearena.com:8083/data/themereleases/current/games/raceforthegalaxy/999999-9999/img/orb.jpg"); background-position: -300% -100%; cursor: move; opacity: 1;">
<div id="rotcommand_player_hand_orb_item_2" class="rotcommand"></div>
</div>Code: Select all
dojo.connect($('rotcommand_' + div_id), 'onclick', this, 'onRotOrbCard');