Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
matthoward366 committed Dec 4, 2024
1 parent 7f359fb commit fa595f3
Showing 1 changed file with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class PropertiesMain extends React.Component {
this.state = {
showPropertiesButtons: true,
editorSize: editorSize,
showResizeBtn: 1
showResizeBtn: true
};
this.applyPropertiesEditing = this.applyPropertiesEditing.bind(this);
this.showPropertiesButtons = this.showPropertiesButtons.bind(this);
Expand All @@ -98,6 +98,9 @@ class PropertiesMain extends React.Component {
this._getResizeButton = this._getResizeButton.bind(this);
this._isResizeButtonRequired = this._isResizeButtonRequired.bind(this);
this.onBlur = this.onBlur.bind(this);
this.detectResize = this.detectResize.bind(this);
// used to tracked when the resize button is clicked and ignore detectResize
this.resizeClicked = false;
}

componentDidMount() {
Expand Down Expand Up @@ -430,8 +433,7 @@ class PropertiesMain extends React.Component {
}

resize() {
// Increment resize btn counter to show btn on click
this.setState((prevState) => ({ showResizeBtn: prevState.showResizeBtn + 1 }));
this.resizeClicked = true;
if (this.propertiesController.getForm().editorSize === Size.SMALL) {
if (this.state.editorSize === Size.SMALL) {
this.updateEditorSize(Size.MEDIUM);
Expand All @@ -454,8 +456,11 @@ class PropertiesMain extends React.Component {
}

detectResize() {
// Increment resize btn counter to hide btn on drag
this.setState((prevState) => ({ showResizeBtn: prevState.showResizeBtn - 1 }));
// only hide resize button if resize wasn't from clicking resize button
if (!this.resizeClicked) {
this.setState({ showResizeBtn: false });
}
this.resizeClicked = false;
}

render() {
Expand Down Expand Up @@ -505,7 +510,7 @@ class PropertiesMain extends React.Component {
// Show Resize Button only under below conditions
// 1. Flyout is not dragged to resize its width.
// 2. If pixel_width is set include that to test if button should be shown.
if (this._isResizeButtonRequired() && this.state.showResizeBtn > 0) {
if (this._isResizeButtonRequired() && this.state.showResizeBtn) {
const resizeIcon = this._getResizeButton();
// Resize button label can be "Expand" or "Contract"
const resizeBtnLabel = (resizeIcon.props && resizeIcon.props.className === "properties-resize-caret-left")
Expand Down Expand Up @@ -607,7 +612,7 @@ class PropertiesMain extends React.Component {
handleWidth
refreshMode="debounce"
refreshRate={500}
onResize={(width) => this.detectResize(width)}
onResize={this.detectResize}
targetRef={this.commonProperties}
skipOnMount
>
Expand Down

0 comments on commit fa595f3

Please sign in to comment.