Skip to content

Commit

Permalink
Fixed bug with title bar in macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielbull committed Jun 24, 2016
1 parent 05c7851 commit 328b8a5
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 16 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## 0.2.3 (June 24th, 2016)

- Fixed bug with title bar in macOS

## 0.2.2 (June 24th, 2016)

- Added Link component for macOS
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "react-desktop",
"author": "Gabriel Bull",
"version": "0.2.2",
"version": "0.2.3",
"description": "React UI Components for macOS Sierra and Windows 10",
"main": "./index.js",
"keywords": [
Expand Down
32 changes: 17 additions & 15 deletions src/titleBar/macOs/titleBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,23 @@ class TitleBar extends Component {
}

resize = () => {
const barRect = this.refs.element.getBoundingClientRect();
this.refs.title.style.overflow = 'visible';
this.refs.title.style.paddingRight = 0;
this.refs.title.style.flexGrow = 0;
const titleRect = this.refs.title.getBoundingClientRect();
this.refs.title.style.overflow = 'hidden';
this.refs.title.style.flexGrow = 1;

const barWidth = barRect.width - 6;
const contentWidth = titleRect.width + (this.props.controls ? 60 : 0);

let padding = barWidth - contentWidth;
if (padding > 60) padding = 60;

this.refs.title.style.paddingRight = (padding) + 'px';
if (this.refs.title) {
const barRect = this.refs.element.getBoundingClientRect();
this.refs.title.style.overflow = 'visible';
this.refs.title.style.paddingRight = 0;
this.refs.title.style.flexGrow = 0;
const titleRect = this.refs.title.getBoundingClientRect();
this.refs.title.style.overflow = 'hidden';
this.refs.title.style.flexGrow = 1;

const barWidth = barRect.width - 6;
const contentWidth = titleRect.width + (this.props.controls ? 60 : 0);

let padding = barWidth - contentWidth;
if (padding > 60) padding = 60;

this.refs.title.style.paddingRight = (padding) + 'px';
}
};

render() {
Expand Down

0 comments on commit 328b8a5

Please sign in to comment.