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