mirror of
https://github.com/JannisX11/blockbench.git
synced 2025-01-18 15:26:19 +08:00
FIx inflate slider in bedrock block format
This commit is contained in:
parent
4bd1563d22
commit
95d7f5b35a
@ -1386,6 +1386,7 @@ var block_format = new ModelFormat({
|
||||
});
|
||||
return vertices;
|
||||
},
|
||||
// Test if it overlaps
|
||||
test(cube, values = 0) {
|
||||
let from = values.from || cube.from;
|
||||
let to = values.to || cube.to;
|
||||
@ -1394,11 +1395,12 @@ var block_format = new ModelFormat({
|
||||
let vertices = block_format.cube_size_limiter.getCubeVertexCoordinates(cube, {from, to, inflate});
|
||||
let center = block_format.cube_size_limiter.getModelCenter([cube]);
|
||||
|
||||
return undefined !== vertices.find((v, i) => {
|
||||
let vertex_outside_bounds = vertices.find((v, i) => {
|
||||
return (v[0] > center[3]+15 || v[0] < center[0]-15)
|
||||
|| (v[1] > center[4]+15 || v[1] < center[1]-15)
|
||||
|| (v[2] > center[5]+15 || v[2] < center[2]-15);
|
||||
})
|
||||
return vertex_outside_bounds !== undefined;
|
||||
},
|
||||
move(cube, values = 0) {
|
||||
let from = values.from || cube.from;
|
||||
|
@ -1167,13 +1167,13 @@ BARS.defineActions(function() {
|
||||
|
||||
obj.inflate = v;
|
||||
} else {
|
||||
if (Format.cube_size_limiter.test(obj, {inflate: v})) {
|
||||
if (Format.cube_size_limiter.test(obj, {inflate: v}) == false) {
|
||||
obj.inflate = v;
|
||||
} else {
|
||||
let step = Math.sign(v - v_before) * 0.1;
|
||||
let steps = (v - v_before) / step;
|
||||
for (let i = 0; i < steps; i++) {
|
||||
if (Format.cube_size_limiter.test(obj, {inflate: v_before + i * (steps+1)})) {
|
||||
if (Format.cube_size_limiter.test(obj, {inflate: v_before + i * (steps+1)}) == false) {
|
||||
obj.inflate = v_before + i * steps;
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user