Skip to content

Commit

Permalink
Flying speed now depends on graph size
Browse files Browse the repository at this point in the history
Hopefully this will make controls less sensitive
  • Loading branch information
anvaka committed Aug 6, 2015
1 parent 45ed887 commit 997d9b2
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
6 changes: 6 additions & 0 deletions src/galaxy/help.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ function help(x) {
<td><code>spacebar</code></td>
<td>Toggle Steering</td>
</tr>
<tr>
<td><code>shift</code></td>
<td>Move faster</td>
<td><code></code></td>
<td></td>
</tr>
</tbody></table>
</div>
);
Expand Down
19 changes: 16 additions & 3 deletions src/galaxy/native/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,11 @@ function sceneRenderer(container) {
function accelarate(isPrecise) {
var input = renderer.input();
if (isPrecise) {
input.movementSpeed /= 8;
input.movementSpeed *= 4;
input.rollSpeed *= 4;
} else {
input.movementSpeed *= 8;
input.movementSpeed /= 4;
input.rollSpeed /= 4;
}
}

Expand Down Expand Up @@ -117,7 +119,6 @@ function sceneRenderer(container) {
touchControl = createTouchControl(renderer);
moveCameraInternal();
var input = renderer.input();
input.movementSpeed *= 2.5;
input.on('move', clearHover);
}

Expand All @@ -127,6 +128,17 @@ function sceneRenderer(container) {
hitTest.on('over', handleOver);
hitTest.on('click', handleClick);
hitTest.on('dblclick', handleDblClick);
hitTest.on('hitTestReady', adjustMovementSpeed);
}

function adjustMovementSpeed(tree) {
var input = renderer.input();
if (tree) {
var root = tree.getRoot();
input.movementSpeed = root.bounds.half * 0.02;
} else {
input.movementSpeed *= 2;
}
}

function focusScene() {
Expand Down Expand Up @@ -211,6 +223,7 @@ function sceneRenderer(container) {
hitTest.off('over', handleOver);
hitTest.off('click', handleClick);
hitTest.off('dblclick', handleDblClick);
hitTest.off('hitTestReady', adjustMovementSpeed);
}

function handleClick(e) {
Expand Down
1 change: 1 addition & 0 deletions src/galaxy/service/graphLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ function loadGraph(name, progress) {
var links = new Int32Array(buffer);
var lastArray = [];
outLinks[0] = lastArray;
// TODO: Report progress?
asyncFor(links, processLink, reportBack);
var deffered = defer();

Expand Down

0 comments on commit 997d9b2

Please sign in to comment.