More fixes

This commit is contained in:
Bill 2022-04-09 22:04:17 -04:00
parent ce623859df
commit c80b4ad547
2 changed files with 27 additions and 23 deletions

View File

@ -21,12 +21,11 @@ export const RoomColorView: FC<{}> = props =>
if(!hue && !saturation && !lightness)
{
roomBackground.visible = false;
roomBackground.tint = 0;
}
else
{
roomBackground.tint = newColor;
roomBackground.visible = true;
}
}, [ roomBackground ]);
@ -95,7 +94,6 @@ export const RoomColorView: FC<{}> = props =>
if(!roomBackground) return;
roomBackground.tint = originalRoomBackgroundColor;
roomBackground.visible = true;
return;
}
@ -117,7 +115,7 @@ export const RoomColorView: FC<{}> = props =>
const filter = new NitroAdjustmentFilter();
const master = (canvas.master as NitroContainer);
background.visible = false;
background.tint = 0;
background.width = GetNitroInstance().width;
background.height = GetNitroInstance().height;

View File

@ -52,6 +52,25 @@ export const RoomView: FC<{}> = props =>
UseRoomSessionManagerEvent(RoomSessionEvent.CREATED, 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(() =>
{
if(!roomSession)
@ -88,6 +107,9 @@ export const RoomView: FC<{}> = props =>
const roomEngine = GetRoomEngine();
const roomId = roomSession.roomId;
const canvasId = 1;
resize();
const displayObject = roomEngine.getRoomInstanceDisplay(roomId, canvasId, window.innerWidth, window.innerHeight, RoomGeometry.SCALE_ZOOMED_IN);
if(!displayObject) return;
@ -121,7 +143,7 @@ export const RoomView: FC<{}> = props =>
stage.addChild(displayObject);
SetActiveRoomId(roomSession.roomId);
}, [ roomSession ]);
}, [ roomSession, resize ]);
useEffect(() =>
{
@ -139,23 +161,7 @@ export const RoomView: FC<{}> = props =>
canvas.ontouchend = event => DispatchTouchEvent(event);
canvas.ontouchcancel = event => DispatchTouchEvent(event);
canvas.style.width = `${ Math.floor(window.innerWidth) }px`;
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();
}
resize();
const element = elementRef.current;
@ -169,7 +175,7 @@ export const RoomView: FC<{}> = props =>
window.removeEventListener('resize', resize);
}
}, []);
}, [ resize ]);
return (
<RoomContextProvider value={ { roomSession, eventDispatcher: (widgetHandler && widgetHandler.eventDispatcher), widgetHandler } }>