@@ -610,7 +610,30 @@ export class Viewer {
610610 this . plugin . managers . camera . focusLoci ( loci ) ;
611611 }
612612
613- selectResidueSurroundings ( target : Target , radius : number ) {
613+ /**
614+ * Selects all surrounding polymeric residues within a specified radius of a given target.
615+ *
616+ * The function:
617+ * 1. Resolves the default structure from the plugin context.
618+ * 2. Creates a residue-level selection expression for the given target.
619+ * 3. Expands the selection to include all residues within the provided
620+ * radius (in Å), treating each residue as a whole.
621+ * 4. Restricts the expanded selection to residues from polymeric chains only.
622+ * 5. Executes the compiled query and adds the resulting loci to the
623+ * structure selection manager.
624+ *
625+ * If no default structure is available, the function returns without
626+ * modifying the current selection.
627+ *
628+ * @param {Target } target
629+ * The target residue used as the center of the surroundings selection.
630+ *
631+ * @param {number } radius
632+ * The radius (in Å) within which surrounding residues are selected.
633+ *
634+ * @returns {void }
635+ */
636+ selectResidueSurroundings ( target : Target , radius : number ) : void {
614637 const structure = getDefaultStructure ( this . plugin ) ;
615638 if ( ! structure ) return ;
616639
@@ -633,7 +656,24 @@ export class Viewer {
633656 this . plugin . managers . structure . selection . fromLoci ( 'add' , surroundingsLoci ) ;
634657 }
635658
636- orderTargetsByDistanceToPivot ( pivot : Target , targets : Target [ ] ) {
659+ /**
660+ * Orders a list of targets by their spatial distance to a pivot target.
661+ *
662+ * The distance between the pivot and each target is computed using the
663+ * currently loaded default structure. Targets are then sorted in ascending
664+ * order of distance (closest first).
665+ *
666+ * @param {Target } pivot
667+ * The reference target from which distances are calculated.
668+ *
669+ * @param {Target[] } targets
670+ * The list of targets to be ordered by distance to the pivot.
671+ *
672+ * @returns {Target[] | undefined }
673+ * An array of targets sorted by increasing distance to the pivot, or
674+ * {@code undefined} if no default structure is available.
675+ */
676+ orderTargetsByDistanceToPivot ( pivot : Target , targets : Target [ ] ) : Target [ ] | undefined {
637677 const structure = getDefaultStructure ( this . plugin ) ;
638678 if ( ! structure ) return ;
639679 return getTargetsDistanceToPivot ( pivot , targets , structure )
0 commit comments