From b09288b78170b9b9d9691e7ae208a376547ea5d7 Mon Sep 17 00:00:00 2001 From: "kbr@google.com" Date: Fri, 28 May 2010 00:25:46 +0000 Subject: Changed how checkers sample identifies whether a hit occurred using clientId rather than object equality. In both Safari and Chrome, if the browser's JavaScript engine is used rather than O3D's embedded V8, these equality comparisons fail. It looks like we may need to disable the use of the embedded V8 for this sample due to bad interactions with event dispatching. BUG=none TEST=none Review URL: http://codereview.chromium.org/2334001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48451 0039d316-1c4b-4281-b951-d872f2087c98 --- o3d/samples/checkers.html | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'o3d') diff --git a/o3d/samples/checkers.html b/o3d/samples/checkers.html index 144ee6d..a43e1b395 100644 --- a/o3d/samples/checkers.html +++ b/o3d/samples/checkers.html @@ -581,11 +581,13 @@ function detectSelection(e) { if (pickInfo) { // get the parent transform of this object. var pickTrans = pickInfo.shapeInfo.parent.transform; + var pickTransClientId = pickTrans.clientId; // check if a board square or a piece. for (var x = 0; x < g_boardSize; x += 1) { for (var y = 0; y < g_boardSize; y += 1) { - if (pickTrans === g_board[x][y].piece) { + if (g_board[x][y].piece && + pickTransClientId == g_board[x][y].piece.clientId) { // do not select another player's piece. if (g_player != g_board[x][y].type) return; @@ -605,7 +607,7 @@ function detectSelection(e) { SelectPiece(x, y); return; - } else if (pickTrans === g_board[x][y].square) { + } else if (pickTransClientId == g_board[x][y].square.clientId) { // selected the landing square if a piece move is pending. if (g_selectedPiece) { // check if a forced jump. -- cgit v1.1