Refactor path presentation logic in ViewportHost
This commit is contained in:
@@ -8515,50 +8515,55 @@ 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 selected = isPathSelected(this.currentSelection, path.id);
|
const path = this.currentDocument.paths[pathId];
|
||||||
const hovered = isPathSelected(this.hoveredSelection, path.id);
|
const renderObjects = this.pathRenderObjects.get(pathId);
|
||||||
|
|
||||||
renderObjects.line.material.color.setHex(
|
if (path === undefined || renderObjects === undefined) {
|
||||||
selected
|
return;
|
||||||
? PATH_SELECTED_COLOR
|
}
|
||||||
: hovered
|
|
||||||
? PATH_HOVERED_COLOR
|
const selected = isPathSelected(this.currentSelection, path.id);
|
||||||
: PATH_COLOR
|
const hovered = isPathSelected(this.hoveredSelection, path.id);
|
||||||
|
|
||||||
|
renderObjects.line.material.color.setHex(
|
||||||
|
selected ? PATH_SELECTED_COLOR : hovered ? PATH_HOVERED_COLOR : PATH_COLOR
|
||||||
|
);
|
||||||
|
|
||||||
|
for (const pointMesh of renderObjects.pointMeshes) {
|
||||||
|
const pointSelected = isPathPointSelected(
|
||||||
|
this.currentSelection,
|
||||||
|
path.id,
|
||||||
|
pointMesh.pointId
|
||||||
|
);
|
||||||
|
const pointHovered = isPathPointSelected(
|
||||||
|
this.hoveredSelection,
|
||||||
|
path.id,
|
||||||
|
pointMesh.pointId
|
||||||
);
|
);
|
||||||
|
|
||||||
for (const pointMesh of renderObjects.pointMeshes) {
|
pointMesh.mesh.material.color.setHex(
|
||||||
const pointSelected = isPathPointSelected(
|
pointSelected
|
||||||
this.currentSelection,
|
? PATH_POINT_SELECTED_COLOR
|
||||||
path.id,
|
: pointHovered || selected
|
||||||
pointMesh.pointId
|
? PATH_POINT_HOVERED_COLOR
|
||||||
);
|
: PATH_POINT_COLOR
|
||||||
const pointHovered = isPathPointSelected(
|
);
|
||||||
this.hoveredSelection,
|
pointMesh.mesh.scale.setScalar(
|
||||||
path.id,
|
pointSelected
|
||||||
pointMesh.pointId
|
? PATH_POINT_SELECTED_SCALE
|
||||||
);
|
: pointHovered
|
||||||
|
? PATH_POINT_HOVERED_SCALE
|
||||||
pointMesh.mesh.material.color.setHex(
|
: 1
|
||||||
pointSelected
|
);
|
||||||
? PATH_POINT_SELECTED_COLOR
|
|
||||||
: pointHovered || selected
|
|
||||||
? PATH_POINT_HOVERED_COLOR
|
|
||||||
: PATH_POINT_COLOR
|
|
||||||
);
|
|
||||||
pointMesh.mesh.scale.setScalar(
|
|
||||||
pointSelected
|
|
||||||
? PATH_POINT_SELECTED_SCALE
|
|
||||||
: pointHovered
|
|
||||||
? PATH_POINT_HOVERED_SCALE
|
|
||||||
: 1
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user