当Mesh.useSelectionBox === false时,不使用包围盒。

This commit is contained in:
liteng 2018-07-08 19:52:16 +08:00
parent 1552d87b41
commit 11c43dd6c6
5 changed files with 6 additions and 5 deletions

View File

@ -62,7 +62,7 @@ function Editor(app) {
this.grid = new THREE.GridHelper(60, 60);
this.sceneHelpers.add(this.grid);
// 选中包围盒
// 选中包围盒当mesh.useSelectionBox === false时不使用包围盒
this.selectionBox = new THREE.BoxHelper();
this.selectionBox.material.depthTest = false;
this.selectionBox.material.transparent = true;

View File

@ -46,6 +46,7 @@ AddFireEvent.prototype.onAddFire = function () {
);
fire.mesh.name = 'Fire ' + ID++;
fire.mesh.useSelectionBox = false;
fire.mesh.geometry.boundingBox = new THREE.Box3(
new THREE.Vector3(-fireWidth, -fireHeight, -fireDepth),
new THREE.Vector3(fireWidth, fireHeight, fireDepth)

View File

@ -25,7 +25,7 @@ GeometryEvent.prototype.stop = function () {
GeometryEvent.prototype.onGeometryChanged = function (object) {
var selectionBox = this.app.editor.selectionBox;
if (object !== undefined) {
if (object !== undefined && object.useSelectionBox !== false) {
selectionBox.setFromObject(object);
}

View File

@ -52,7 +52,7 @@ ObjectEvent.prototype.onObjectChanged = function (object) {
var selectionBox = editor.selectionBox;
var transformControls = editor.transformControls;
if (editor.selected === object) {
if (editor.selected === object && object.useSelectionBox !== false) {
selectionBox.setFromObject(object);
transformControls.update();
}
@ -88,7 +88,7 @@ ObjectEvent.prototype.onObjectSelected = function (object) {
if (object !== null && object !== scene) {
box.setFromObject(object);
if (box.isEmpty() === false) {
if (box.isEmpty() === false && object.useSelectionBox !== false) {
selectionBox.setFromObject(object);
selectionBox.visible = true;
}

View File

@ -49,7 +49,7 @@ TransformControlsEvent.prototype.onChange = function () {
var object = transformControls.object;
if (object !== undefined) {
if (object !== undefined && object.useSelectionBox !== false) {
selectionBox.setFromObject(object);
if (editor.helpers[object.id] !== undefined) {