mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-30 00:50:50 +01:00
More fixes
This commit is contained in:
parent
ce623859df
commit
c80b4ad547
@ -21,12 +21,11 @@ export const RoomColorView: FC<{}> = props =>
|
|||||||
|
|
||||||
if(!hue && !saturation && !lightness)
|
if(!hue && !saturation && !lightness)
|
||||||
{
|
{
|
||||||
roomBackground.visible = false;
|
roomBackground.tint = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
roomBackground.tint = newColor;
|
roomBackground.tint = newColor;
|
||||||
roomBackground.visible = true;
|
|
||||||
}
|
}
|
||||||
}, [ roomBackground ]);
|
}, [ roomBackground ]);
|
||||||
|
|
||||||
@ -95,7 +94,6 @@ export const RoomColorView: FC<{}> = props =>
|
|||||||
if(!roomBackground) return;
|
if(!roomBackground) return;
|
||||||
|
|
||||||
roomBackground.tint = originalRoomBackgroundColor;
|
roomBackground.tint = originalRoomBackgroundColor;
|
||||||
roomBackground.visible = true;
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -117,7 +115,7 @@ export const RoomColorView: FC<{}> = props =>
|
|||||||
const filter = new NitroAdjustmentFilter();
|
const filter = new NitroAdjustmentFilter();
|
||||||
const master = (canvas.master as NitroContainer);
|
const master = (canvas.master as NitroContainer);
|
||||||
|
|
||||||
background.visible = false;
|
background.tint = 0;
|
||||||
background.width = GetNitroInstance().width;
|
background.width = GetNitroInstance().width;
|
||||||
background.height = GetNitroInstance().height;
|
background.height = GetNitroInstance().height;
|
||||||
|
|
||||||
|
@ -52,6 +52,25 @@ export const RoomView: FC<{}> = props =>
|
|||||||
UseRoomSessionManagerEvent(RoomSessionEvent.CREATED, onRoomSessionEvent);
|
UseRoomSessionManagerEvent(RoomSessionEvent.CREATED, onRoomSessionEvent);
|
||||||
UseRoomSessionManagerEvent(RoomSessionEvent.ENDED, onRoomSessionEvent);
|
UseRoomSessionManagerEvent(RoomSessionEvent.ENDED, onRoomSessionEvent);
|
||||||
|
|
||||||
|
const resize = useCallback((event: UIEvent = null) =>
|
||||||
|
{
|
||||||
|
const canvas = GetNitroInstance().renderer.view;
|
||||||
|
|
||||||
|
if(!canvas) return;
|
||||||
|
|
||||||
|
canvas.style.width = `${ Math.floor(window.innerWidth) }px`;
|
||||||
|
canvas.style.height = `${ Math.floor(window.innerHeight) }px`;
|
||||||
|
|
||||||
|
const nitroInstance = GetNitroInstance();
|
||||||
|
|
||||||
|
nitroInstance.renderer.resolution = window.devicePixelRatio;
|
||||||
|
nitroInstance.renderer.resize(window.innerWidth, window.innerHeight);
|
||||||
|
|
||||||
|
InitializeRoomInstanceRenderingCanvas(window.innerWidth, window.innerHeight, 1);
|
||||||
|
|
||||||
|
nitroInstance.render();
|
||||||
|
}, []);
|
||||||
|
|
||||||
useEffect(() =>
|
useEffect(() =>
|
||||||
{
|
{
|
||||||
if(!roomSession)
|
if(!roomSession)
|
||||||
@ -88,6 +107,9 @@ export const RoomView: FC<{}> = props =>
|
|||||||
const roomEngine = GetRoomEngine();
|
const roomEngine = GetRoomEngine();
|
||||||
const roomId = roomSession.roomId;
|
const roomId = roomSession.roomId;
|
||||||
const canvasId = 1;
|
const canvasId = 1;
|
||||||
|
|
||||||
|
resize();
|
||||||
|
|
||||||
const displayObject = roomEngine.getRoomInstanceDisplay(roomId, canvasId, window.innerWidth, window.innerHeight, RoomGeometry.SCALE_ZOOMED_IN);
|
const displayObject = roomEngine.getRoomInstanceDisplay(roomId, canvasId, window.innerWidth, window.innerHeight, RoomGeometry.SCALE_ZOOMED_IN);
|
||||||
|
|
||||||
if(!displayObject) return;
|
if(!displayObject) return;
|
||||||
@ -121,7 +143,7 @@ export const RoomView: FC<{}> = props =>
|
|||||||
stage.addChild(displayObject);
|
stage.addChild(displayObject);
|
||||||
|
|
||||||
SetActiveRoomId(roomSession.roomId);
|
SetActiveRoomId(roomSession.roomId);
|
||||||
}, [ roomSession ]);
|
}, [ roomSession, resize ]);
|
||||||
|
|
||||||
useEffect(() =>
|
useEffect(() =>
|
||||||
{
|
{
|
||||||
@ -139,23 +161,7 @@ export const RoomView: FC<{}> = props =>
|
|||||||
canvas.ontouchend = event => DispatchTouchEvent(event);
|
canvas.ontouchend = event => DispatchTouchEvent(event);
|
||||||
canvas.ontouchcancel = event => DispatchTouchEvent(event);
|
canvas.ontouchcancel = event => DispatchTouchEvent(event);
|
||||||
|
|
||||||
canvas.style.width = `${ Math.floor(window.innerWidth) }px`;
|
resize();
|
||||||
canvas.style.height = `${ Math.floor(window.innerHeight) }px`;
|
|
||||||
|
|
||||||
const resize = (event: UIEvent) =>
|
|
||||||
{
|
|
||||||
canvas.style.width = `${ Math.floor(window.innerWidth) }px`;
|
|
||||||
canvas.style.height = `${ Math.floor(window.innerHeight) }px`;
|
|
||||||
|
|
||||||
const nitroInstance = GetNitroInstance();
|
|
||||||
|
|
||||||
nitroInstance.renderer.resolution = window.devicePixelRatio;
|
|
||||||
nitroInstance.renderer.resize(window.innerWidth, window.innerHeight);
|
|
||||||
|
|
||||||
InitializeRoomInstanceRenderingCanvas(window.innerWidth, window.innerHeight, 1);
|
|
||||||
|
|
||||||
nitroInstance.render();
|
|
||||||
}
|
|
||||||
|
|
||||||
const element = elementRef.current;
|
const element = elementRef.current;
|
||||||
|
|
||||||
@ -169,7 +175,7 @@ export const RoomView: FC<{}> = props =>
|
|||||||
|
|
||||||
window.removeEventListener('resize', resize);
|
window.removeEventListener('resize', resize);
|
||||||
}
|
}
|
||||||
}, []);
|
}, [ resize ]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<RoomContextProvider value={ { roomSession, eventDispatcher: (widgetHandler && widgetHandler.eventDispatcher), widgetHandler } }>
|
<RoomContextProvider value={ { roomSession, eventDispatcher: (widgetHandler && widgetHandler.eventDispatcher), widgetHandler } }>
|
||||||
|
Loading…
Reference in New Issue
Block a user