bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/whiteboard/container.jsx

71 lines
2.5 KiB
React
Raw Normal View History

2022-04-05 22:49:13 +08:00
import { withTracker } from "meteor/react-meteor-data";
import Service from "./service";
import Whiteboard from "./component";
import React, { useContext } from "react";
import { UsersContext } from "../components-data/users-context/context";
import Auth from "/imports/ui/services/auth";
2022-05-12 05:58:16 +08:00
import PresentationToolbarService from '../presentation/presentation-toolbar/service';
2022-08-03 22:19:12 +08:00
import { layoutSelect } from '../layout/context';
import {
ColorStyle,
DashStyle,
SizeStyle,
TDShapeType,
} from "@tldraw/tldraw";
2022-04-05 22:49:13 +08:00
const WhiteboardContainer = (props) => {
const usingUsersContext = useContext(UsersContext);
2022-08-03 22:19:12 +08:00
const isRTL = layoutSelect((i) => i.isRTL);
const width = layoutSelect((i) => i?.output?.presentation?.width);
const height = layoutSelect((i) => i?.output?.presentation?.height);
2022-04-05 22:49:13 +08:00
const { users } = usingUsersContext;
const currentUser = users[Auth.meetingID][Auth.userID];
const isPresenter = currentUser.presenter;
return <Whiteboard {...{ isPresenter, currentUser, isRTL, width, height }} {...props} meetingId={Auth.meetingID} />
2022-04-05 22:49:13 +08:00
};
export default withTracker(({ whiteboardId, curPageId, intl, zoomChanger, slidePosition, svgUri }) => {
const shapes = Service.getShapes(whiteboardId, curPageId, intl);
const curPres = Service.getCurrentPres();
shapes["slide-background-shape"] = {
assetId: `slide-background-asset-${curPageId}`,
childIndex: 0.5,
id: "slide-background-shape",
name: "Image",
type: TDShapeType.Image,
parentId: `${curPageId}`,
point: [0, 0],
isLocked: true,
size: [slidePosition?.width || 0, slidePosition?.height || 0],
style: {
dash: DashStyle.Draw,
size: SizeStyle.Medium,
color: ColorStyle.Blue,
},
};
const assets = {}
assets[`slide-background-asset-${curPageId}`] = {
id: `slide-background-asset-${curPageId}`,
size: [slidePosition?.width || 0, slidePosition?.height || 0],
src: svgUri,
type: "image",
};
2022-04-05 22:49:13 +08:00
return {
initDefaultPages: Service.initDefaultPages,
persistShape: Service.persistShape,
2022-05-16 10:35:17 +08:00
isMultiUserActive: Service.isMultiUserActive,
hasMultiUserAccess: Service.hasMultiUserAccess,
changeCurrentSlide: Service.changeCurrentSlide,
2022-04-05 22:49:13 +08:00
shapes: shapes,
assets: assets,
curPres,
removeShapes: Service.removeShapes,
2022-05-12 05:58:16 +08:00
zoomSlide: PresentationToolbarService.zoomSlide,
2022-05-19 08:52:45 +08:00
skipToSlide: PresentationToolbarService.skipToSlide,
zoomChanger: zoomChanger,
2022-04-05 22:49:13 +08:00
};
})(WhiteboardContainer);