2017-07-01 03:16:00 +08:00
|
|
|
import { makeCall } from '/imports/ui/services/api';
|
2023-03-02 21:25:08 +08:00
|
|
|
import { throttle } from '/imports/utils/throttle';
|
2016-08-03 06:55:20 +08:00
|
|
|
|
2019-07-18 08:30:28 +08:00
|
|
|
const PAN_ZOOM_INTERVAL = Meteor.settings.public.presentation.panZoomInterval || 200;
|
|
|
|
|
2023-10-12 02:41:20 +08:00
|
|
|
const POD_ID = 'DEFAULT_PRESENTATION_POD';
|
|
|
|
|
|
|
|
const previousSlide = (currentSlideNum) => {
|
2016-08-06 02:39:24 +08:00
|
|
|
if (currentSlideNum > 1) {
|
2023-10-12 02:41:20 +08:00
|
|
|
makeCall('switchSlide', currentSlideNum - 1, POD_ID);
|
2016-08-06 02:39:24 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2023-10-12 02:41:20 +08:00
|
|
|
const nextSlide = (currentSlideNum, numberOfSlides) => {
|
2016-08-06 02:39:24 +08:00
|
|
|
if (currentSlideNum < numberOfSlides) {
|
2023-10-12 02:41:20 +08:00
|
|
|
makeCall('switchSlide', currentSlideNum + 1, POD_ID);
|
2016-08-06 02:39:24 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2023-10-12 02:41:20 +08:00
|
|
|
const zoomSlide = throttle((currentSlideNum, widthRatio, heightRatio, xOffset, yOffset) => {
|
|
|
|
makeCall('zoomSlide', currentSlideNum, POD_ID, widthRatio, heightRatio, xOffset, yOffset);
|
2019-07-18 08:30:28 +08:00
|
|
|
}, PAN_ZOOM_INTERVAL);
|
2018-08-14 03:29:38 +08:00
|
|
|
|
2023-10-12 02:41:20 +08:00
|
|
|
const skipToSlide = (requestedSlideNum) => {
|
|
|
|
makeCall('switchSlide', requestedSlideNum, POD_ID);
|
2016-08-06 02:39:24 +08:00
|
|
|
};
|
|
|
|
|
2016-08-03 06:55:20 +08:00
|
|
|
export default {
|
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
|
|
|
};
|