Skip to content
This repository has been archived by the owner on Jan 22, 2024. It is now read-only.

Commit

Permalink
Merge pull request #100 from thirdknife/selectinverse_bp
Browse files Browse the repository at this point in the history
Select-inverse of current selection via Cmd/crtl-I
  • Loading branch information
tnrich committed Nov 9, 2015
2 parents 78fc752 + c9ef76d commit 8c9bb28
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/SequenceEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class SequenceEditor extends React.Component {
sequenceDataInserted,
backspacePressed,
selectAll,
selectInverse,
} = this.props.signals;
var self = this;
combokeys = new Combokeys(document.documentElement);
Expand Down Expand Up @@ -101,6 +102,10 @@ class SequenceEditor extends React.Component {
selectAll();
event.stopPropagation();
});
combokeys.bindGlobal('command+ctrl+i', function(event) { // Handle shortcut
selectInverse();
event.stopPropagation();
});
}

handlePaste(event) {
Expand Down
11 changes: 11 additions & 0 deletions app/actions/selectInverse.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export default function selectInverse(input, tree, output) {
//compare the sequenceString being pasted in with what's already stored in the clipboard
var selectionLayer = tree.get(['selectionLayer']);

output({
selectionLayer: {
start: selectionLayer.end,
end: selectionLayer.start - 1
}
});
}
1 change: 1 addition & 0 deletions app/signals.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export default function registerSignals(controller, options) {
error: [] //tnr: we should probably have some sort of generic info/warning message that we can display when things go wrong
}]);
controller.signal('selectAll', [a.selectAll, a.setSelectionLayer]);
controller.signal('selectInverse', [a.selectInverse, a.setSelectionLayer]);
controller.signal('sequenceDataInserted', [
a.getData('selectionLayer', 'sequenceLength', 'sequenceData'),
a.checkLayerIsSelected, {
Expand Down

0 comments on commit 8c9bb28

Please sign in to comment.