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