Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dynamic link coloring and hotkeys, and rotations #38

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/galaxy/native/appConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ function appConfig() {
}

function getMaxVisibleEdgeLength() {
return hashConfig.maxVisibleDistance * hashConfig.maxVisibleDistance * hashConfig.scale;
var val = parseFloat(document.getElementById("range").value);
return val * val * hashConfig.scale;
}

function getCameraPosition() {
Expand Down
2 changes: 2 additions & 0 deletions src/galaxy/native/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ function sceneRenderer(container) {
appEvents.accelerateNavigation.on(accelarate);
appEvents.focusScene.on(focusScene);
appEvents.cls.on(cls);
appEvents.renderLinks.on(renderLineViewIfNeeded);

appConfig.on('camera', moveCamera);
appConfig.on('showLinks', toggleLinks);
Expand Down Expand Up @@ -191,6 +192,7 @@ function sceneRenderer(container) {
}

function toggleLinks() {
var lineViewNeedsUpdate = true;
if (lineView) {
if (lineViewNeedsUpdate) renderLineViewIfNeeded();
lineView.toggleLinks();
Expand Down
10 changes: 10 additions & 0 deletions src/galaxy/native/sceneKeyboardBinding.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ function sceneKeyboardBinding(container) {
// explicit request to render help
e.stopPropagation();
events.toggleHelp.fire();
} else if (e.which === Key.Minus) {
var el = document.getElementById("range");
el.value = parseFloat(el.value) - 10;
events.renderLinks.fire();
} else if (e.which === Key.Plus) {
var el = document.getElementById("range");
el.value = parseFloat(el.value) + 10;
events.renderLinks.fire();
} else if (e.which === Key.P) {
events.around.fire(2000,0,0,0);
}
if (e.shiftKey && !lastShiftKey) {
lastShiftKey = true;
Expand Down
8 changes: 8 additions & 0 deletions src/galaxy/scene.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ function scene(x) {
<WindowCollection />
<Help />
<About />
<div className='label about'>
Range
<input onChange={appEvents.renderLinks.fire} type="range" min="0" max="800" step="10" defaultValue="100" id="range" />
</div>
</div>
);
};
Expand All @@ -57,6 +61,10 @@ function scene(x) {

function handleDelegateClick(e) {
var clickedEl = e.target;
if (clickedEl.id == "range"){
appEvents.renderLinks.fire();
return
}

// since we are handling all clicks, we should avoid excessive work and
// talk with DOM only when absolutely necessary:
Expand Down
4 changes: 3 additions & 1 deletion src/galaxy/service/appEvents.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ export default eventMirror([
'around',
'queryChanged',

'accelerateNavigation'
'accelerateNavigation',

'renderLinks'
], appEvents);

5 changes: 4 additions & 1 deletion src/galaxy/utils/key.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ export default {
H: 72,
L: 76,
Space: 32,
'/': 191
'/': 191,
P: 80,
Minus:189,
Plus:187
};

function isModifier(e) {
Expand Down