JSXGraph Renaming Inserted Points.

I need help.

by mbourne

HTML

<!DOCTYPE html>
<html lang="en">

  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">	
    <title>JSXGraph Help</title>
    <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/jsxgraph@1.2.2/distrib/jsxgraph.css" />
  </head>

  <body>
    <div id="boxWrap">
     <div id="jxgbox" class="jxgbox"></div>
    </div>   
    <script charset="UTF-8"
 src="https://cdn.jsdelivr.net/npm/jsxgraph@1.2.2/distrib/jsxgraphcore.js"></script>
  </body>

</html>

CSS

#boxWrap{max-width:95vmin}
#jxgbox{height:0;padding-bottom:100%}

JavaScript

const board = JXG.JSXGraph.initBoard('jxgbox', {
    boundingbox: [0, 100, 100, 0],
    axis: true
});

// When a point is inserted, it is given a (letter) name
// Then subscripts are used as suffixes when all alphabet is exhausted
let currentPointName = "A";
let currentPointSubscript = 1;

// In this example, the user can opt to insert a point 
// or select a previously-inserted point
let interactionMode = '';

// Create a button element for entering selection mode
let selectionButton = board.create('button', [70, 70, 'Select', function() {			
    interactionMode = 'selection';
}], {});

// Create a button element for drawing a line
let pointButton = board.create('button', [70, 60, 'Draw Point', function() {
    interactionMode = 'draw-point';
}], {});


let point;
let drawnObjects = [];

board.on('up', function(evt) {

    let coordinates = board.getUsrCoordsOfMouse(evt);
    // selection button
    if(interactionMode == "selection")
    {
        // Here I want to be able to click on a point and edit its name
        console.log("A click somewhere has been performed.");
    }
    // draw-point button
    else if(interactionMode == "draw-point")
    {
    		// add point
        point = board.create('point', coordinates, {name:currentPointName,size:4});
        // This bit is not working properly when multiple buttons are inserted
        point.on('up', function () {             
            this.setName("Another Name");              
           });    
           
        drawnObjects.push(point);
        // prepare next point name
        currentPointName = getNextKey(currentPointName);
    }
});

/*
Gives the next point's name: A-Z, A1-Z1, A2-Z2, ..., An-Zn
i.e. A, B, ..., Z, A1, B1, ..., Z1, A2, B2, ..., Z2, ...
*/
function getNextKey (key) 
{
    if (key === 'Z' || key === 'z') 
    {      
      return String.fromCharCode(key.charCodeAt() - 25) + currentPointSubscript; 
    } 
    else 
    {     
      let firstChar = key.slice(0,1);        
      let...