Skip to content

Commit

Permalink
Merge pull request #18724 from antobinary/merge-sept-6
Browse files Browse the repository at this point in the history
chore: Merge BBB 2.6.14 into v2.7.x-release
  • Loading branch information
antobinary committed Sep 7, 2023
2 parents 6d281a2 + 7b271c9 commit 29f52b3
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 12 deletions.
41 changes: 34 additions & 7 deletions bigbluebutton-html5/imports/ui/components/whiteboard/component.jsx
@@ -1,7 +1,7 @@
import * as React from 'react';
import PropTypes from 'prop-types';
import { TldrawApp, Tldraw } from '@tldraw/tldraw';
import SlideCalcUtil, { HUNDRED_PERCENT } from '/imports/utils/slideCalcUtils';
import SlideCalcUtil, { HUNDRED_PERCENT, MAX_PERCENT } from '/imports/utils/slideCalcUtils';
// eslint-disable-next-line import/no-extraneous-dependencies
import { Utils } from '@tldraw/core';
import Cursors from './cursors/container';
Expand Down Expand Up @@ -93,11 +93,13 @@ export default function Whiteboard(props) {
const [history, setHistory] = React.useState(null);
const [zoom, setZoom] = React.useState(HUNDRED_PERCENT);
const [tldrawZoom, setTldrawZoom] = React.useState(1);
const zoomValueRef = React.useRef(zoomValue);
const [isMounting, setIsMounting] = React.useState(true);
const prevShapes = usePrevious(shapes);
const prevSlidePosition = usePrevious(slidePosition);
const prevFitToWidth = usePrevious(fitToWidth);
const prevSvgUri = usePrevious(svgUri);
const prevPageId = usePrevious(curPageId);
const language = mapLanguage(Settings?.application?.locale?.toLowerCase() || 'en');
const [currentTool, setCurrentTool] = React.useState(null);
const [currentStyle, setCurrentStyle] = React.useState({});
Expand All @@ -115,6 +117,10 @@ export default function Whiteboard(props) {
};
}, []);

React.useEffect(() => {
zoomValueRef.current = zoomValue;
}, [zoomValue]);

const setSafeTLDrawAPI = (api) => {
if (isMountedRef.current) {
setTldrawAPI(api);
Expand Down Expand Up @@ -219,8 +225,16 @@ export default function Whiteboard(props) {
tldrawAPI?.completeSession?.();
}
};

const handleWheelEvent = (event) => {
if ((zoomValueRef.current >= MAX_PERCENT && event.deltaY < 0)
|| (zoomValueRef.current <= HUNDRED_PERCENT && event.deltaY > 0))
{
event.stopPropagation();
event.preventDefault();
return window.dispatchEvent(new Event('resize'));
}

if (!event.ctrlKey) {
// Prevent the event from reaching the tldraw library
event.stopPropagation();
Expand Down Expand Up @@ -461,6 +475,19 @@ export default function Whiteboard(props) {
const newZoom = calculateZoom(slidePosition.viewBoxWidth, slidePosition.viewBoxHeight);
tldrawAPI?.setCamera([slidePosition.x, slidePosition.y], newZoom, 'zoomed');
}

const camera = tldrawAPI?.getPageState()?.camera;
if (isPresenter && slidePosition && camera) {
const zoomFitSlide = calculateZoom(slidePosition.width, slidePosition.height);
const zoomCamera = (zoomFitSlide * zoomValue) / HUNDRED_PERCENT;
let zoomToolbar = Math.round(
((HUNDRED_PERCENT * camera.zoom) / zoomFitSlide) * 100,
) / 100;
if ((zoom !== zoomToolbar) && (curPageId && curPageId !== prevPageId)) {
setZoom(zoomToolbar);
zoomChanger(zoomToolbar);
}
}
}, [curPageId, slidePosition]);

// update zoom according to toolbar
Expand Down Expand Up @@ -612,6 +639,11 @@ export default function Whiteboard(props) {
tldrawAPI?.selectAll();
}
break;
case KEY_CODES.ARROW_DOWN:
case KEY_CODES.ARROW_UP:
event.preventDefault();
event.stopPropagation();
break;
default:
}
};
Expand Down Expand Up @@ -761,11 +793,6 @@ export default function Whiteboard(props) {
camera.point[1] = 0;
}

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

const zoomFitSlide = calculateZoom(slidePosition.width, slidePosition.height);
if (camera.zoom < zoomFitSlide) {
camera.zoom = zoomFitSlide;
Expand Down
3 changes: 2 additions & 1 deletion build/packages-template/bbb-etherpad/build.sh
Expand Up @@ -80,5 +80,6 @@ fpm -s dir -C ./staging -n $PACKAGE \
--after-remove after-remove.sh \
--description "The EtherPad Lite components for BigBlueButton" \
$DIRECTORIES \
$OPTS
$OPTS \
-d 'nodejs (>= 18)' -d 'nodejs (<< 20)'

3 changes: 2 additions & 1 deletion build/packages-template/bbb-export-annotations/build.sh
Expand Up @@ -43,5 +43,6 @@ fpm -s dir -C ./staging -n $PACKAGE \
--before-remove before-remove.sh \
--description "BigBlueButton Export Annotations" \
$DIRECTORIES \
$OPTS
$OPTS \
-d 'nodejs (>= 18)' -d 'nodejs (<< 20)'

3 changes: 2 additions & 1 deletion build/packages-template/bbb-pads/build.sh
Expand Up @@ -38,5 +38,6 @@ fpm -s dir -C ./staging -n $PACKAGE \
--before-remove before-remove.sh \
--description "BigBlueButton Pads" \
$DIRECTORIES \
$OPTS
$OPTS \
-d 'nodejs (>= 18)' -d 'nodejs (<< 20)'

3 changes: 2 additions & 1 deletion build/packages-template/bbb-webhooks/build.sh
Expand Up @@ -46,4 +46,5 @@ fpm -s dir -C ./staging -n $PACKAGE \
--description "BigBlueButton Webhooks" \
$DIRECTORIES \
$OPTS \
-d 'yq (>= 3)' -d 'yq (<< 4)'
-d 'yq (>= 3)' -d 'yq (<< 4)' \
-d 'nodejs (>= 18)' -d 'nodejs (<< 20)'
3 changes: 2 additions & 1 deletion build/packages-template/bbb-webrtc-sfu/build.sh
Expand Up @@ -64,4 +64,5 @@ fpm -s dir -C ./staging -n $PACKAGE \
--description "BigBlueButton WebRTC SFU" \
$DIRECTORIES \
$OPTS \
-d 'yq (>= 3)' -d 'yq (<< 4)'
-d 'yq (>= 3)' -d 'yq (<< 4)' \
-d 'nodejs (>= 18)' -d 'nodejs (<< 20)'
1 change: 1 addition & 0 deletions docs/docs/new-features.md
Expand Up @@ -131,6 +131,7 @@ Under the hood, BigBlueButton 2.7 installs on Ubuntu 20.04 64-bit, and the follo
- React 18
- NodeJS 18 (up from 16) for `bbb-pads`, `bbb-export-annotations`, `bbb-webrtc-sfu`, `bbb-etherpad`, `bbb-webhooks`
- Java 17 (up from 11) for `bbb-common-message`, `bbb-common-web`, `bigbluebutton-web`, `akka-bbb-apps`, `bbb-fsesl-client`, and `akka-bbb-fsesl`
- Meteor 2.13
- Grails 5.3.2
- GORM 7.3.1
- Groovy 3.0.11
Expand Down

0 comments on commit 29f52b3

Please sign in to comment.