Skip to content

Commit

Permalink
Merge branch 'gtp-engines'
Browse files Browse the repository at this point in the history
  • Loading branch information
yishn committed Sep 7, 2015
2 parents 9e8d95b + 05e28d6 commit 8ffd257
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 5 deletions.
1 change: 1 addition & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ setting
.default('sound.enable', true)
.default('view.comments_height', 50)
.default('view.comments_minheight', 20)
.default('view.console_width', 400)
.default('view.fuzzy_stone_placement', true)
.default('view.show_comments', false)
.default('view.show_coordinates', false)
Expand Down
16 changes: 16 additions & 0 deletions style/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,22 @@ header, #edit, #scoring, #find, #progress {
margin-top: -10px;
}

#console {
display: none;
position: absolute;
top: 0;
bottom: 0;
left: 0;
width: 400px;
background: #111;
}
.console #console {
display: block;
}
.console #main {
left: 400px;
}

#sidebar {
display: none;
position: absolute;
Expand Down
11 changes: 11 additions & 0 deletions view/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@
</head>
<body>

<section id="console">
<div class="verticalresizer"></div>

<div class="gm-scrollbar -vertical"><div class="thumb"></div></div>
<div class="gm-scrollbar -horizontal"><div class="thumb"></div></div>
<div class="gm-scroll-view">
<div class="inner">
</div>
</div>
</section>

<section id="main">
<section id="goban" class="goban">
<div></div>
Expand Down
31 changes: 26 additions & 5 deletions view/index.view.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,27 @@ function setShowCoordinates(show) {
getMainMenu().items[3].submenu.items[1].checked = show
}

function getShowConsole() {
return document.body.hasClass('console')
}

function setShowConsole(show) {
if (getShowConsole() == show) return
if (show) document.body.addClass('console')
else document.body.removeClass('console')

$('console').setStyle('width', setting.get('view.console_width'))
$('main').setStyle('left', show ? setting.get('view.console_width') : 0)

// Resize window
var win = remote.getCurrentWindow()
var size = win.getContentSize()

if (!win.isMaximized())
win.setContentSize(size[0] + (show ? 1 : -1) * setting.get('view.console_width'), size[1])
resizeBoard()
}

function getShowSidebar() {
return document.body.hasClass('sidebar')
}
Expand Down Expand Up @@ -88,10 +109,10 @@ function setShowSidebar(show) {
// Resize window
var win = remote.getCurrentWindow()
var size = win.getContentSize()
resizeBoard()

if (win.isMaximized()) return
win.setContentSize(size[0] + (show ? 1 : -1) * setting.get('view.sidebar_width'), size[1])
if (!win.isMaximized())
win.setContentSize(size[0] + (show ? 1 : -1) * setting.get('view.sidebar_width'), size[1])
resizeBoard()
}

function getSidebarArrangement() {
Expand Down Expand Up @@ -852,9 +873,9 @@ document.addEvent('domready', function() {

// Resize sidebar

$$('#sidebar .verticalresizer').addEvent('mousedown', function() {
$$('.verticalresizer').addEvent('mousedown', function() {
if (event.button != 0) return
$('sidebar').store('initposx', new Tuple(event.x, getSidebarWidth()))
this.getParent().store('initposx', new Tuple(event.x, getSidebarWidth()))
})
$$('#sidebar .horizontalresizer').addEvent('mousedown', function() {
if (event.button != 0) return
Expand Down

0 comments on commit 8ffd257

Please sign in to comment.