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