Select entry on context menu in filemanager
This commit is contained in:
+11
-20
@@ -319,34 +319,25 @@ function FileTreeController($scope, $translate, $timeout, Client) {
|
||||
openPath(sanitize(path));
|
||||
};
|
||||
|
||||
$scope.select = function ($event, entry) {
|
||||
// we don't stop propagation for context menu closing, but if targets don't match we got the whole list click event
|
||||
$scope.onClearSelection = function ($event) {
|
||||
// we don't stop propagation if targets don't match we got the whole list click event
|
||||
if ($event.currentTarget !== $event.target) return;
|
||||
|
||||
if (!entry) {
|
||||
$scope.selected = [];
|
||||
return;
|
||||
}
|
||||
$scope.selected = [];
|
||||
};
|
||||
|
||||
$scope.onMousedown = function ($event, entry) {
|
||||
var i = $scope.selected.indexOf(entry);
|
||||
var multi = ($event.ctrlKey || $event.metaKey);
|
||||
|
||||
if ($event.button === 0) {
|
||||
// left click
|
||||
|
||||
if (multi) {
|
||||
if (i === -1) $scope.selected.push(entry);
|
||||
else $scope.selected.splice(i, 1);
|
||||
} else {
|
||||
$scope.selected = [ entry ];
|
||||
}
|
||||
} else if ($event.button === 2) {
|
||||
// right click
|
||||
|
||||
if (multi) {
|
||||
if (i === -1) {
|
||||
if (multi) $scope.selected.push(entry);
|
||||
else $scope.selected = [ entry ];
|
||||
$scope.selected.push(entry);
|
||||
} else if ($event.button === 0) { // only do this on left click
|
||||
$scope.selected.splice(i, 1);
|
||||
}
|
||||
} else {
|
||||
$scope.selected = [ entry ];
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user