javascript - JSXGraph drag entire circle from center point -
i'm new jsxgraph. trying construct circle using 2 points center point , b sits on circle itself. need b resize circle (no problem, this) when dragged move entire circle around without resizing it.
the examples give on link below have both , b resizing circle: http://jsxgraph.uni-bayreuth.de/wiki/index.php/circle
can point me in right direction?
thanks.
this indeed tricky question. solution use groups. pack 2 (free) points group this:
var board, a, b, circ, grp; board = jxg.jsxgraph.initboard('box6', {boundingbox:[-5,5,5,-5], keepaspectratio:true}); = board.create('point',[-1, -1], {size: 5, name: 'a', color: 'blue'}); b = board.create('point',[2, -1], {size: 5, name: 'b', color: 'red'}); circ = board.create('circle', [a, b]); grp = board.create('group', [a, b]); grp.removetranslationpoint(b);
in case, dragging 2 points results moves circle while keeping radius constant.
moreover, if want move circle dragging @ center allow resize circle dragging b, point b has removed list of translation points in group:
var board, a, b, circ, grp; board = jxg.jsxgraph.initboard('box6', {boundingbox:[-5,5,5,-5], keepaspectratio:true}); = board.create('point',[-1, -1], {size: 5, name: 'a', color: 'blue'}); b = board.create('point',[2, -1], {size: 5, name: 'b', color: 'red'}); circ = board.create('circle', [a, b]); grp = board.create('group', [a, b]); grp.removetranslationpoint(b);
Comments
Post a Comment