Skip to content

Commit

Permalink
Per-window sidebars (close #265)
Browse files Browse the repository at this point in the history
  • Loading branch information
yishn committed Sep 9, 2017
1 parent cd51033 commit e1b9a65
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ All notable changes to this project will be documented in this file.

* Change 'Remove Node' shortcut to <kbd>Command+Backspace</kbd> on macOS
* Change 'Fullscreen' shortcut to <kbd>F11</kbd> on Linux and Windows
* Per-window sidebars (see #265)
* Update to Electron v1.8.0 beta

**Fixed**
Expand Down
19 changes: 8 additions & 11 deletions components/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ class App extends Component {

// Sidebar

showConsole: null,
consoleLog: [],
leftSidebarWidth: null,
showGameGraph: null,
showCommentBox: null,
sidebarWidth: null,
showConsole: setting.get('view.show_leftsidebar'),
leftSidebarWidth: setting.get('view.leftsidebar_width'),
showGameGraph: setting.get('view.show_graph'),
showCommentBox: setting.get('view.show_comments'),
sidebarWidth: setting.get('view.sidebar_width'),
graphGridSize: null,
graphNodeSize: null,

Expand Down Expand Up @@ -286,7 +286,9 @@ class App extends Component {
widthDiff += this.state.leftSidebarWidth * (this.state.showLeftSidebar ? 1 : -1)
}

this.window.setContentSize(width + widthDiff, height)
if (!this.window.isMaximized() && !this.window.isMinimized() && !this.window.isFullScreen()) {
this.window.setContentSize(width + widthDiff, height)
}
}

// Handle zoom factor
Expand All @@ -306,11 +308,6 @@ class App extends Component {
'view.show_siblings': 'showSiblings',
'view.fuzzy_stone_placement': 'fuzzyStonePlacement',
'view.animated_stone_placement': 'animatedStonePlacement',
'view.show_leftsidebar': 'showConsole',
'view.leftsidebar_width': 'leftSidebarWidth',
'view.show_graph': 'showGameGraph',
'view.show_comments': 'showCommentBox',
'view.sidebar_width': 'sidebarWidth',
'graph.grid_size': 'graphGridSize',
'graph.node_size': 'graphNodeSize',
'engines.list': 'engines',
Expand Down
15 changes: 12 additions & 3 deletions data/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,10 @@ let data = [
{type: 'separator'},
{
label: 'Toggle &GTP Console',
click: () => toggleSetting('view.show_leftsidebar')
click: () => {
toggleSetting('view.show_leftsidebar')
sabaki.setState(({showConsole}) => ({showConsole: !showConsole}))
}
},
{
label: '&Clear Console',
Expand Down Expand Up @@ -437,13 +440,19 @@ let data = [
label: 'Show Game &Tree',
checked: 'view.show_graph',
accelerator: 'CmdOrCtrl+T',
click: () => toggleSetting('view.show_graph')
click: () => {
toggleSetting('view.show_graph')
sabaki.setState(({showGameGraph}) => ({showGameGraph: !showGameGraph}))
}
},
{
label: 'Show Co&mments',
checked: 'view.show_comments',
accelerator: 'CmdOrCtrl+Shift+T',
click: () => toggleSetting('view.show_comments')
click: () => {
toggleSetting('view.show_comments')
sabaki.setState(({showCommentBox}) => ({showCommentBox: !showCommentBox}))
}
},
{type: 'separator'},
{
Expand Down

0 comments on commit e1b9a65

Please sign in to comment.