Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Commit

Permalink
Merge pull request #12636 from adobe/marcel/rework-tree-selection
Browse files Browse the repository at this point in the history
Rework how file selection is shown
  • Loading branch information
zaggino authored Aug 16, 2016
2 parents 1cd8d9c + 618d49e commit 271943a
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 21 deletions.
6 changes: 0 additions & 6 deletions src/project/FileTreeView.js
Original file line number Diff line number Diff line change
Expand Up @@ -827,16 +827,10 @@ define(function (require, exports, module) {
width = selectionViewInfo.get("width"),
scrollWidth = selectionViewInfo.get("scrollWidth");

// Avoid endless horizontal scrolling
if (left + width > scrollWidth) {
left = scrollWidth - width;
}

return DOM.div({
style: {
overflow: "auto",
left: left,
width: width,
display: this.props.visible ? "block" : "none"
},
className: this.props.className
Expand Down
2 changes: 1 addition & 1 deletion src/project/ProjectManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -1163,7 +1163,7 @@ define(function (require, exports, module) {
*/
function _setFileTreeSelectionWidth(width) {
model.setSelectionWidth(width);
_renderTree();
_renderTreeSync();
}

// Initialize variables and listeners that depend on the HTML DOM
Expand Down
11 changes: 0 additions & 11 deletions src/project/SidebarView.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,27 +186,17 @@ define(function (require, exports, module) {
$projectFilesContainer = $sidebar.find("#project-files-container");
$workingSetViewsContainer = $sidebar.find("#working-set-list-container");

function _resizeSidebarSelection() {
var $element;
$sidebar.find(".sidebar-selection").each(function (index, element) {
$element = $(element);
$element.width($element.parent()[0].scrollWidth);
});
}

// init
$sidebar.on("panelResizeStart", function (evt, width) {
$sidebar.find(".sidebar-selection-extension").css("display", "none");
$sidebar.find(".scroller-shadow").css("display", "none");
});

$sidebar.on("panelResizeUpdate", function (evt, width) {
$sidebar.find(".sidebar-selection").width(width);
ProjectManager._setFileTreeSelectionWidth(width);
});

$sidebar.on("panelResizeEnd", function (evt, width) {
_resizeSidebarSelection();
$sidebar.find(".sidebar-selection-extension").css("display", "block").css("left", width);
$sidebar.find(".scroller-shadow").css("display", "block");
$projectFilesContainer.triggerHandler("scroll");
Expand All @@ -219,7 +209,6 @@ define(function (require, exports, module) {

$sidebar.on("panelExpanded", function (evt, width) {
WorkingSetView.refresh();
_resizeSidebarSelection();
$sidebar.find(".scroller-shadow").css("display", "block");
$sidebar.find(".sidebar-selection-extension").css("left", width);
$projectFilesContainer.triggerHandler("scroll");
Expand Down
2 changes: 2 additions & 0 deletions src/styles/brackets.less
Original file line number Diff line number Diff line change
Expand Up @@ -968,6 +968,7 @@ a, img {
border-bottom: 1px solid @bc-highlight;
box-sizing: border-box;
height: 23px;
width: 100%;
position: absolute;
}

Expand Down Expand Up @@ -998,6 +999,7 @@ a, img {
box-sizing: border-box;
position: absolute;
height: 23px;
width: 100%;
}

//Initially start with the open files hidden, they will get show as files are added
Expand Down
3 changes: 0 additions & 3 deletions src/utils/ViewUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,6 @@ define(function (require, exports, module) {
// list item position is relative to scroller
var selectionMarkerTop = $listItem.offset().top - $scrollerElement.offset().top + $scrollerElement.get(0).scrollTop;

// force selection width to match scroller
$selectionMarker.width($scrollerElement.get(0).scrollWidth);

// move the selectionMarker position to align with the list item
$selectionMarker.css("top", selectionMarkerTop);
$selectionMarker.show();
Expand Down

0 comments on commit 271943a

Please sign in to comment.