add preferences for auto-center and auto-floor
This commit is contained in:
parent
2696406601
commit
c04dac8ba9
4 changed files with 37 additions and 7 deletions
|
|
@ -99,14 +99,17 @@ mesh.group = class MeshGroup extends mesh.object {
|
|||
|
||||
promote() {
|
||||
this.centerModels();
|
||||
let { dim } = this.bounds;
|
||||
let { dim, mid } = this.bounds;
|
||||
let { x, y, z } = dim;
|
||||
let max = Math.max(x, y, z);
|
||||
if (max < 2) {
|
||||
mesh.api.log.emit(`auto-scaling import from ${max.round(5)}`);
|
||||
this.scale(1000, 1000, 1000);
|
||||
}
|
||||
return this.centerXY().floor();
|
||||
let { center, floor } = mesh.api.prefs.map.space;
|
||||
if (center !== false) this.centerXY();
|
||||
if (floor !== false) this.floor();
|
||||
return this;
|
||||
}
|
||||
|
||||
scale(x = 1, y = 1, z = 1) {
|
||||
|
|
@ -123,6 +126,11 @@ mesh.group = class MeshGroup extends mesh.object {
|
|||
for (let model of this.models) {
|
||||
model.center(bounds);
|
||||
}
|
||||
let { center } = mesh.api.prefs.map.space;
|
||||
if (center === false) {
|
||||
let { mid } = bounds;
|
||||
this.move(mid.x, mid.y, mid.z);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue