bigbluebutton-Github/bigbluebutton-html5/imports/api/slides/server/methods/zoomSlide.js
germanocaumo d4b8bdce7e fix(tldraw): sync viewed area between presenter/viewers +
- Return to the ResizeAndMoveSlide event to do pan&zoom, respecting the viewed width and height ratio
- Defaults zoom in toolbar to 100% like before to be more consistent
- Fit to width and Reset Zoom is back (fit tho width still has some sync problems)
- Fix to not change to first page when presenter reloads page
2022-08-16 12:12:43 +00:00

57 lines
1.7 KiB
JavaScript
Executable File

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 function zoomSlide(slideNumber, podId, widthRatio, heightRatio, x, y) {
const REDIS_CONFIG = Meteor.settings.private.redis;
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
const EVENT_NAME = 'ResizeAndMovePagePubMsg';
try {
const { meetingId, requesterUserId } = extractCredentials(this.userId);
check(meetingId, String);
check(requesterUserId, String);
const selector = {
meetingId,
podId,
current: true,
};
const Presentation = Presentations.findOne(selector);
if (!Presentation) {
throw new Meteor.Error('presentation-not-found', 'You need a presentation to be able to switch slides');
}
const Slide = Slides.findOne({
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,
xOffset: x,
yOffset: y,
widthRatio,
heightRatio,
};
RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, payload);
} catch (err) {
Logger.error(`Exception while invoking method zoomSlide ${err.stack}`);
}
}