Skip to content

Commit

Permalink
Bugfix winning tile selection on touch device
Browse files Browse the repository at this point in the history
  • Loading branch information
EmeraldCoder committed Jan 28, 2014
1 parent 6931f37 commit 3dece5d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/gui/Popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@ var Popup = (function($){
var $idleBackground,
$popup,
$popupTitle,
$popupButtons;
$popupButtons,
isOpen = false;

function init() {
createHtmlStructure();
}

function open(message, buttons) {
isOpen = true;

$popupTitle.html(message);

buttons.forEach(function(button){
Expand All @@ -27,6 +30,8 @@ var Popup = (function($){
}

function close() {
isOpen = false;

$idleBackground.hide();
$popup.hide();

Expand Down Expand Up @@ -57,6 +62,7 @@ var Popup = (function($){
init();
return {
open: open,
close: close
close: close,
isOpen: isOpen
};
}(jQuery));
5 changes: 5 additions & 0 deletions src/gui/RiichiMahjongPointerViewModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,11 @@ function RiichiMahjongPointerViewModel() {
};

self.remove = function(index, isOpen) {
if (self.winningTile) {
self.winningTile.isWinningTile(false);
self.winningTile = null;
}

if (isOpen) {
self.openCombinaisons.splice(index, 1);
} else {
Expand Down
2 changes: 2 additions & 0 deletions src/gui/TouchCombinaisonDeletion.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

$('.box-combinaison').on('touchend', 'span', function(e) {
e.preventDefault();
$(this).trigger('click');

if (selectionTimeout) clearTimeout(selectionTimeout);
});

Expand Down

0 comments on commit 3dece5d

Please sign in to comment.