analysis: exit variation with shift+left or shift+h
This commit is contained in:
parent
80a83f8899
commit
0dddd28e3c
|
@ -77,5 +77,11 @@ module.exports = {
|
|||
enterVariation: function(ctrl) {
|
||||
if (canEnterVariation(ctrl))
|
||||
ctrl.userJump(path.withVariation(ctrl.vm.path, 1));
|
||||
},
|
||||
|
||||
exitVariation: function(ctrl) {
|
||||
var p = ctrl.vm.path
|
||||
if (p.length > 1)
|
||||
ctrl.userJump(path.withoutVariation(p));
|
||||
}
|
||||
};
|
||||
|
|
|
@ -19,11 +19,15 @@ module.exports = function(ctrl) {
|
|||
control.prev(ctrl);
|
||||
m.redraw();
|
||||
}));
|
||||
k.bind(['shift+left', 'shift+h'], preventing(function() {
|
||||
control.exitVariation(ctrl);
|
||||
m.redraw();
|
||||
}));
|
||||
k.bind(['right', 'l'], preventing(function() {
|
||||
control.next(ctrl);
|
||||
m.redraw();
|
||||
}));
|
||||
k.bind('shift+right', preventing(function() {
|
||||
k.bind(['shift+right', 'shift+l'], preventing(function() {
|
||||
control.enterVariation(ctrl);
|
||||
m.redraw();
|
||||
}));
|
||||
|
|
|
@ -58,5 +58,14 @@ module.exports = {
|
|||
variation: null
|
||||
});
|
||||
return p2;
|
||||
},
|
||||
|
||||
withoutVariation: function(path) {
|
||||
var p2 = path.slice(0, path.length - 1);
|
||||
var last = p2.length - 1;
|
||||
p2[last] = copy(p2[last], {
|
||||
variation: null
|
||||
});
|
||||
return p2;
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue