Fix #1804 Centering view on empty project corrupts view

Reset Zoom on UV editor now also resets position
This commit is contained in:
JannisX11 2023-04-01 19:29:14 +02:00
parent b745465bea
commit 7128d69f74
2 changed files with 5 additions and 1 deletions

View File

@ -610,6 +610,10 @@ function setZoomLevel(mode) {
case 'reset': zoom = 1; break;
}
UVEditor.setZoom(zoom);
if (mode == 'reset') {
Project.uv_viewport.offset.V2_set(0, 0);
UVEditor.loadViewportOffset();
}
} else if (Prop.active_panel == 'timeline') {

View File

@ -68,7 +68,7 @@ function getSelectionCenter(all = false) {
min[2] = Math.min(pos.z, min[2]); max[2] = Math.max(pos.z, max[2]);
}
})
let center = max.V3_add(min).V3_divide(2);
let center = (min[0] == Infinity) ? [0, 0, 0] : max.V3_add(min).V3_divide(2);
if (!Format.centered_grid) {
center.V3_add(8, 8, 8)