perf: less change
This commit is contained in:
parent
5521d28131
commit
1d61c3c14a
|
@ -265,12 +265,13 @@ export default function Ui({disconnected}) {
|
||||||
}
|
}
|
||||||
if (localMainEntity) {
|
if (localMainEntity) {
|
||||||
const mainEntityEntity = ecs.get(localMainEntity);
|
const mainEntityEntity = ecs.get(localMainEntity);
|
||||||
setCamera({
|
const x = Math.round((mainEntityEntity.Camera.x * scale) - RESOLUTION.x / 2);
|
||||||
x: Math.round((mainEntityEntity.Camera.x * scale) - RESOLUTION.x / 2),
|
const y = Math.round((mainEntityEntity.Camera.y * scale) - RESOLUTION.y / 2);
|
||||||
y: Math.round((mainEntityEntity.Camera.y * scale) - RESOLUTION.y / 2),
|
if (x !== camera.x || y !== camera.y) {
|
||||||
});
|
setCamera({x, y});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, [ecs, mainEntity, scale]);
|
}, [camera, ecs, mainEntity, scale]);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
function onContextMenu(event) {
|
function onContextMenu(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user