moveTo handler
HTML
<link rel="stylesheet" href="http://jsxgraph.uni-bayreuth.de/distrib/jsxgraph.css">
<script src="http://jsxgraph.uni-bayreuth.de/distrib/jsxgraphcore.js"></script>
<div id="jxgbox" class="jxgbox" style="width:500px; height:500px;"></div>
JavaScript
var board = JXG.JSXGraph.initBoard('jxgbox', {boundingbox: [-10, 10, 10, -10], showNavigation: false, axis: false});
var x = 10;
var p = board.create('point', [function () { return x; }, 2]);
p.coords.on('update', function (ou, os) {
// ou: old user coordinates
// os: old screen coordinates
// we must not call setCoordinates, otherwise we'll end up in an endless loop
this.usrCoords = [1, Math.max(1, this.usrCoords[1]), this.usrCoords[2]];
this.usr2screen();
});
p.moveTo([-4, 2], 2000);