beam: avoid point cloud highlight masking
This commit is contained in:
parent
0a09296022
commit
ff994e705d
|
|
@ -441,6 +441,8 @@ const getBaseEdgesForModel = (modelId) => {
|
||||||
return !!toggleEdges?.checked;
|
return !!toggleEdges?.checked;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const isPointCloudModel = (modelId) => modelTypes[modelId] === "las";
|
||||||
|
|
||||||
const applyDisplayModeToModel = (modelId) => {
|
const applyDisplayModeToModel = (modelId) => {
|
||||||
const model = sceneModels[modelId] || viewer?.scene?.models?.[modelId];
|
const model = sceneModels[modelId] || viewer?.scene?.models?.[modelId];
|
||||||
if (!model) return;
|
if (!model) return;
|
||||||
|
|
@ -1323,7 +1325,9 @@ const setSelection = (ids, modelId) => {
|
||||||
};
|
};
|
||||||
activeTransformTarget = { modelId, objectId: uniqueIds[0] || "__model__" };
|
activeTransformTarget = { modelId, objectId: uniqueIds[0] || "__model__" };
|
||||||
scene.setObjectsHighlighted(scene.highlightedObjectIds || [], false);
|
scene.setObjectsHighlighted(scene.highlightedObjectIds || [], false);
|
||||||
scene.setObjectsHighlighted(uniqueIds, true);
|
if (!isPointCloudModel(modelId)) {
|
||||||
|
scene.setObjectsHighlighted(uniqueIds, true);
|
||||||
|
}
|
||||||
updateTransformInputs(transform);
|
updateTransformInputs(transform);
|
||||||
// Global center for group
|
// Global center for group
|
||||||
updateGlobalInputs(centerFromAABB(aabb));
|
updateGlobalInputs(centerFromAABB(aabb));
|
||||||
|
|
|
||||||
|
|
@ -239,6 +239,6 @@
|
||||||
<input id="fileInput" class="hidden" type="file"
|
<input id="fileInput" class="hidden" type="file"
|
||||||
accept=".xkt,.glb,.gltf,.bim,.las,.laz,.obj,.stl">
|
accept=".xkt,.glb,.gltf,.bim,.las,.laz,.obj,.stl">
|
||||||
|
|
||||||
<script type="module" src="./dcViewer.js?v=10"></script>
|
<script type="module" src="./dcViewer.js?v=13"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,13 @@ export class TransformGizmo {
|
||||||
this._bindTree();
|
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) {
|
setMode(next) {
|
||||||
if (!["translate", "rotate", "scale"].includes(next)) return;
|
if (!["translate", "rotate", "scale"].includes(next)) return;
|
||||||
this.mode = next;
|
this.mode = next;
|
||||||
|
|
@ -66,7 +73,9 @@ export class TransformGizmo {
|
||||||
scale: model.scale ? [...model.scale] : [1, 1, 1],
|
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 };
|
this.target = { modelId, objectId };
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -74,7 +83,7 @@ export class TransformGizmo {
|
||||||
|
|
||||||
// Если objectId нет, работаем всей моделью
|
// Если objectId нет, работаем всей моделью
|
||||||
const ids = Object.keys(model.objects || {});
|
const ids = Object.keys(model.objects || {});
|
||||||
if (ids.length) {
|
if (ids.length && !this._isPointCloudTarget(model)) {
|
||||||
this.scene.setObjectsHighlighted(ids, true);
|
this.scene.setObjectsHighlighted(ids, true);
|
||||||
}
|
}
|
||||||
this.onTargetChange?.({
|
this.onTargetChange?.({
|
||||||
|
|
@ -101,7 +110,9 @@ export class TransformGizmo {
|
||||||
if (model) {
|
if (model) {
|
||||||
const ids = Object.keys(model.objects || {});
|
const ids = Object.keys(model.objects || {});
|
||||||
this.scene.setObjectsHighlighted(this.scene.highlightedObjectIds || [], false);
|
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 };
|
this.target = { modelId, objectId: null };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue