function makePoincTouch(controller) {
    // See https://jsxgraph.uni-bayreuth.de/wiki/index.php/Browser_event_and_coordinates

    var board = controller.poincbox;
    var getMouseCoords = function(e, i) {
      var cPos = board.getCoordsTopLeftCorner(e, i),
          absPos = JXG.getPosition(e, i),
          dx = absPos[0]-cPos[0],
          dy = absPos[1]-cPos[1];

      return new JXG.Coords(JXG.COORDS_BY_SCREEN, [dx, dy], board);
    };

    return function(e) {
      var ptExists = false, i, coords, thePoint;

      if (e[JXG.touchProperty]) {
        // Is this right?
        if (e.touches.length > 1) // multi-touch, pass through to treat as pan or zoom?
          return;

        // Calling preventDefault() so that we don't also generate a
        // click event, see
        // https://developer.mozilla.org/en-US/docs/Web/API/Touch_events/Supporting_both_TouchEvent_and_MouseEvent
        e.preventDefault();

        // index of the finger that is used to extract the coordinates
        i = 0;
      }
      coords = getMouseCoords(e, i);
      var b = coords.usrCoords[1];
      var lb = coords.usrCoords[2];

      for (var el in board.objects) {
        if(JXG.isPoint(board.objects[el]) && board.objects[el].hasPoint(coords.scrCoords[1], coords.scrCoords[2])) {
          ptExists = true;
          thePoint = board.objects[el];
          break;
        }
      }

      controller.handleTouch(b, lb, ptExists, thePoint);

    };
  }
/* This emits a click handler for the Poincare section.
   * This is the UI-specific code.  It dispatches to
   * controller.handleTouch after translating to logical (b, lb) coordinates.
   * handleTouch needs to know if there is already a point there, and
   * if so, which one
   */
This emits a click handler for the Poincare section.
This is the UI-specific code.  It dispatches to
controller.handleTouch after translating to logical (b, lb) coordinates.
handleTouch needs to know if there is already a point there, and
if so, which one
This emits a click handler for the Poincare section . This is the UI - specific code . It dispatches to controller . handleTouch after translating to logical ( b lb ) coordinates . handleTouch needs to know if there is already a point there and if so which one
function makePoincTouch(controller) {
    var board = controller.poincbox;
    var getMouseCoords = function(e, i) {
      var cPos = board.getCoordsTopLeftCorner(e, i),
          absPos = JXG.getPosition(e, i),
          dx = absPos[0]-cPos[0],
          dy = absPos[1]-cPos[1];
      return new JXG.Coords(JXG.COORDS_BY_SCREEN, [dx, dy], board);
    };
    return function(e) {
      var ptExists = false, i, coords, thePoint;
      if (e[JXG.touchProperty]) {
        if (e.touches.length > 1) 
          return;
        e.preventDefault();
        i = 0;
      }
      coords = getMouseCoords(e, i);
      var b = coords.usrCoords[1];
      var lb = coords.usrCoords[2];
      for (var el in board.objects) {
        if(JXG.isPoint(board.objects[el]) && board.objects[el].hasPoint(coords.scrCoords[1], coords.scrCoords[2])) {
          ptExists = true;
          thePoint = board.objects[el];
          break;
        }
      }
      controller.handleTouch(b, lb, ptExists, thePoint);
    };
  }
function makePoincTouch ( controller ) { var board = controller . poincbox ; var getMouseCoords = function ( e , i ) { var cPos = board . getCoordsTopLeftCorner ( e , i ) , absPos = JXG . getPosition ( e , i ) , dx = absPos [ 0 ] - cPos [ 0 ] , dy = absPos [ 1 ] - cPos [ 1 ] ; return new JXG . Coords ( JXG . COORDS_BY_SCREEN , [ dx , dy ] , board ) ; } ; return function ( e ) { var ptExists = false , i , coords , thePoint ; if ( e [ JXG . touchProperty ] ) { if ( e . touches . length > 1 ) return ; e . preventDefault ( ) ; i = 0 ; } coords = getMouseCoords ( e , i ) ; var b = coords . usrCoords [ 1 ] ; var lb = coords . usrCoords [ 2 ] ; for ( var el in board . objects ) { if ( JXG . isPoint ( board . objects [ el ] ) && board . objects [ el ] . hasPoint ( coords . scrCoords [ 1 ] , coords . scrCoords [ 2 ] ) ) { ptExists = true ; thePoint = board . objects [ el ] ; break ; } } controller . handleTouch ( b , lb , ptExists , thePoint ) ; } ; }
This emits a click handler for the Poincare section.
This emits a click handler for the Poincare section .
// See https://jsxgraph.uni-bayreuth.de/wiki/index.php/Browser_event_and_coordinates // Is this right? // multi-touch, pass through to treat as pan or zoom? // Calling preventDefault() so that we don't also generate a // click event, see // https://developer.mozilla.org/en-US/docs/Web/API/Touch_events/Supporting_both_TouchEvent_and_MouseEvent // index of the finger that is used to extract the coordinates