bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/presentation/presentation-toolbar/service.js
2022-05-13 02:47:41 +00:00

47 lines
1.2 KiB
JavaScript
Executable File

import Auth from '/imports/ui/services/auth';
import Presentations from '/imports/api/presentations';
import { makeCall } from '/imports/ui/services/api';
import { throttle } from 'lodash';
const PAN_ZOOM_INTERVAL = Meteor.settings.public.presentation.panZoomInterval || 200;
const getNumberOfSlides = (podId, presentationId) => {
const meetingId = Auth.meetingID;
const presentation = Presentations.findOne({
meetingId,
podId,
id: presentationId,
});
return presentation && presentation.pages ? presentation.pages.length : 0;
};
const previousSlide = (currentSlideNum, podId) => {
if (currentSlideNum > 1) {
makeCall('switchSlide', currentSlideNum - 1, podId);
}
};
const nextSlide = (currentSlideNum, numberOfSlides, podId) => {
if (currentSlideNum < numberOfSlides) {
makeCall('switchSlide', currentSlideNum + 1, podId);
}
};
const zoomSlide = throttle((currentSlideNum, podId, zoom, xCamera, yCamera) => {
makeCall('zoomSlide', currentSlideNum, podId, zoom, xCamera, yCamera);
}, PAN_ZOOM_INTERVAL);
const skipToSlide = (requestedSlideNum, podId) => {
makeCall('switchSlide', requestedSlideNum, podId);
};
export default {
getNumberOfSlides,
nextSlide,
previousSlide,
skipToSlide,
zoomSlide,
};