Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Commit

Permalink
Fix #4652, bring textbox into view when refocusing
Browse files Browse the repository at this point in the history
  • Loading branch information
testeaxeax committed Sep 12, 2018
1 parent 596dc2a commit c508586
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions server/src/pages/shot/text-tool.js
Expand Up @@ -152,10 +152,10 @@ exports.TextTool = class TextTool extends React.Component {
this.setState({color, colorName});

const txtInput = this.textInput.current;
txtInput.focus();
if (!this.isElementInViewPort(txtInput)) {
txtInput.scrollIntoView({block: "center"});
}
txtInput.focus();
}

onDragMouseDown(e) {
Expand Down Expand Up @@ -260,15 +260,20 @@ exports.TextTool = class TextTool extends React.Component {
const txtInput = this.textInput.current;

this.setState({textSize: size});
txtInput.focus();
if (!this.isElementInViewPort(txtInput)) {
txtInput.scrollIntoView({block: "center"});
}
txtInput.focus();
}

onInput() {
const txtInput = this.textInput.current;

hasFirstInput = true;
this.adjustX();
if (!this.isElementInViewPort(txtInput)) {
txtInput.scrollIntoView({block: "center"});
}
}

adjustWidth() {
Expand Down

0 comments on commit c508586

Please sign in to comment.