Skip to content

Commit

Permalink
Bug fix for open combinaison deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
EmeraldCoder committed Feb 15, 2014
1 parent b5273d8 commit babd0eb
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
8 changes: 4 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -238,19 +238,19 @@ <h1 style="font-size: 30px; line-height: 40px;"><span data-bind="{text: title}">
<script type="text/html" id="hand-template">
<!-- ko foreach: tiles -->
<!-- ko if: $index() === $parent.tiles.length-1 && !isWinningTile() -->
<span class="last" data-bind="click: $root.setWinningTile, attr: {'data-combinaison-index': $parent._index}"><img data-bind="attr: {src: 'img/' + suit + value + '.png'}" /></span>
<span class="last" data-bind="click: $root.setWinningTile, attr: {'data-combinaison-index': $parent._index, 'data-combinaison-concealed': $parent._isConcealed}"><img data-bind="attr: {src: 'img/' + suit + value + '.png'}" /></span>
<!-- /ko -->
<!-- ko if: $index() === $parent.tiles.length-1 && isWinningTile() -->
<span class="waiting last" data-bind="click: $root.setWinningTile, attr: {'data-combinaison-index': $parent._index}"><img data-bind="attr: {src: 'img/' + suit + value + '.png'}" /></span>
<span class="waiting last" data-bind="click: $root.setWinningTile, attr: {'data-combinaison-index': $parent._index, 'data-combinaison-concealed': $parent._isConcealed}"><img data-bind="attr: {src: 'img/' + suit + value + '.png'}" /></span>
<!-- /ko -->

<!-- ko if: $index() !== $parent.tiles.length-1 && isWinningTile() -->
<span class="waiting" data-bind="click: $root.setWinningTile, attr: {'data-combinaison-index': $parent._index}"><img data-bind="attr: {src: 'img/' + suit + value + '.png'}" /></span>
<span class="waiting" data-bind="click: $root.setWinningTile, attr: {'data-combinaison-index': $parent._index, 'data-combinaison-concealed': $parent._isConcealed}"><img data-bind="attr: {src: 'img/' + suit + value + '.png'}" /></span>
<!-- /ko -->
<!-- ko if: $index() !== $parent.tiles.length-1 && !isWinningTile() -->
<span data-bind="click: $root.setWinningTile, attr: {'data-combinaison-index': $parent._index}"><img data-bind="attr: {src: 'img/' + suit + value + '.png'}" /></span>
<span data-bind="click: $root.setWinningTile, attr: {'data-combinaison-index': $parent._index, 'data-combinaison-concealed': $parent._isConcealed}"><img data-bind="attr: {src: 'img/' + suit + value + '.png'}" /></span>
<!-- /ko -->
<!-- /ko -->
</script>
Expand Down
2 changes: 1 addition & 1 deletion src/gui/DragDropCombinaisonDeletion.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
e.preventDefault();

var index = parseInt(dragging.attr('data-combinaison-index')),
isOpen = dragging.parents('div').attr('id') === 'OpenCombinaison';
isOpen = dragging.attr('data-combinaison-concealed') !== 'true';

viewModel.remove(index, isOpen);

Expand Down
1 change: 1 addition & 0 deletions src/gui/RiichiMahjongPointerViewModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ function RiichiMahjongPointerViewModel() {
combinaison.tiles[i].isWinningTile = ko.observable(false);
}

combinaison._isConcealed = self.addIsConcealed;
if (self.addIsConcealed) {
combinaison._index = ko.computed(function(){
return self.concealedCombinaisons.indexOf(this);
Expand Down
4 changes: 2 additions & 2 deletions src/gui/TouchCombinaisonDeletion.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
);
}

function deleteSelectedCombinaison() {
function deleteSelectedCombinaison() {
var index = parseInt(selection.attr('data-combinaison-index')),
isOpen = selection.parents('div').attr('id') === 'OpenCombinaison';
isOpen = selection.attr('data-combinaison-concealed') !== 'true';
viewModel.remove(index, isOpen);
}

Expand Down

0 comments on commit babd0eb

Please sign in to comment.