bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/presentation/presentation-toolbar/service.js

47 lines
1.3 KiB
JavaScript
Raw Normal View History

import Auth from '/imports/ui/services/auth';
import Presentations from '/imports/api/presentations';
2017-07-01 03:16:00 +08:00
import { makeCall } from '/imports/ui/services/api';
import { throttle } from '/imports/utils/throttle';
2016-08-03 06:55:20 +08:00
const PAN_ZOOM_INTERVAL = Meteor.settings.public.presentation.panZoomInterval || 200;
const getNumberOfSlides = (podId, presentationId) => {
const meetingId = Auth.meetingID;
2016-08-03 06:55:20 +08:00
const presentation = Presentations.findOne({
2017-06-03 03:25:02 +08:00
meetingId,
podId,
id: presentationId,
});
2016-08-03 06:55:20 +08:00
2021-11-30 19:45:57 +08:00
return presentation && presentation.pages ? presentation.pages.length : 0;
2016-08-03 06:55:20 +08:00
};
const previousSlide = (currentSlideNum, podId) => {
2016-08-06 02:39:24 +08:00
if (currentSlideNum > 1) {
makeCall('switchSlide', currentSlideNum - 1, podId);
2016-08-06 02:39:24 +08:00
}
};
const nextSlide = (currentSlideNum, numberOfSlides, podId) => {
2016-08-06 02:39:24 +08:00
if (currentSlideNum < numberOfSlides) {
makeCall('switchSlide', currentSlideNum + 1, podId);
2016-08-06 02:39:24 +08:00
}
};
const zoomSlide = throttle((currentSlideNum, podId, widthRatio, heightRatio, xOffset, yOffset) => {
makeCall('zoomSlide', currentSlideNum, podId, widthRatio, heightRatio, xOffset, yOffset);
}, PAN_ZOOM_INTERVAL);
2018-08-14 03:29:38 +08:00
const skipToSlide = (requestedSlideNum, podId) => {
makeCall('switchSlide', requestedSlideNum, podId);
2016-08-06 02:39:24 +08:00
};
2016-08-03 06:55:20 +08:00
export default {
getNumberOfSlides,
2016-08-06 02:39:24 +08:00
nextSlide,
previousSlide,
skipToSlide,
2018-08-14 03:29:38 +08:00
zoomSlide,
2016-08-03 06:55:20 +08:00
};