Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Side by Side Diff: samples/o3d-webgl/client.js

Issue 2884048: Fix picking for Minefield (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/o3d/
Patch Set: Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2010, Google Inc. 2 * Copyright 2010, Google Inc.
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after
847 * the event. 847 * the event.
848 * 848 *
849 * @param {!Object} eventInfo As returned from 849 * @param {!Object} eventInfo As returned from
850 * o3d.Client.getEventInfo. 850 * o3d.Client.getEventInfo.
851 * @return {!Object} An object containing keys 'x' and 'y'. 851 * @return {!Object} An object containing keys 'x' and 'y'.
852 * @private 852 * @private
853 */ 853 */
854 o3d.Client.getLocalXY_ = function(eventInfo) { 854 o3d.Client.getLocalXY_ = function(eventInfo) {
855 var event = eventInfo.event; 855 var event = eventInfo.event;
856 var p = o3d.Client.getAbsolutePosition_(eventInfo.element); 856 var p = o3d.Client.getAbsolutePosition_(eventInfo.element);
857 return {x: event.x - p.x, y: event.y - p.y}; 857 return {x: event.pageX - p.x, y: event.pageY - p.y};
858 }; 858 };
859 859
860 860
861 /** 861 /**
862 * Wraps a user's event callback with one that properly computes 862 * Wraps a user's event callback with one that properly computes
863 * relative coordinates for the event. 863 * relative coordinates for the event.
864 * @param {!o3d.EventCallback} handler Function to call on event. 864 * @param {!o3d.EventCallback} handler Function to call on event.
865 * @param {boolean} doCancelEvent If event should be canceled after callback. 865 * @param {boolean} doCancelEvent If event should be canceled after callback.
866 * @return {!o3d.EventCallback} Wrapped handler function. 866 * @return {!o3d.EventCallback} Wrapped handler function.
867 * @private 867 * @private
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
1283 * Gets info about the client. 1283 * Gets info about the client.
1284 */ 1284 */
1285 o3d.Client.prototype.clientInfo = null; 1285 o3d.Client.prototype.clientInfo = null;
1286 1286
1287 1287
1288 /** 1288 /**
1289 * The canvas associated with this client. 1289 * The canvas associated with this client.
1290 * @type {Element} 1290 * @type {Element}
1291 */ 1291 */
1292 o3d.Client.prototype.canvas = null; 1292 o3d.Client.prototype.canvas = null;
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698