# Point 'fixed' in one direction

From JSXGraph Wiki

Revision as of 15:09, 8 October 2012 by A WASSERMANN (talk | contribs)

*A* and *B* are free points. Whenever the board is updated, e.g.
after a drag event, the x-coordinate of *A* is set to 1 and
the y-coordinate of *B* is set to 1. Therefore, *A* moves
on the vertical line through x=1, *B* moves on the horizontal line through y=1.

### The JavaScript code

```
var brd = JXG.JSXGraph.initBoard('jxgbox',{axis:true,boundingbox:[-1,2,2,-1]});
var A = brd.create('point', [1,0]);
var B = brd.create('point', [0,1]);
brd.on('update', function(){
A.moveTo([1, A.Y()]);
B.moveTo([B.X(), 1]);
});
```