Miew.prototype._updateInfoPanel = function()

in packages/miew/src/Miew.js [2937:3001]


Miew.prototype._updateInfoPanel = function () {
  const info = this._msgAtomInfo.getElementsByTagName('p')[0];
  let atom;
  let residue;

  let count = 0;
  this._forEachComplexVisual((visual) => {
    count += visual.getSelectionCount();
  });

  while (info.firstChild) {
    info.removeChild(info.firstChild);
  }

  if (count === 0) {
    this._msgAtomInfo.style.opacity = 0.0;
    return;
  }

  let firstLine = `${String(count)} atom${count !== 1 ? 's' : ''} selected`;
  if (this._lastPick !== null) {
    firstLine += ', the last pick:';
  }
  let secondLine = '';
  let aName = '';
  let coordLine = '';

  if (this._lastPick instanceof Atom) {
    atom = this._lastPick;
    residue = atom.residue;

    aName = atom.name;
    const location = (atom.location !== 32) ? String.fromCharCode(atom.location) : ''; // 32 is code of white-space
    secondLine = `${atom.element.fullName} #${atom.serial}${location}: \
      ${residue._chain._name}.${residue._type._name}${residue._sequence}${residue._icode.trim()}.`;
    secondLine += aName;

    coordLine = `Coord: (${atom.position.x.toFixed(2).toString()},\
     ${atom.position.y.toFixed(2).toString()},\
     ${atom.position.z.toFixed(2).toString()})`;
  } else if (this._lastPick instanceof Residue) {
    residue = this._lastPick;

    secondLine = `${residue._type._fullName}: \
      ${residue._chain._name}.${residue._type._name}${residue._sequence}${residue._icode.trim()}`;
  } else if (this._lastPick instanceof Chain) {
    secondLine = `chain ${this._lastPick._name}`;
  } else if (this._lastPick instanceof Molecule) {
    secondLine = `molecule ${this._lastPick._name}`;
  }

  info.appendChild(document.createTextNode(firstLine));

  if (secondLine !== '') {
    info.appendChild(document.createElement('br'));
    info.appendChild(document.createTextNode(secondLine));
  }

  if (coordLine !== '') {
    info.appendChild(document.createElement('br'));
    info.appendChild(document.createTextNode(coordLine));
  }

  this._msgAtomInfo.style.opacity = 1.0;
};