Refactor path presentation logic in ViewportHost
This commit is contained in:
@@ -8515,21 +8515,27 @@ export class ViewportHost {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (const path of Object.values(this.currentDocument.paths)) {
|
for (const path of Object.values(this.currentDocument.paths)) {
|
||||||
const renderObjects = this.pathRenderObjects.get(path.id);
|
this.refreshPathPresentationForId(path.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (renderObjects === undefined) {
|
private refreshPathPresentationForId(pathId: string) {
|
||||||
continue;
|
if (this.currentDocument === null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const path = this.currentDocument.paths[pathId];
|
||||||
|
const renderObjects = this.pathRenderObjects.get(pathId);
|
||||||
|
|
||||||
|
if (path === undefined || renderObjects === undefined) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const selected = isPathSelected(this.currentSelection, path.id);
|
const selected = isPathSelected(this.currentSelection, path.id);
|
||||||
const hovered = isPathSelected(this.hoveredSelection, path.id);
|
const hovered = isPathSelected(this.hoveredSelection, path.id);
|
||||||
|
|
||||||
renderObjects.line.material.color.setHex(
|
renderObjects.line.material.color.setHex(
|
||||||
selected
|
selected ? PATH_SELECTED_COLOR : hovered ? PATH_HOVERED_COLOR : PATH_COLOR
|
||||||
? PATH_SELECTED_COLOR
|
|
||||||
: hovered
|
|
||||||
? PATH_HOVERED_COLOR
|
|
||||||
: PATH_COLOR
|
|
||||||
);
|
);
|
||||||
|
|
||||||
for (const pointMesh of renderObjects.pointMeshes) {
|
for (const pointMesh of renderObjects.pointMeshes) {
|
||||||
@@ -8560,7 +8566,6 @@ export class ViewportHost {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private disposeUniqueMaterials(materials: Material[]) {
|
private disposeUniqueMaterials(materials: Material[]) {
|
||||||
for (const material of new Set(materials)) {
|
for (const material of new Set(materials)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user