mirror of
https://github.com/billsonnn/nitro-react.git
synced 2025-01-18 13:26:27 +01:00
Fixes
This commit is contained in:
parent
0db9e4ad45
commit
23f6bdbf4b
@ -32,24 +32,24 @@ export const LayoutRoomPreviewerView: FC<LayoutRoomPreviewerViewProps> = props =
|
||||
{
|
||||
if(!roomPreviewer || !elementRef.current) return;
|
||||
|
||||
roomPreviewer.updatePreviewRoomView();
|
||||
|
||||
const canvas = roomPreviewer.getRoomCanvas(width, height);
|
||||
const renderingCanvas = roomPreviewer.getRenderingCanvas();
|
||||
|
||||
if(!renderingCanvas.canvasUpdated) return;
|
||||
|
||||
roomPreviewer.updatePreviewRoomView();
|
||||
|
||||
GetRenderer().render({
|
||||
target: texture,
|
||||
container: renderingCanvas.master,
|
||||
container: canvas,
|
||||
clear: true
|
||||
});
|
||||
|
||||
let canvas = GetRenderer().texture.generateCanvas(texture);
|
||||
const base64 = canvas.toDataURL('image/png');
|
||||
const url = await TextureUtils.generateImageUrl(texture);
|
||||
|
||||
canvas = null;
|
||||
if(!elementRef || !elementRef.current) return;
|
||||
|
||||
elementRef.current.style.backgroundImage = `url(${ base64 })`;
|
||||
elementRef.current.style.backgroundImage = `url(${ url })`;
|
||||
};
|
||||
|
||||
GetTicker().add(update);
|
||||
@ -65,8 +65,6 @@ export const LayoutRoomPreviewerView: FC<LayoutRoomPreviewerViewProps> = props =
|
||||
update(GetTicker());
|
||||
});
|
||||
|
||||
roomPreviewer.getRoomCanvas(width, height);
|
||||
|
||||
resizeObserver.observe(elementRef.current);
|
||||
|
||||
return () =>
|
||||
|
@ -204,7 +204,7 @@ const useRoomState = () =>
|
||||
const height = Math.floor(window.innerHeight);
|
||||
const renderer = GetRenderer();
|
||||
|
||||
if(renderer) renderer.resize(width, height);
|
||||
if(renderer) renderer.resize(width, height, window.devicePixelRatio);
|
||||
|
||||
const displayObject = roomEngine.getRoomInstanceDisplay(roomId, canvasId, width, height, RoomGeometry.SCALE_ZOOMED_IN);
|
||||
const canvas = GetRoomEngine().getRoomInstanceRenderingCanvas(roomId, canvasId);
|
||||
@ -256,13 +256,13 @@ const useRoomState = () =>
|
||||
const width = Math.floor(window.innerWidth);
|
||||
const height = Math.floor(window.innerHeight);
|
||||
|
||||
renderer.resolution = window.devicePixelRatio;
|
||||
renderer.resize(width, height);
|
||||
|
||||
background.width = width;
|
||||
background.height = height;
|
||||
|
||||
renderer.resize(width, height, window.devicePixelRatio);
|
||||
|
||||
InitializeRoomInstanceRenderingCanvas(width, height, 1);
|
||||
GetRenderer().render(GetStage());
|
||||
};
|
||||
|
||||
window.addEventListener('resize', resize);
|
||||
|
Loading…
Reference in New Issue
Block a user