mirror of
https://github.com/JannisX11/blockbench.git
synced 2025-01-18 15:26:19 +08:00
Flipping now works with mesh selections
This commit is contained in:
parent
b77ba2e90a
commit
f80f95edce
@ -441,19 +441,27 @@ class Mesh extends OutlinerElement {
|
||||
return this;
|
||||
}
|
||||
flip(axis, center) {
|
||||
for (let key in this.vertices) {
|
||||
this.vertices[key][axis] *= -1;
|
||||
let object_mode = BarItems.selection_mode.value == 'object';
|
||||
let selected_vertices = this.getSelectedVertices();
|
||||
for (let vkey in this.vertices) {
|
||||
if (object_mode || selected_vertices.includes(vkey)) {
|
||||
this.vertices[vkey][axis] *= -1;
|
||||
}
|
||||
}
|
||||
for (let key in this.faces) {
|
||||
this.faces[key].invert();
|
||||
if (object_mode || this.faces[key].isSelected()) {
|
||||
this.faces[key].invert();
|
||||
}
|
||||
}
|
||||
|
||||
this.origin[axis] *= -1;
|
||||
this.rotation.forEach((n, i) => {
|
||||
if (i != axis) this.rotation[i] = -n;
|
||||
})
|
||||
if (object_mode) {
|
||||
this.origin[axis] *= -1;
|
||||
this.rotation.forEach((n, i) => {
|
||||
if (i != axis) this.rotation[i] = -n;
|
||||
})
|
||||
this.preview_controller.updateTransform(this);
|
||||
}
|
||||
|
||||
this.preview_controller.updateTransform(this);
|
||||
this.preview_controller.updateGeometry(this);
|
||||
this.preview_controller.updateUV(this);
|
||||
return this;
|
||||
|
Loading…
Reference in New Issue
Block a user