Fix overflow problem in content

This commit is contained in:
sienori 2019-02-23 03:30:09 +09:00
parent f16826ab74
commit 267b25777e
2 changed files with 10 additions and 3 deletions

View file

@ -16,7 +16,8 @@ export default class TranslatePanel extends Component {
panelPosition: { x: 0, y: 0 },
panelWidth: 0,
panelHeight: 0,
shouldResize: true
shouldResize: true,
isOverflow: false
};
this.isFirst = true;
}
@ -72,11 +73,14 @@ export default class TranslatePanel extends Component {
if (!this.state.shouldResize || !this.props.shouldShow) return;
const panelPosition = this.calcPosition();
const { panelWidth, panelHeight } = this.calcSize();
const isOverflow = panelHeight == parseInt(getSettings("height"));
this.setState({
shouldResize: false,
panelPosition: panelPosition,
panelWidth: panelWidth,
panelHeight: panelHeight
panelHeight: panelHeight,
isOverflow: isOverflow
});
};
@ -96,7 +100,7 @@ export default class TranslatePanel extends Component {
backgroundColor: getSettings("bgColor")
};
const wrapperStyles = {
overflow: this.state.shouldResize ? "hidden" : "auto"
overflow: this.state.isOverflow ? "auto" : "hidden"
};
const resultStyles = {
color: getSettings("resultFontColor")

View file

@ -2,6 +2,7 @@
.simple-translate-panel {
all: initial;
position: fixed;
overflow: hidden;
background-color: var(--simple-translate-main-bg);
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.16), 0 0 0 1px rgba(0, 0, 0, 0.08);
border-radius: 3px;
@ -23,6 +24,8 @@
height: max-content;
max-width: 100%;
max-height: 100%;
overflow: auto;
p {
all: initial;
display: block;