mirror of
https://github.com/slint-ui/slint.git
synced 2025-09-29 21:34:50 +00:00
Fix Node.js version of memory game not working properly (#3789)
The rules require comparing if tiles are equal, which used to be a string comparison as we just converted the image to a path. With ImageData this doesn't work anymore, so this patch proposes an optional path property that makes the code also a tad bit more readable.
This commit is contained in:
parent
52a0cd5c13
commit
55085d43af
5 changed files with 23 additions and 3 deletions
|
@ -42,7 +42,7 @@ mainWindow.check_if_pair_solved = function () {
|
|||
index: tile2_index
|
||||
} = flipped_tiles[1];
|
||||
|
||||
let is_pair_solved = tile1.image === tile2.image;
|
||||
let is_pair_solved = tile1.image.path === tile2.image.path;
|
||||
if (is_pair_solved) {
|
||||
tile1.solved = true;
|
||||
model.setRowData(tile1_index, tile1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue