Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Fixed draggable areas of window.
Browse files Browse the repository at this point in the history
- parent item marks all as draggable
- child items exclude themself as needed
- parent level draggable is disregarded if modal is open, menu is open, etc (using shouldAllowWindowDrag)

Other touch-ups:
- tabs bar is now draggable (no longer right-clickable)
- caption button drag and surrounding area is correct now
- after acceptance of electron PR, corners are easy to click (hit testing)

Fixes #4235
Fixes #4144

Depends on brave/muon#63

Auditors: @bbondy @jonathansampson
  • Loading branch information
bsclifton committed Sep 27, 2016
1 parent 41acbd0 commit 2aae438
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 46 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Logs
logs
*.log
npm-debug.log.*

# Runtime data
pids
Expand Down
4 changes: 0 additions & 4 deletions app/renderer/components/windowCaptionButtons.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,6 @@ class WindowCaptionButtons extends ImmutableComponent {
</div>
</button>
</div>
<div className={cx({
deadArea: true,
allowDragging: this.props.shouldAllowWindowDrag
})} />
</div>
}
}
Expand Down
17 changes: 8 additions & 9 deletions js/components/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,10 @@ class Main extends ImmutableComponent {
: null
}
<div className='top'>
<div className='navbarCaptionButtonContainer'>
<div className={cx({
navbarCaptionButtonContainer: true,
allowDragging: shouldAllowWindowDrag
})}>
<div className='navbarMenubarFlexContainer'>
{
customTitlebar.menubarVisible
Expand All @@ -881,10 +884,6 @@ class Main extends ImmutableComponent {
contextMenuDetail={this.props.windowState.get('contextMenuDetail')}
autohide={getSetting(settings.AUTO_HIDE_MENU)}
lastFocusedSelector={customTitlebar.lastFocusedSelector} />
<div className={cx({
deadArea: true,
allowDragging: shouldAllowWindowDrag
})} />
</div>
: null
}
Expand Down Expand Up @@ -933,7 +932,7 @@ class Main extends ImmutableComponent {
/>
<div className='topLevelEndButtons'>
<div className={cx({
deadArea: true,
extraDragArea: true,
allowDragging: shouldAllowWindowDrag
})} />
{
Expand All @@ -952,7 +951,7 @@ class Main extends ImmutableComponent {
</div>
{
customTitlebar.captionButtonsVisible
? <WindowCaptionButtons windowMaximized={customTitlebar.isMaximized} shouldAllowWindowDrag={shouldAllowWindowDrag} />
? <WindowCaptionButtons windowMaximized={customTitlebar.isMaximized} />
: null
}
</div>
Expand Down Expand Up @@ -1052,7 +1051,7 @@ class Main extends ImmutableComponent {
}
<div className={cx({
tabPages: true,
allowDragging: shouldAllowWindowDrag && !isWindows,
allowDragging: shouldAllowWindowDrag,
singlePage: nonPinnedFrames.size <= tabsPerPage
})}
onContextMenu={this.onTabContextMenu}>
Expand All @@ -1067,7 +1066,7 @@ class Main extends ImmutableComponent {
</div>
<TabsToolbar
paintTabs={getSetting(settings.PAINT_TABS)}
shouldAllowWindowDrag={shouldAllowWindowDrag && !isWindows}
shouldAllowWindowDrag={shouldAllowWindowDrag}
draggingOverData={this.props.windowState.getIn(['ui', 'dragging', 'draggingOver', 'dragType']) === dragTypes.TAB && this.props.windowState.getIn(['ui', 'dragging', 'draggingOver'])}
previewTabs={getSetting(settings.SHOW_TAB_PREVIEWS)}
tabsPerTabPage={tabsPerPage}
Expand Down
45 changes: 12 additions & 33 deletions less/navigationBar.less
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@
padding-left: 5px;
padding-top: 5px;
}

#urlInput { width: 100%; }

// changes to ensure window can be as small as 480px wide
// and still be useable and have the caption buttons intact
@media (max-width: @breakpointExtensionButtonPadding) {
.navigatorWrapper .topLevelEndButtons .deadArea {
.navigatorWrapper .topLevelEndButtons .extraDragArea {
width: 0;
}
}
Expand Down Expand Up @@ -76,6 +76,10 @@
.navbarCaptionButtonContainer {
display: flex;
border-bottom: 1px solid #aaaaaa;

&.allowDragging {
-webkit-app-region: drag;
}
}
.navbarMenubarFlexContainer {
display: flex;
Expand All @@ -95,7 +99,6 @@
.windowCaptionButtons {
display: flex;
flex-direction: column;

white-space: nowrap;

.hidden {
Expand All @@ -116,6 +119,7 @@
.container {
display: flex;
flex-grow: 0;
-webkit-app-region: no-drag;
}

.win7 {
Expand Down Expand Up @@ -410,17 +414,6 @@
}
}
}

.deadArea {
display: flex;
flex-grow:1;
&.allowDragging {
-webkit-app-region: drag;
>* {
-webkit-app-region: no-drag;
}
}
}
}

// Menubar (for use w/ slim titlebar)
Expand Down Expand Up @@ -454,17 +447,6 @@
border: 1px solid #99d1ff !important;
}
}
.deadArea {
display: flex;
flex-grow: 1;

&.allowDragging {
-webkit-app-region: drag;
>* {
-webkit-app-region: no-drag;
}
}
}
}

// Here I grouped the rules to keep the layout of the top bar consistent.
Expand Down Expand Up @@ -530,6 +512,10 @@
display: flex;
flex-direction: row;

.extensionButton {
-webkit-app-region: no-drag;
}

.braveMenu {
width: @navbarBraveButtonWidth;
margin-right: @navbarButtonSpacing;
Expand All @@ -550,17 +536,10 @@
}
}

.deadArea {
.extraDragArea {
display: flex;
flex-grow: 0;
width: @navbarBraveButtonMarginLeft;

&.allowDragging {
-webkit-app-region: drag;
>* {
-webkit-app-region: no-drag;
}
}
}
}
}
Expand Down

0 comments on commit 2aae438

Please sign in to comment.