beam: avoid point cloud highlight masking
This commit is contained in:
@@ -18,6 +18,13 @@ export class TransformGizmo {
|
||||
this._bindTree();
|
||||
}
|
||||
|
||||
_isPointCloudTarget(model, objectId = null) {
|
||||
const entity = objectId ? this.scene.objects[objectId] : null;
|
||||
const firstObject = entity || Object.values(model?.objects || {})[0];
|
||||
const firstMesh = firstObject?.meshes?.[0] || model?.meshes?.[0];
|
||||
return firstMesh?._geometry?._state?.primitiveName === "points";
|
||||
}
|
||||
|
||||
setMode(next) {
|
||||
if (!["translate", "rotate", "scale"].includes(next)) return;
|
||||
this.mode = next;
|
||||
@@ -66,7 +73,9 @@ export class TransformGizmo {
|
||||
scale: model.scale ? [...model.scale] : [1, 1, 1],
|
||||
},
|
||||
});
|
||||
this.scene.setObjectsHighlighted([objectId], true);
|
||||
if (!this._isPointCloudTarget(model, objectId)) {
|
||||
this.scene.setObjectsHighlighted([objectId], true);
|
||||
}
|
||||
this.target = { modelId, objectId };
|
||||
return;
|
||||
}
|
||||
@@ -74,7 +83,7 @@ export class TransformGizmo {
|
||||
|
||||
// Если objectId нет, работаем всей моделью
|
||||
const ids = Object.keys(model.objects || {});
|
||||
if (ids.length) {
|
||||
if (ids.length && !this._isPointCloudTarget(model)) {
|
||||
this.scene.setObjectsHighlighted(ids, true);
|
||||
}
|
||||
this.onTargetChange?.({
|
||||
@@ -101,7 +110,9 @@ export class TransformGizmo {
|
||||
if (model) {
|
||||
const ids = Object.keys(model.objects || {});
|
||||
this.scene.setObjectsHighlighted(this.scene.highlightedObjectIds || [], false);
|
||||
this.scene.setObjectsHighlighted(ids, true);
|
||||
if (!this._isPointCloudTarget(model)) {
|
||||
this.scene.setObjectsHighlighted(ids, true);
|
||||
}
|
||||
this.target = { modelId, objectId: null };
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user