Commit 8bfede51 authored by Fabian-Andree Heidemann's avatar Fabian-Andree Heidemann
Browse files

fix #1851 - multiple selection with shift (testing requested)

parent 250e68bb
...@@ -77,6 +77,15 @@ define(["jquery", "jclass"], function($, JClass) { ...@@ -77,6 +77,15 @@ define(["jquery", "jclass"], function($, JClass) {
} }
if (self.FileBase.workflow.selectmode) { if (self.FileBase.workflow.selectmode) {
self.FileBase.selections.changeSelection(node, true); self.FileBase.selections.changeSelection(node, true);
} else if (self.FileBase.workflow.selectmodeMultiple) {
// multiple selection with shift (default)
var indexOfCurrentNode = node.parent().children().index(node);
var indexOfLastNode = node.parent().children().index(self.FileBase.selections.lastSelectedNode);
var krementer = (indexOfCurrentNode - indexOfLastNode);
krementer /= Math.abs(krementer);
while (!node.attr("selected")) {
self.FileBase.selections.selectArbitNode(krementer);
}
} else if ((vispa.device.hasTouch || openstring == "click") && Object.keys(self.FileBase } else if ((vispa.device.hasTouch || openstring == "click") && Object.keys(self.FileBase
.selections .selections
.entries).length > 0) { .entries).length > 0) {
...@@ -97,12 +106,23 @@ define(["jquery", "jclass"], function($, JClass) { ...@@ -97,12 +106,23 @@ define(["jquery", "jclass"], function($, JClass) {
node.click(function(event) { node.click(function(event) {
if (self.FileBase.instance._shortcuts.singleSelect == "keydown:meta" && if (self.FileBase.instance._shortcuts.singleSelect == "keydown:meta" &&
event.metaKey) self.FileBase.workflow.selectmode = true; event.metaKey) self.FileBase.workflow.selectmode = true;
if (!self.FileBase.workflow.selectmode) { if (!self.FileBase.workflow.selectmode && !self.FileBase.workflow.selectmodeMultiple) {
self.FileBase.selections.unselectAll(); self.FileBase.selections.unselectAll();
} }
event.preventDefault(); event.preventDefault();
self.FileBase.menuitems.hideMenu(); self.FileBase.menuitems.hideMenu();
self.FileBase.selections.changeSelection(node, true); if (self.FileBase.workflow.selectmodeMultiple) {
// multiple selection with shift (default)
var indexOfCurrentNode = node.parent().children().index(node);
var indexOfLastNode = node.parent().children().index(self.FileBase.selections.lastSelectedNode);
var krementer = (indexOfCurrentNode - indexOfLastNode);
krementer /= Math.abs(krementer);
while (!node.attr("selected")) {
self.FileBase.selections.selectArbitNode(krementer);
}
} else {
self.FileBase.selections.changeSelection(node, true);
}
if (self.FileBase.instance._shortcuts.singleSelect == "keydown:meta" && if (self.FileBase.instance._shortcuts.singleSelect == "keydown:meta" &&
event.metaKey) self.FileBase.workflow.selectmode = false; event.metaKey) self.FileBase.workflow.selectmode = false;
}); });
......
...@@ -167,7 +167,7 @@ define(["jquery", "jclass"], function($, JClass) { ...@@ -167,7 +167,7 @@ define(["jquery", "jclass"], function($, JClass) {
if (selectNode.length === 0) { if (selectNode.length === 0) {
return; return;
} }
if (!this.FileBase.workflow.selectmode) { if (!this.FileBase.workflow.selectmode && !this.FileBase.workflow.selectmodeMultiple) {
this.unselectAll(); this.unselectAll();
} }
this.changeSelection(selectNode, true); this.changeSelection(selectNode, true);
......
...@@ -17,6 +17,22 @@ define(function() { ...@@ -17,6 +17,22 @@ define(function() {
this.fb.workflow.selectmode = false; this.fb.workflow.selectmode = false;
} }
}, },
multipleSelect: {
description: "Key for selection of multiple files or folders",
value: "keydown:shift",
callback: function(event) {
event.preventDefault();
this.fb.workflow.selectmodeMultiple = true;
}
},
abortMultipleSelect: {
description: "Key for selection of multiple files or folders",
value: "keyup:shift",
callback: function(event) {
event.preventDefault();
this.fb.workflow.selectmodeMultiple = false;
}
},
copy: { copy: {
description: "Copy current selection", description: "Copy current selection",
value: ctrlMeta+"+c", value: ctrlMeta+"+c",
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment