mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-22 22:30:52 +01:00
Fix zoom issues
This commit is contained in:
parent
831738d569
commit
55a882476d
@ -35,6 +35,7 @@
|
||||
"system.pong.interval.ms": 20000,
|
||||
"room.color.skip.transition": true,
|
||||
"room.landscapes.enabled": true,
|
||||
"room.zoom.enabled": true,
|
||||
"avatar.mandatory.libraries": [
|
||||
"bd:1",
|
||||
"li:0"
|
||||
|
@ -21,7 +21,7 @@ export const RoomWidgetsView: FC<{}> = props =>
|
||||
const { roomSession = null } = useRoom();
|
||||
const { simpleAlert = null } = useNotification();
|
||||
|
||||
useNitroEvent<RoomZoomEvent>(RoomZoomEvent.ROOM_ZOOM, event => GetRoomEngine().setRoomInstanceRenderingCanvasScale(event.roomId, 1, event.level, null, null, false, event.asDelta));
|
||||
useNitroEvent<RoomZoomEvent>(RoomZoomEvent.ROOM_ZOOM, event => GetRoomEngine().setRoomInstanceRenderingCanvasScale(event.roomId, 1, (((event.level)<1) ? 0.5 : (1 << (Math.floor(event.level) - 1))), null, null, event.isFlipForced));
|
||||
|
||||
useNitroEvent<RoomEngineObjectEvent>(
|
||||
[
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { CreateLinkEvent, GetGuestRoomResultEvent, GetRoomEngine, NavigatorSearchComposer, RateFlatMessageComposer } from '@nitrots/nitro-renderer';
|
||||
import { AnimatePresence, motion } from 'framer-motion';
|
||||
import { FC, useEffect, useState } from 'react';
|
||||
import { LocalizeText, SendMessageComposer } from '../../../../api';
|
||||
import { GetConfigurationValue, LocalizeText, SendMessageComposer } from '../../../../api';
|
||||
import { Base, Column, Flex, Text, classNames } from '../../../../common';
|
||||
import { useMessageEvent, useNavigator, useRoom } from '../../../../hooks';
|
||||
|
||||
@ -25,12 +25,17 @@ export const RoomToolsWidgetView: FC<{}> = props =>
|
||||
case 'zoom':
|
||||
setIsZoomedIn(prevValue =>
|
||||
{
|
||||
let scale = GetRoomEngine().getRoomInstanceRenderingCanvasScale(roomSession.roomId, 1);
|
||||
if(GetConfigurationValue('room.zoom.enabled', true))
|
||||
{
|
||||
const scale = GetRoomEngine().getRoomInstanceRenderingCanvasScale(roomSession.roomId, 1);
|
||||
GetRoomEngine().setRoomInstanceRenderingCanvasScale(roomSession.roomId, 1, scale === 1 ? 0.5 : 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
const geometry = GetRoomEngine().getRoomInstanceGeometry(roomSession.roomId, 1);
|
||||
|
||||
if(!prevValue) scale /= 2;
|
||||
else scale *= 2;
|
||||
|
||||
GetRoomEngine().setRoomInstanceRenderingCanvasScale(roomSession.roomId, 1, scale);
|
||||
if(geometry) geometry.performZoom();
|
||||
}
|
||||
|
||||
return !prevValue;
|
||||
});
|
||||
|
@ -108,7 +108,7 @@ const useChatInputWidgetState = () =>
|
||||
|
||||
return null;
|
||||
case ':zoom':
|
||||
GetEventDispatcher().dispatchEvent(new RoomZoomEvent(roomSession.roomId, parseFloat(secondPart), false));
|
||||
GetEventDispatcher().dispatchEvent(new RoomZoomEvent(roomSession.roomId, parseInt(secondPart)));
|
||||
|
||||
return null;
|
||||
case ':screenshot':
|
||||
|
Loading…
Reference in New Issue
Block a user