Skip to content

Commit

Permalink
Merge remote-tracking branch 'bbb/v2.6.x-release' into aug22merge
Browse files Browse the repository at this point in the history
  • Loading branch information
antobinary committed Aug 24, 2023
2 parents 032f253 + 41c5670 commit 1186db7
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ class PresentationToolbar extends PureComponent {
constructor(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.change = this.change.bind(this);
this.renderAriaDescs = this.renderAriaDescs.bind(this);
Expand All @@ -108,18 +114,40 @@ class PresentationToolbar extends PureComponent {
}

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 ((prevProps?.currentSlideNum !== currentSlideNum) && (!fitToWidth && wasFTWActive)) {
setTimeout(() => {
fitToWidthHandler();
this.setWasActive(false);
}, 150)
}
}

componentWillUnmount() {
document.removeEventListener('keydown', this.switchSlide);
}

setWasActive(wasFTWActive) {
this.setState({ wasFTWActive });
}

handleFTWSlideChange() {
const { fitToWidth, fitToWidthHandler } = this.props;
if (fitToWidth) {
fitToWidthHandler();
this.setWasActive(fitToWidth);
}
}

handleSkipToSlideChange(event) {
const { skipToSlide, podId } = this.props;
const requestedSlideNum = Number.parseInt(event.target.value, 10);

this.handleFTWSlideChange();
if (event) event.currentTarget.blur();
skipToSlide(requestedSlideNum, podId);
}
Expand Down Expand Up @@ -161,19 +189,21 @@ class PresentationToolbar extends PureComponent {

nextSlideHandler(event) {
const {
nextSlide, currentSlideNum, numberOfSlides, podId, endCurrentPoll,
nextSlide, currentSlideNum, numberOfSlides, podId, endCurrentPoll
} = this.props;

this.handleFTWSlideChange();
if (event) event.currentTarget.blur();
endCurrentPoll();
nextSlide(currentSlideNum, numberOfSlides, podId);
}

previousSlideHandler(event) {
const {
previousSlide, currentSlideNum, podId, endCurrentPoll,
previousSlide, currentSlideNum, podId, endCurrentPoll
} = this.props;

this.handleFTWSlideChange();
if (event) event.currentTarget.blur();
endCurrentPoll();
previousSlide(currentSlideNum, podId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -448,9 +448,10 @@ export default function Whiteboard(props) {
}, [tldrawAPI?.getPageState()?.camera, presentationWidth, presentationHeight]);

React.useEffect(() => {
if (isPresenter && slidePosition) {
const currentZoom = calculateZoom(slidePosition?.viewBoxWidth, slidePosition?.viewBoxHeight);
tldrawAPI?.setCamera([slidePosition?.x, slidePosition?.y], currentZoom);
if (isPresenter && slidePosition && tldrawAPI) {
const camera = tldrawAPI?.getPageState()?.camera;
const newZoom = calculateZoom(slidePosition?.viewBoxWidth, slidePosition?.viewBoxHeight);
tldrawAPI?.setCamera([camera?.point[0], camera?.point[1]], newZoom);
}
}, [slidePosition?.viewBoxWidth, slidePosition?.viewBoxHeight]);

Expand Down Expand Up @@ -762,7 +763,7 @@ export default function Whiteboard(props) {

if (camera.point[0] === 0 && camera.point[1] === 0) {
const newZoom = calculateZoom(slidePosition.viewBoxWidth, slidePosition.viewBoxHeight);
e?.setCamera([slidePosition.x, slidePosition.y], newZoom);
e?.setCamera([camera.point[0], camera.point[1]], newZoom);
}

const zoomFitSlide = calculateZoom(slidePosition.width, slidePosition.height);
Expand Down
10 changes: 8 additions & 2 deletions bigbluebutton-html5/imports/ui/components/whiteboard/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -385,8 +385,9 @@ const notifyShapeNumberExceeded = (intl, limit) => {
};

const toggleToolsAnimations = (activeAnim, anim, time) => {
const tdTools = document.querySelector("#TD-Tools");
const topToolbar = document.getElementById("TD-Styles")?.parentElement;
const tdTools = document.querySelector('#TD-Tools');
const topToolbar = document.getElementById('TD-Styles')?.parentElement;
const optionsDropdown = document.getElementById('WhiteboardOptionButton');
if (tdTools && topToolbar) {
tdTools.classList.remove(activeAnim);
topToolbar.classList.remove(activeAnim);
Expand All @@ -395,6 +396,11 @@ const toggleToolsAnimations = (activeAnim, anim, time) => {
tdTools?.classList?.add(anim);
topToolbar?.classList?.add(anim);
}
if (optionsDropdown) {
optionsDropdown.classList.remove(activeAnim);
optionsDropdown.style.transition = `opacity ${time} ease-in-out`;
optionsDropdown?.classList?.add(anim);
}
}

export {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* It is partially copied under the Apache Public License 2.0 (see https://www.apache.org/licenses/LICENSE-2.0).
*/

import * as wasmcheck from 'wasm-check';
import {
CLEAR_TIMEOUT,
TIMEOUT_TICK,
Expand All @@ -17,6 +16,8 @@ import {
} from '/imports/ui/services/virtual-background/service'
import logger from '/imports/startup/client/logger';

import { simd } from 'wasm-feature-detect/dist/cjs/index';

const blurValue = '25px';

function drawImageProp(ctx, img, x, y, w, h, offsetX, offsetY) {
Expand Down Expand Up @@ -367,8 +368,9 @@ class VirtualBackgroundService {
export async function createVirtualBackgroundService(parameters = null) {
let tflite;
let modelResponse;
const simdSupported = await simd();

if (wasmcheck.feature.simd) {
if (simdSupported) {
tflite = await window.createTFLiteSIMDModule();
modelResponse = await fetch(BASE_PATH+MODELS.model144.path);
} else {
Expand Down Expand Up @@ -401,7 +403,7 @@ export async function createVirtualBackgroundService(parameters = null) {
tflite._loadModel(model.byteLength);

const options = {
...wasmcheck.feature.simd ? MODELS.model144.segmentationDimensions : MODELS.model96.segmentationDimensions,
... simdSupported ? MODELS.model144.segmentationDimensions : MODELS.model96.segmentationDimensions,
virtualBackground: parameters
};

Expand Down
8 changes: 4 additions & 4 deletions bigbluebutton-html5/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bigbluebutton-html5/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
"styled-components": "^5.3.3",
"tippy.js": "^5.1.3",
"use-context-selector": "^1.3.7",
"wasm-check": "^2.0.3",
"wasm-feature-detect": "^1.5.1",
"webrtc-adapter": "^8.1.1",
"winston": "^3.7.2",
"yaml": "^2.2.2"
Expand Down

0 comments on commit 1186db7

Please sign in to comment.