Jelajahi Sumber

Include selected entity in multi selection on first click

James Allen 10 tahun lalu
induk
melakukan
938b042f8c

+ 3 - 0
services/web/public/coffee/ide/file-tree/FileTreeManager.coffee

@@ -131,6 +131,9 @@ define [
 			@forEachEntity (entity) ->
 			@forEachEntity (entity) ->
 				entity.multiSelected = false
 				entity.multiSelected = false
 			@$scope.multiSelectedCount = 0
 			@$scope.multiSelectedCount = 0
+		
+		multiSelectSelectedEntity: () ->
+			@findSelectedEntity()?.multiSelected = true
 
 
 		findSelectedEntity: () ->
 		findSelectedEntity: () ->
 			selected = null
 			selected = null

+ 7 - 3
services/web/public/coffee/ide/file-tree/controllers/FileTreeEntityController.coffee

@@ -5,16 +5,20 @@ define [
 		$scope.select = (e) ->
 		$scope.select = (e) ->
 			if e.ctrlKey or e.metaKey
 			if e.ctrlKey or e.metaKey
 				e.stopPropagation()
 				e.stopPropagation()
-				ide.fileTreeManager.toggleMultiSelectEntity($scope.entity)
+				initialMultiSelectCount = ide.fileTreeManager.multiSelectedCount()
+				ide.fileTreeManager.toggleMultiSelectEntity($scope.entity) == 0
+				if initialMultiSelectCount == 0
+					# On first multi selection, also include the current active/open file.
+					ide.fileTreeManager.multiSelectSelectedEntity()
 			else
 			else
 				ide.fileTreeManager.selectEntity($scope.entity)
 				ide.fileTreeManager.selectEntity($scope.entity)
 				$scope.$emit "entity:selected", $scope.entity
 				$scope.$emit "entity:selected", $scope.entity
 		
 		
 		$scope.draggableHelper = () ->
 		$scope.draggableHelper = () ->
 			if ide.fileTreeManager.multiSelectedCount() > 0
 			if ide.fileTreeManager.multiSelectedCount() > 0
-				return $("<div style='z-index:100'>#{ide.fileTreeManager.multiSelectedCount()} Files</div>")
+				return $("<strong style='z-index:100'>#{ide.fileTreeManager.multiSelectedCount()} Files</strong>")
 			else
 			else
-				return $("<div style='z-index:100'>#{$scope.entity.name}</div>")
+				return $("<strong style='z-index:100'>#{$scope.entity.name}</strong>")
 
 
 		$scope.inputs =
 		$scope.inputs =
 			name: $scope.entity.name
 			name: $scope.entity.name