Merge pull request #18597 from KDSBrowne/bbb-17982-2
fix: Handle Slide Change With Fit To Width
This commit is contained in:
commit
0d911a0102
@ -93,6 +93,12 @@ class PresentationToolbar extends PureComponent {
|
|||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
|
this.state = {
|
||||||
|
wasFTWActive: false,
|
||||||
|
};
|
||||||
|
|
||||||
|
this.setWasActive = this.setWasActive.bind(this);
|
||||||
|
this.handleFTWSlideChange = this.handleFTWSlideChange.bind(this);
|
||||||
this.handleSkipToSlideChange = this.handleSkipToSlideChange.bind(this);
|
this.handleSkipToSlideChange = this.handleSkipToSlideChange.bind(this);
|
||||||
this.change = this.change.bind(this);
|
this.change = this.change.bind(this);
|
||||||
this.renderAriaDescs = this.renderAriaDescs.bind(this);
|
this.renderAriaDescs = this.renderAriaDescs.bind(this);
|
||||||
@ -108,18 +114,40 @@ class PresentationToolbar extends PureComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate(prevProps) {
|
componentDidUpdate(prevProps) {
|
||||||
const { zoom, setIsPanning, fitToWidth } = this.props;
|
const { zoom, setIsPanning, fitToWidth, fitToWidthHandler, currentSlideNum } = this.props;
|
||||||
|
const { wasFTWActive } = this.state;
|
||||||
|
|
||||||
if (zoom <= HUNDRED_PERCENT && zoom !== prevProps.zoom && !fitToWidth) setIsPanning();
|
if (zoom <= HUNDRED_PERCENT && zoom !== prevProps.zoom && !fitToWidth) setIsPanning();
|
||||||
|
|
||||||
|
if ((prevProps?.currentSlideNum !== currentSlideNum) && (!fitToWidth && wasFTWActive)) {
|
||||||
|
setTimeout(() => {
|
||||||
|
fitToWidthHandler();
|
||||||
|
this.setWasActive(false);
|
||||||
|
}, 150)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
document.removeEventListener('keydown', this.switchSlide);
|
document.removeEventListener('keydown', this.switchSlide);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setWasActive(wasFTWActive) {
|
||||||
|
this.setState({ wasFTWActive });
|
||||||
|
}
|
||||||
|
|
||||||
|
handleFTWSlideChange() {
|
||||||
|
const { fitToWidth, fitToWidthHandler } = this.props;
|
||||||
|
if (fitToWidth) {
|
||||||
|
fitToWidthHandler();
|
||||||
|
this.setWasActive(fitToWidth);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
handleSkipToSlideChange(event) {
|
handleSkipToSlideChange(event) {
|
||||||
const { skipToSlide, podId } = this.props;
|
const { skipToSlide, podId } = this.props;
|
||||||
const requestedSlideNum = Number.parseInt(event.target.value, 10);
|
const requestedSlideNum = Number.parseInt(event.target.value, 10);
|
||||||
|
|
||||||
|
this.handleFTWSlideChange();
|
||||||
if (event) event.currentTarget.blur();
|
if (event) event.currentTarget.blur();
|
||||||
skipToSlide(requestedSlideNum, podId);
|
skipToSlide(requestedSlideNum, podId);
|
||||||
}
|
}
|
||||||
@ -161,9 +189,10 @@ class PresentationToolbar extends PureComponent {
|
|||||||
|
|
||||||
nextSlideHandler(event) {
|
nextSlideHandler(event) {
|
||||||
const {
|
const {
|
||||||
nextSlide, currentSlideNum, numberOfSlides, podId, endCurrentPoll,
|
nextSlide, currentSlideNum, numberOfSlides, podId, endCurrentPoll
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
|
this.handleFTWSlideChange();
|
||||||
if (event) event.currentTarget.blur();
|
if (event) event.currentTarget.blur();
|
||||||
endCurrentPoll();
|
endCurrentPoll();
|
||||||
nextSlide(currentSlideNum, numberOfSlides, podId);
|
nextSlide(currentSlideNum, numberOfSlides, podId);
|
||||||
@ -171,9 +200,10 @@ class PresentationToolbar extends PureComponent {
|
|||||||
|
|
||||||
previousSlideHandler(event) {
|
previousSlideHandler(event) {
|
||||||
const {
|
const {
|
||||||
previousSlide, currentSlideNum, podId, endCurrentPoll,
|
previousSlide, currentSlideNum, podId, endCurrentPoll
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
|
this.handleFTWSlideChange();
|
||||||
if (event) event.currentTarget.blur();
|
if (event) event.currentTarget.blur();
|
||||||
endCurrentPoll();
|
endCurrentPoll();
|
||||||
previousSlide(currentSlideNum, podId);
|
previousSlide(currentSlideNum, podId);
|
||||||
|
Loading…
Reference in New Issue
Block a user