diff --git a/src/content/components/TranslatePanel.js b/src/content/components/TranslatePanel.js index 6edc905..39bd464 100644 --- a/src/content/components/TranslatePanel.js +++ b/src/content/components/TranslatePanel.js @@ -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") diff --git a/src/content/styles/TranslatePanel.scss b/src/content/styles/TranslatePanel.scss index 3b4466e..3c70820 100644 --- a/src/content/styles/TranslatePanel.scss +++ b/src/content/styles/TranslatePanel.scss @@ -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;