remove unused slides collection code

This commit is contained in:
Ramón Souza 2023-11-13 17:27:08 -03:00
parent e29f3b63a0
commit 3045575aab
23 changed files with 37 additions and 626 deletions

View File

@ -25,14 +25,11 @@ import Meetings, {
} from '/imports/api/meetings';
import { UsersTyping } from '/imports/api/group-chat-msg';
import Users, { CurrentUser } from '/imports/api/users';
import { Slides, SlidePositions } from '/imports/api/slides';
// Custom Publishers
export const localCollectionRegistry = {
localCurrentPollSync: new AbstractCollection(CurrentPoll, CurrentPoll),
localCurrentUserSync: new AbstractCollection(CurrentUser, CurrentUser),
localSlidesSync: new AbstractCollection(Slides, Slides),
localSlidePositionsSync: new AbstractCollection(SlidePositions, SlidePositions),
localPollsSync: new AbstractCollection(Polls, Polls),
localPresentationsSync: new AbstractCollection(Presentations, Presentations),
localPresentationPodsSync: new AbstractCollection(PresentationPods, PresentationPods),

View File

@ -8,7 +8,6 @@ import clearUsersSettings from '/imports/api/users-settings/server/modifiers/cle
import clearGroupChat from '/imports/api/group-chat/server/modifiers/clearGroupChat';
import clearGuestUsers from '/imports/api/guest-users/server/modifiers/clearGuestUsers';
import clearBreakouts from '/imports/api/breakouts/server/modifiers/clearBreakouts';
import clearSlides from '/imports/api/slides/server/modifiers/clearSlides';
import clearPolls from '/imports/api/polls/server/modifiers/clearPolls';
import clearCaptions from '/imports/api/captions/server/modifiers/clearCaptions';
import clearPads from '/imports/api/pads/server/modifiers/clearPads';
@ -46,7 +45,6 @@ export default async function meetingHasEnded(meetingId) {
clearPresentationPods(meetingId),
clearBreakouts(meetingId),
clearPolls(meetingId),
clearSlides(meetingId),
clearUsers(meetingId),
clearUsersSettings(meetingId),
clearVoiceUsers(meetingId),

View File

@ -1,32 +1,9 @@
import axios from 'axios';
import { check } from 'meteor/check';
import Presentations from '/imports/api/presentations';
import Logger from '/imports/startup/server/logger';
import flat from 'flat';
import addSlide from '/imports/api/slides/server/modifiers/addSlide';
import setCurrentPresentation from './setCurrentPresentation';
const getSlideText = async (url) => {
let content = '';
try {
const request = await axios(url);
content = request.data.toString();
} catch (error) {
Logger.error(`No file found. ${error}`);
}
return content;
};
const addSlides = (meetingId, podId, presentationId, slides) => {
slides.forEach(async (slide) => {
const content = await getSlideText(slide.txtUri);
Object.assign(slide, { content });
await addSlide(meetingId, podId, presentationId, slide);
});
};
export default async function addPresentation(meetingId, podId, presentation) {
check(meetingId, String);
check(podId, String);
@ -77,8 +54,6 @@ export default async function addPresentation(meetingId, podId, presentation) {
try {
await Presentations.upsertAsync(selector, modifier);
await addSlides(meetingId, podId, presentation.id, presentation.pages);
if (presentation.current) {
setCurrentPresentation(meetingId, podId, presentation.id);
Logger.info(`Added presentation id=${presentation.id} meeting=${meetingId}`);

View File

@ -2,8 +2,6 @@ import { check } from 'meteor/check';
import Presentations from '/imports/api/presentations';
import Logger from '/imports/startup/server/logger';
import clearSlidesPresentation from '/imports/api/slides/server/modifiers/clearSlidesPresentation';
export default async function removePresentation(meetingId, podId, presentationId) {
check(meetingId, String);
check(presentationId, String);
@ -19,7 +17,6 @@ export default async function removePresentation(meetingId, podId, presentationI
const numberAffected = await Presentations.removeAsync(selector);
if (numberAffected) {
await clearSlidesPresentation(meetingId, presentationId);
Logger.info(`Removed presentation id=${presentationId} meeting=${meetingId}`);
}
} catch (err) {

View File

@ -1,29 +0,0 @@
import { Meteor } from 'meteor/meteor';
const collectionOptions = Meteor.isClient ? {
connection: null,
} : {};
const Slides = new Mongo.Collection('slides', collectionOptions);
const SlidePositions = new Mongo.Collection('slide-positions', collectionOptions);
if (Meteor.isServer) {
// types of queries for the slides:
// 1. meetingId ( 1 )
// 2. meetingId, podId ( 1 )
// 3. meetingId, presentationId ( 1 )
// 3. meetingId, presentationId, num ( 1 )
// 4. meetingId, podId, presentationId, id ( 3 ) - incl. resizeSlide, which can be intense
// 5. meetingId, podId, presentationId, current ( 1 )
Slides.createIndexAsync({
meetingId: 1, podId: 1, presentationId: 1, id: 1,
});
SlidePositions.createIndexAsync({
meetingId: 1, podId: 1, presentationId: 1, id: 1,
});
}
export { Slides, SlidePositions };

View File

@ -1,6 +0,0 @@
import RedisPubSub from '/imports/startup/server/redis';
import handleSlideResize from './handlers/slideResize';
import handleSlideChange from './handlers/slideChange';
RedisPubSub.on('ResizeAndMovePageEvtMsg', handleSlideResize);
RedisPubSub.on('SetCurrentPageEvtMsg', handleSlideChange);

View File

@ -1,13 +0,0 @@
import { check } from 'meteor/check';
import changeCurrentSlide from '../modifiers/changeCurrentSlide';
export default async function handleSlideChange({ body }, meetingId) {
const { pageId, presentationId, podId } = body;
check(pageId, String);
check(presentationId, String);
check(podId, String);
const result = await changeCurrentSlide(meetingId, podId, presentationId, pageId);
return result;
}

View File

@ -1,10 +0,0 @@
import { check } from 'meteor/check';
import resizeSlide from '../modifiers/resizeSlide';
export default async function handleSlideResize({ body }, meetingId) {
check(meetingId, String);
check(body, Object);
const result = await resizeSlide(meetingId, body);
return result;
}

View File

@ -1,27 +0,0 @@
const calculateSlideData = (slideData) => {
const {
width, height, xOffset, yOffset, widthRatio, heightRatio,
} = slideData;
// calculating viewBox and offsets for the current presentation
const maxImageWidth = 1440;
const maxImageHeight = 1080;
const ratio = Math.min(maxImageWidth / width, maxImageHeight / height);
const scaledWidth = width * ratio;
const scaledHeight = height * ratio;
const scaledViewBoxWidth = width * widthRatio / 100 * ratio;
const scaledViewBoxHeight = height * heightRatio / 100 * ratio;
return {
width: scaledWidth,
height: scaledHeight,
x: xOffset,
y: yOffset,
viewBoxWidth: scaledViewBoxWidth,
viewBoxHeight: scaledViewBoxHeight,
};
};
export default calculateSlideData;

View File

@ -1,3 +1 @@
import './eventHandlers';
import './methods';
import './publishers';

View File

@ -1,13 +1,11 @@
import Presentations from '/imports/api/presentations';
import { Slides } from '/imports/api/slides';
import { Meteor } from 'meteor/meteor';
import { check } from 'meteor/check';
import RedisPubSub from '/imports/startup/server/redis';
import { extractCredentials } from '/imports/api/common/server/helpers';
import Logger from '/imports/startup/server/logger';
export default async function switchSlide(slideNumber, podId) {
// TODO-- send presentationId and SlideId
export default async function switchSlide(slideNumber, podId, presentationId) {
const REDIS_CONFIG = Meteor.settings.private.redis;
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
const EVENT_NAME = 'SetCurrentPagePubMsg';
@ -32,21 +30,10 @@ export default async function switchSlide(slideNumber, podId) {
throw new Meteor.Error('presentation-not-found', 'You need a presentation to be able to switch slides');
}
const Slide = await Slides.findOneAsync({
meetingId,
podId,
presentationId: Presentation.id,
num: slideNumber,
});
if (!Slide) {
throw new Meteor.Error('slide-not-found', `Slide number ${slideNumber} not found in the current presentation`);
}
const payload = {
podId,
presentationId: Presentation.id,
pageId: Slide.id,
presentationId,
pageId: `${presentationId}/${slideNumber}`,
};
RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, payload);

View File

@ -1,12 +1,18 @@
import Presentations from '/imports/api/presentations';
import { Slides } from '/imports/api/slides';
import { Meteor } from 'meteor/meteor';
import RedisPubSub from '/imports/startup/server/redis';
import { extractCredentials } from '/imports/api/common/server/helpers';
import { check } from 'meteor/check';
import Logger from '/imports/startup/server/logger';
export default async function zoomSlide(slideNumber, podId, widthRatio, heightRatio, x, y) {
export default async function zoomSlide(
slideNumber,
podId,
widthRatio,
heightRatio,
x,
y,
presentationId,
) {
const REDIS_CONFIG = Meteor.settings.private.redis;
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
const EVENT_NAME = 'ResizeAndMovePagePubMsg';
@ -23,40 +29,15 @@ export default async function zoomSlide(slideNumber, podId, widthRatio, heightRa
check(x, Number);
check(y, Number);
const selector = {
meetingId,
podId,
current: true,
};
const Presentation = await Presentations.findOneAsync(selector);
if (!Presentation) {
throw new Meteor.Error('presentation-not-found', 'You need a presentation to be able to switch slides');
}
let validSlideNum = slideNumber;
if (validSlideNum > Presentation?.pages?.length) validSlideNum = 1;
const Slide = await Slides.findOneAsync({
meetingId,
podId,
presentationId: Presentation.id,
num: validSlideNum,
});
if (!Slide) {
throw new Meteor.Error('slide-not-found', `Slide number ${validSlideNum} not found in the current presentation`);
}
const payload = {
podId,
presentationId: Presentation.id,
pageId: Slide.id,
presentationId,
pageId: `${presentationId}/${slideNumber}`,
xOffset: x,
yOffset: y,
widthRatio,
heightRatio,
slideNumber: validSlideNum,
slideNumber,
};
RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, payload);

View File

@ -1,132 +0,0 @@
import probe from 'probe-image-size';
import { Meteor } from 'meteor/meteor';
import { check } from 'meteor/check';
import flat from 'flat';
import RedisPubSub from '/imports/startup/server/redis';
import { Slides } from '/imports/api/slides';
import Logger from '/imports/startup/server/logger';
import { SVG, PNG } from '/imports/utils/mimeTypes';
import calculateSlideData from '/imports/api/slides/server/helpers';
import addSlidePositions from './addSlidePositions';
const loadSlidesFromHttpAlways = Meteor.settings.private.app.loadSlidesFromHttpAlways || false;
const requestWhiteboardHistory = async (meetingId, slideId) => {
const REDIS_CONFIG = Meteor.settings.private.redis;
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
const EVENT_NAME = 'GetWhiteboardAnnotationsReqMsg';
const USER_ID = 'nodeJSapp';
const payload = {
whiteboardId: slideId,
};
return RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, USER_ID, payload);
};
const SUPPORTED_TYPES = [SVG, PNG];
const fetchImageSizes = (imageUri) => probe(imageUri)
.then((result) => {
if (!SUPPORTED_TYPES.includes(result.mime)) {
throw new Meteor.Error('invalid-image-type', `received ${result.mime} expecting ${SUPPORTED_TYPES.join()}`);
}
return {
width: result.width,
height: result.height,
};
})
.catch((reason) => {
Logger.error(`Error parsing image size. ${reason}. uri=${imageUri}`);
return reason;
});
export default async function addSlide(meetingId, podId, presentationId, slide) {
check(podId, String);
check(presentationId, String);
check(slide, {
id: String,
num: Number,
thumbUri: String,
txtUri: String,
svgUri: String,
current: Boolean,
xOffset: Number,
yOffset: Number,
widthRatio: Number,
heightRatio: Number,
width: Number,
height: Number,
content: String,
});
const {
id: slideId,
xOffset,
yOffset,
widthRatio,
heightRatio,
...restSlide
} = slide;
const selector = {
meetingId,
podId,
presentationId,
id: slideId,
};
const imageUri = slide.svgUri || slide.pngUri;
const modifier = {
$set: {
meetingId,
podId,
presentationId,
id: slideId,
imageUri,
...flat(restSlide),
safe: true,
},
};
const imageSizeUri = (loadSlidesFromHttpAlways ? imageUri.replace(/^https/i, 'http') : imageUri);
return fetchImageSizes(imageSizeUri)
.then(async ({ width, height }) => {
// there is a rare case when for a very long not-active meeting the presentation
// files just disappear and width/height can't be retrieved
if (width && height) {
// pre-calculating the width, height, and vieBox coordinates / dimensions
// to unload the client-side
const slideData = {
width,
height,
xOffset,
yOffset,
widthRatio,
heightRatio,
};
const slidePosition = calculateSlideData(slideData);
await addSlidePositions(meetingId, podId, presentationId, slideId, slidePosition);
}
try {
const { insertedId, numberAffected } = await Slides.upsertAsync(selector, modifier);
await requestWhiteboardHistory(meetingId, slideId);
if (insertedId) {
Logger.info(`Added slide id=${slideId} pod=${podId} presentation=${presentationId}`);
} else if (numberAffected) {
Logger.info(`Upserted slide id=${slideId} pod=${podId} presentation=${presentationId}`);
}
} catch (err) {
Logger.error(`Error on adding slide to collection: ${err}`);
}
})
.catch((reason) => Logger.error(`Error parsing image size. ${reason}. slide=${slideId} uri=${imageUri}`));
}

View File

@ -1,56 +0,0 @@
import { SlidePositions } from '/imports/api/slides';
import Logger from '/imports/startup/server/logger';
import { check } from 'meteor/check';
import flat from 'flat';
export default async function addSlidePositions(
meetingId,
podId,
presentationId,
slideId,
slidePosition,
) {
check(meetingId, String);
check(podId, String);
check(presentationId, String);
check(slideId, String);
check(slidePosition, {
width: Number,
height: Number,
x: Number,
y: Number,
viewBoxWidth: Number,
viewBoxHeight: Number,
});
const selector = {
meetingId,
podId,
presentationId,
id: slideId,
};
const modifier = {
$set: {
meetingId,
podId,
presentationId,
id: slideId,
...flat(slidePosition),
safe: true,
},
};
try {
const { insertedId } = await SlidePositions.upsertAsync(selector, modifier);
if (insertedId) {
Logger.info(`Added slide position id=${slideId} pod=${podId} presentation=${presentationId}`);
} else {
Logger.info(`Upserted slide position id=${slideId} pod=${podId} presentation=${presentationId}`);
}
} catch (err) {
Logger.error(`Adding slide position to collection: ${err}`);
}
}

View File

@ -1,66 +0,0 @@
import { check } from 'meteor/check';
import { Slides } from '/imports/api/slides';
import Logger from '/imports/startup/server/logger';
export default async function changeCurrentSlide(meetingId, podId, presentationId, slideId) {
check(meetingId, String);
check(presentationId, String);
check(slideId, String);
check(podId, String);
const oldCurrent = {
selector: {
meetingId,
podId,
presentationId,
current: true,
},
modifier: {
$set: { current: false },
},
callback: (err) => {
if (err) {
Logger.error(`Unsetting the current slide: ${err}`);
return;
}
Logger.info('Unsetted the current slide');
},
};
const newCurrent = {
selector: {
meetingId,
podId,
presentationId,
id: slideId,
},
modifier: {
$set: { current: true },
},
callback: (err) => {
if (err) {
Logger.error(`Setting as current slide id=${slideId}: ${err}`);
return;
}
Logger.info(`Setted as current slide id=${slideId}`);
},
};
const oldSlide = await Slides.findOneAsync(oldCurrent.selector);
const newSlide = await Slides.findOneAsync(newCurrent.selector);
// if the oldCurrent and newCurrent have the same ids
if (oldSlide && newSlide && (oldSlide._id === newSlide._id)) {
return;
}
if (newSlide) {
await Slides.updateAsync(newSlide._id, newCurrent.modifier, newCurrent.callback);
}
if (oldSlide) {
await Slides.updateAsync(oldSlide._id, oldCurrent.modifier, oldCurrent.callback);
}
}

View File

@ -1,38 +0,0 @@
import { Slides, SlidePositions } from '/imports/api/slides';
import Logger from '/imports/startup/server/logger';
export default async function clearSlides(meetingId) {
if (meetingId) {
try {
const numberAffectedSlidePositions = await SlidePositions.removeAsync({ meetingId });
const numberAffected = await Slides.removeAsync({ meetingId });
if (numberAffectedSlidePositions) {
Logger.info(`Cleared SlidePositions (${meetingId})`);
}
if (numberAffected) {
Logger.info(`Cleared Slides (${meetingId})`);
}
} catch (err) {
Logger.error(`Error on cleaning Slides (${meetingId}). ${err}`);
}
} else {
try {
const numberAffectedSlidePositions = await SlidePositions.removeAsync({ meetingId });
const numberAffected = await Slides.removeAsync({ meetingId });
if (numberAffectedSlidePositions) {
Logger.info(`Cleared SlidePositions (${meetingId})`);
}
if (numberAffected) {
Logger.info('Cleared Slides (all)');
}
} catch (err) {
Logger.error(`Error on cleaning Slides (all). ${err}`);
}
}
}

View File

@ -1,25 +0,0 @@
import { Slides, SlidePositions } from '/imports/api/slides';
import Logger from '/imports/startup/server/logger';
import { check } from 'meteor/check';
export default async function clearSlidesPresentation(meetingId, presentationId) {
check(meetingId, String);
check(presentationId, String);
const selector = {
meetingId,
presentationId,
};
try {
await SlidePositions.removeAsync(selector);
const numberAffected = await Slides.removeAsync(selector);
if (numberAffected) {
Logger.info(`Removed Slides where presentationId=${presentationId}`);
}
} catch (err) {
Logger.error(`Removing Slides from collection: ${err}`);
}
}

View File

@ -1,76 +0,0 @@
import { check } from 'meteor/check';
import { SlidePositions } from '/imports/api/slides';
import { Meteor } from 'meteor/meteor';
import RedisPubSub from '/imports/startup/server/redis';
import Logger from '/imports/startup/server/logger';
import calculateSlideData from '/imports/api/slides/server/helpers';
export default async function resizeSlide(meetingId, slide) {
const REDIS_CONFIG = Meteor.settings.private.redis;
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
const EVENT_NAME = 'SlideResizedPubMsg';
check(meetingId, String);
const {
podId,
presentationId,
pageId,
widthRatio,
heightRatio,
xOffset,
yOffset,
} = slide;
const selector = {
meetingId,
podId,
presentationId,
id: pageId,
};
// fetching the current slide data
// and pre-calculating the width, height, and vieBox coordinates / sizes
// to reduce the client-side load
const SlidePosition = await SlidePositions.findOneAsync(selector);
if (SlidePosition) {
const {
width,
height,
} = SlidePosition;
const slideData = {
width,
height,
xOffset,
yOffset,
widthRatio,
heightRatio,
};
const calculatedData = calculateSlideData(slideData);
const modifier = {
$set: calculatedData,
};
try {
const numberAffected = await SlidePositions.updateAsync(selector, modifier);
const payload = {
pageId,
...slideData,
};
RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, '', payload);
if (numberAffected) {
Logger.debug(`Resized slide positions id=${pageId}`);
} else {
Logger.info(`No slide positions found with id=${pageId}`);
}
} catch (err) {
Logger.error(`Resizing slide positions id=${pageId}: ${err}`);
}
}
}

View File

@ -1,50 +0,0 @@
import { Slides, SlidePositions } from '/imports/api/slides';
import { Meteor } from 'meteor/meteor';
import Logger from '/imports/startup/server/logger';
import AuthTokenValidation, { ValidationStates } from '/imports/api/auth-token-validation';
async function slides() {
const tokenValidation = await AuthTokenValidation
.findOneAsync({ connectionId: this.connection.id });
if (!tokenValidation || tokenValidation.validationStatus !== ValidationStates.VALIDATED) {
Logger.warn(`Publishing Slides was requested by unauth connection ${this.connection.id}`);
return Slides.find({ meetingId: '' });
}
const { meetingId, userId } = tokenValidation;
Logger.debug('Publishing Slides', { meetingId, userId });
return Slides.find({ meetingId });
}
function publish(...args) {
const boundSlides = slides.bind(this);
return boundSlides(...args);
}
Meteor.publish('slides', publish);
async function slidePositions() {
const tokenValidation = await AuthTokenValidation
.findOneAsync({ connectionId: this.connection.id });
if (!tokenValidation || tokenValidation.validationStatus !== ValidationStates.VALIDATED) {
Logger.warn(`Publishing SlidePositions was requested by unauth connection ${this.connection.id}`);
return SlidePositions.find({ meetingId: '' });
}
const { meetingId, userId } = tokenValidation;
Logger.debug('Publishing SlidePositions', { meetingId, userId });
return SlidePositions.find({ meetingId });
}
function publishPositions(...args) {
const boundSlidePositions = slidePositions.bind(this);
return boundSlidePositions(...args);
}
Meteor.publish('slide-positions', publishPositions);

View File

@ -567,9 +567,9 @@ class Presentation extends PureComponent {
}
panAndZoomChanger(w, h, x, y) {
const { currentSlide, zoomSlide } = this.props;
const { currentSlide, zoomSlide, presentationId } = this.props;
zoomSlide(currentSlide.num, w, h, x, y);
zoomSlide(currentSlide.num, w, h, x, y, presentationId);
}
renderPresentationToolbar(svgWidth = 0) {

View File

@ -148,12 +148,12 @@ class PresentationToolbar extends PureComponent {
}
handleSkipToSlideChange(event) {
const { skipToSlide } = this.props;
const { skipToSlide, presentationId } = this.props;
const requestedSlideNum = Number.parseInt(event.target.value, 10);
this.handleFTWSlideChange();
if (event) event.currentTarget.blur();
skipToSlide(requestedSlideNum);
skipToSlide(requestedSlideNum, presentationId);
}
handleSwitchWhiteboardMode() {
@ -193,24 +193,28 @@ class PresentationToolbar extends PureComponent {
nextSlideHandler(event) {
const {
nextSlide, currentSlideNum, numberOfSlides, endCurrentPoll
nextSlide,
currentSlideNum,
numberOfSlides,
endCurrentPoll,
presentationId,
} = this.props;
this.handleFTWSlideChange();
if (event) event.currentTarget.blur();
endCurrentPoll();
nextSlide(currentSlideNum, numberOfSlides);
nextSlide(currentSlideNum, numberOfSlides, presentationId);
}
previousSlideHandler(event) {
const {
previousSlide, currentSlideNum, endCurrentPoll
previousSlide, currentSlideNum, endCurrentPoll, presentationId
} = this.props;
this.handleFTWSlideChange();
if (event) event.currentTarget.blur();
endCurrentPoll();
previousSlide(currentSlideNum);
previousSlide(currentSlideNum, presentationId);
}
switchSlide(event) {

View File

@ -5,15 +5,15 @@ const PAN_ZOOM_INTERVAL = Meteor.settings.public.presentation.panZoomInterval ||
const POD_ID = 'DEFAULT_PRESENTATION_POD';
const previousSlide = (currentSlideNum) => {
const previousSlide = (currentSlideNum, presentationId) => {
if (currentSlideNum > 1) {
makeCall('switchSlide', currentSlideNum - 1, POD_ID);
makeCall('switchSlide', currentSlideNum - 1, POD_ID, presentationId);
}
};
const nextSlide = (currentSlideNum, numberOfSlides) => {
const nextSlide = (currentSlideNum, numberOfSlides, presentationId) => {
if (currentSlideNum < numberOfSlides) {
makeCall('switchSlide', currentSlideNum + 1, POD_ID);
makeCall('switchSlide', currentSlideNum + 1, POD_ID, presentationId);
}
};
@ -21,8 +21,8 @@ const zoomSlide = throttle((currentSlideNum, widthRatio, heightRatio, xOffset, y
makeCall('zoomSlide', currentSlideNum, POD_ID, widthRatio, heightRatio, xOffset, yOffset);
}, PAN_ZOOM_INTERVAL);
const skipToSlide = (requestedSlideNum) => {
makeCall('switchSlide', requestedSlideNum, POD_ID);
const skipToSlide = (requestedSlideNum, presentationId) => {
makeCall('switchSlide', requestedSlideNum, POD_ID, presentationId);
};
export default {

View File

@ -416,7 +416,7 @@ export default function Whiteboard(props) {
);
setZoom(HUNDRED_PERCENT);
zoomChanger(HUNDRED_PERCENT);
zoomSlide(parseInt(curPageId, 10), HUNDRED_PERCENT, viewedRegionH, 0, 0);
zoomSlide(parseInt(curPageId, 10), HUNDRED_PERCENT, viewedRegionH, 0, 0, presentationId);
} else {
const currentAspectRatio = Math.round((presentationWidth / presentationHeight) * 100) / 100;
const previousAspectRatio = Math.round(
@ -516,7 +516,7 @@ export default function Whiteboard(props) {
const viewedRegionH = SlideCalcUtil.calcViewedRegionHeight(
tldrawAPI?.viewport.height, slidePosition.height,
);
zoomSlide(parseInt(curPageId, 10), HUNDRED_PERCENT, viewedRegionH, 0, 0);
zoomSlide(parseInt(curPageId, 10), HUNDRED_PERCENT, viewedRegionH, 0, 0, presentationId);
setZoom(HUNDRED_PERCENT);
zoomChanger(HUNDRED_PERCENT);
} else if (!isMounting) {
@ -538,6 +538,7 @@ export default function Whiteboard(props) {
viewedRegionH,
camera.point[0],
camera.point[1],
presentationId,
);
const zoomToolbar = Math.round(
((HUNDRED_PERCENT * camera.zoom) / zoomFitSlide) * 100,
@ -821,6 +822,7 @@ export default function Whiteboard(props) {
viewedRegionH,
camera.point[0],
camera.point[1],
presentationId,
);
}
// don't allow non-presenters to pan&zoom