From 5ac897aae78f5b995eb01ddacc804303316d5981 Mon Sep 17 00:00:00 2001 From: Anudeep Reddy Date: Fri, 4 Jun 2021 12:15:44 +0000 Subject: [PATCH 1/2] changed validate resize to account for all tab panels --- src/components/splitter/Splitter.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/splitter/Splitter.js b/src/components/splitter/Splitter.js index 7dd879cbf9..54206e9923 100644 --- a/src/components/splitter/Splitter.js +++ b/src/components/splitter/Splitter.js @@ -60,11 +60,11 @@ export class Splitter extends Component { } validateResize(newPrevPanelSize, newNextPanelSize) { - if (this.props.children[0].props && this.props.children[0].props.minSize && this.props.children[0].props.minSize > newPrevPanelSize) { + if (this.props.children[this.prevPanelIndex].props && this.props.children[this.prevPanelIndex].props.minSize && this.props.children[this.prevPanelIndex].props.minSize > newPrevPanelSize) { return false; } - if (this.props.children[1].props && this.props.children[1].props.minSize && this.props.children[1].props.minSize > newNextPanelSize) { + if (this.props.children[this.prevPanelIndex+1].props && this.props.children[this.prevPanelIndex+1].props.minSize && this.props.children[this.prevPanelIndex+1].props.minSize > newNextPanelSize) { return false; } From 9725c1bb6b84c43ffb70f2dd693c4b71a8f85a6c Mon Sep 17 00:00:00 2001 From: Anudeep Reddy Date: Fri, 4 Jun 2021 12:55:24 +0000 Subject: [PATCH 2/2] fixed issue with touch events --- src/components/splitter/Splitter.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/components/splitter/Splitter.js b/src/components/splitter/Splitter.js index 54206e9923..b1c65f8370 100644 --- a/src/components/splitter/Splitter.js +++ b/src/components/splitter/Splitter.js @@ -134,10 +134,12 @@ export class Splitter extends Component { } onResizeStart(event, index) { + let pageX = event.type === 'touchstart' ? event.touches[0].pageX : event.pageX; + let pageY = event.type === 'touchstart' ? event.touches[0].pageY : event.pageY; this.gutterElement = event.currentTarget; this.size = this.props.layout === 'horizontal' ? DomHandler.getWidth(this.container) : DomHandler.getHeight(this.container); this.dragging = true; - this.startPos = this.props.layout === 'horizontal' ? event.pageX : event.pageY; + this.startPos = this.props.layout === 'horizontal' ? pageX : pageY; this.prevPanelElement = this.gutterElement.previousElementSibling; this.nextPanelElement = this.gutterElement.nextElementSibling; this.prevPanelSize = 100 * (this.props.layout === 'horizontal' ? DomHandler.getOuterWidth(this.prevPanelElement, true) : DomHandler.getOuterHeight(this.prevPanelElement, true)) / this.size; @@ -149,10 +151,12 @@ export class Splitter extends Component { onResize(event) { let newPos; + let pageX = event.type === 'touchmove' ? event.touches[0].pageX : event.pageX; + let pageY = event.type === 'touchmove' ? event.touches[0].pageY : event.pageY; if (this.props.layout === 'horizontal') - newPos = (event.pageX * 100 / this.size) - (this.startPos * 100 / this.size); + newPos = (pageX * 100 / this.size) - (this.startPos * 100 / this.size); else - newPos = (event.pageY * 100 / this.size) - (this.startPos * 100 / this.size); + newPos = (pageY * 100 / this.size) - (this.startPos * 100 / this.size); let newPrevPanelSize = this.prevPanelSize + newPos; let newNextPanelSize = this.nextPanelSize - newPos;