Layout changes
This commit is contained in:
@@ -39,8 +39,8 @@
|
|||||||
"build": "react-scripts build",
|
"build": "react-scripts build",
|
||||||
"test": "react-scripts test",
|
"test": "react-scripts test",
|
||||||
"eject": "react-scripts eject",
|
"eject": "react-scripts eject",
|
||||||
"electron-dev": "cross-env ELECTRON_START_URL=http://localhost:3000 electron .",
|
"electron-dev": "cross-env ELECTRON_START_URL=http://localhost:3001 electron .",
|
||||||
"electron-dev-unix": "cross-env ELECTRON_START_URL=http://localhost:3000 electron .",
|
"electron-dev-unix": "cross-env ELECTRON_START_URL=http://localhost:3001 electron .",
|
||||||
"pack": "npm run build && electron-builder --dir --x64",
|
"pack": "npm run build && electron-builder --dir --x64",
|
||||||
"dist": "npm run build && electron-builder --x64",
|
"dist": "npm run build && electron-builder --x64",
|
||||||
"dist-all": "npm run build && electron-builder --x64 --win --linux --mac",
|
"dist-all": "npm run build && electron-builder --x64 --win --linux --mac",
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ const createWindow = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create the browser window.
|
// Create the browser window.
|
||||||
const height = (process.env.ELECTRON_START_URL || (os.platform() === 'darwin') ? 284 : 274) + ((os.platform() === 'win32') ? 30 : -20);
|
const height = (process.env.ELECTRON_START_URL || (os.platform() === 'darwin') ? 294 : 274) + ((os.platform() === 'win32') ? 30 : -20);
|
||||||
mainWindow = new BrowserWindow({
|
mainWindow = new BrowserWindow({
|
||||||
width: 428 + ((os.platform() === 'win32') ? 40 : (os.platform() === 'darwin') ? 150 : 160),
|
width: 428 + ((os.platform() === 'win32') ? 40 : (os.platform() === 'darwin') ? 150 : 160),
|
||||||
height: height,
|
height: height,
|
||||||
|
|||||||
@@ -3,8 +3,7 @@ import './Grid.css';
|
|||||||
import GridComponent from './GridComponent/GridComponent';
|
import GridComponent from './GridComponent/GridComponent';
|
||||||
|
|
||||||
export default class extends Component {
|
export default class extends Component {
|
||||||
checkSizeInterval;
|
resizeTimeout;
|
||||||
|
|
||||||
state = {
|
state = {
|
||||||
calculated: false,
|
calculated: false,
|
||||||
dimensions: {
|
dimensions: {
|
||||||
@@ -20,6 +19,16 @@ export default class extends Component {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
window.addEventListener('resize', this.handleResize);
|
||||||
|
this.updateSizeAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillUnmount() {
|
||||||
|
window.removeEventListener('resize', this.handleResize);
|
||||||
|
clearInterval(this.resizeTimeout);
|
||||||
|
};
|
||||||
|
|
||||||
getSize = () => {
|
getSize = () => {
|
||||||
const elem = this.refs.GridOwner;
|
const elem = this.refs.GridOwner;
|
||||||
return {
|
return {
|
||||||
@@ -28,6 +37,11 @@ export default class extends Component {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
handleResize = () => {
|
||||||
|
clearTimeout(this.resizeTimeout);
|
||||||
|
this.resizeTimeout = setTimeout(this.updateSizeAsync, 10);
|
||||||
|
};
|
||||||
|
|
||||||
updateSize = () => {
|
updateSize = () => {
|
||||||
const state = {
|
const state = {
|
||||||
...this.state
|
...this.state
|
||||||
@@ -43,25 +57,11 @@ export default class extends Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
updateSizeAsync = () => {
|
updateSizeAsync = () => {
|
||||||
return new Promise((done) => {
|
return new Promise(() => {
|
||||||
this.updateSize();
|
this.updateSize();
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
componentDidMount() {
|
|
||||||
window.addEventListener("resize", this.updateSizeAsync);
|
|
||||||
this.checkSizeInterval = setInterval(()=> {
|
|
||||||
this.updateSize()
|
|
||||||
}, 2000);
|
|
||||||
this.updateSizeAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
componentWillUnmount() {
|
|
||||||
window.removeEventListener("resize", this.updateSizeAsync);
|
|
||||||
clearInterval(this.checkSizeInterval);
|
|
||||||
};
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
let children = null;
|
let children = null;
|
||||||
const dimensions = this.state.dimensions;
|
const dimensions = this.state.dimensions;
|
||||||
@@ -91,17 +91,19 @@ export default class extends Component {
|
|||||||
rowSpan = rowSpan ? (rowSpan === 'remain' ? (dimensions.rows - row) : rowSpan) : null;
|
rowSpan = rowSpan ? (rowSpan === 'remain' ? (dimensions.rows - row) : rowSpan) : null;
|
||||||
colSpan = colSpan ? (colSpan === 'remain' ? dimensions.columns - col : colSpan) : null;
|
colSpan = colSpan ? (colSpan === 'remain' ? dimensions.columns - col : colSpan) : null;
|
||||||
|
|
||||||
return <GridComponent
|
return (
|
||||||
row={row}
|
<GridComponent row={row}
|
||||||
col={col}
|
col={col}
|
||||||
rowSpan={rowSpan}
|
rowSpan={rowSpan}
|
||||||
colSpan={colSpan}
|
colSpan={colSpan}
|
||||||
key={'gc_' + i}>{child}</GridComponent>;
|
key={'gc_' + i}>
|
||||||
|
{child}
|
||||||
|
</GridComponent>
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
.filter(i => i !== null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let style = {
|
let style = {
|
||||||
@@ -112,10 +114,12 @@ export default class extends Component {
|
|||||||
gridAutoRows: '4px',
|
gridAutoRows: '4px',
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (this.props.noScroll) {
|
if (this.props.noScroll) {
|
||||||
style['style'].overflowX = 'visible';
|
style['style'].overflowX = 'visible';
|
||||||
style['style'].overflowY = 'visible';
|
style['style'].overflowY = 'visible';
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
ref='GridOwner'
|
ref='GridOwner'
|
||||||
@@ -125,5 +129,5 @@ export default class extends Component {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
};
|
}
|
||||||
};
|
};
|
||||||
Reference in New Issue
Block a user