objects locking system
This commit is contained in:
+14
-6
@@ -55,16 +55,24 @@ function autoScale(object, mk = 1) {
|
||||
object.scale.multiplyScalar(mk / k);
|
||||
}
|
||||
|
||||
function wrapInGroup(object){
|
||||
if (object.isWrapper) return object;
|
||||
let group = new Group();
|
||||
group.userData.bbox = getBoundingBox(object);
|
||||
group.add(object);
|
||||
group.userData.object = object;
|
||||
group.isWrapper = true;
|
||||
return group;
|
||||
}
|
||||
|
||||
function centerOrigin(object){
|
||||
let result = new Group();
|
||||
result.userData.bbox = getBoundingBox(object);
|
||||
let position = getBoundingBoxCenterPoint(result.userData.bbox, object.position).negate();
|
||||
let group = wrapInGroup(object);
|
||||
let position = getBoundingBoxCenterPoint(group.userData.bbox, object.position).negate();
|
||||
object.position.copy(position)
|
||||
result.add(object);
|
||||
return result;
|
||||
return group;
|
||||
}
|
||||
|
||||
export {
|
||||
assignParams, assignMaterial, autoScale, centerOrigin,
|
||||
assignParams, assignMaterial, autoScale, centerOrigin, wrapInGroup,
|
||||
getBoundingBox, getBoundingBoxSize, getBoundingBoxMaxLength, getBoundingBoxCenterPoint
|
||||
}
|
||||
Reference in New Issue
Block a user