1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
<html>
<head>
<title>Board events</title>
<link rel="stylesheet" type="text/css" href="../distrib/jsxgraph.css" />
<script type="text/javascript" src="../distrib/jsxgraphcore.js"></script>
</head>
<body>
<div id="jxgbox" class="jxgbox" style="width:800px; height:800px; float:left"></div>
<button onclick="toggle();">Toggle</button>
<script type="text/javascript">
/* <![CDATA[ */
//JXG.Options.renderer = 'canvas';
var board = JXG.JSXGraph.initBoard('jxgbox', {boundingbox:[-1, 4, 4, -1], axis: true, grid: true, keepaspectratio: true, showcopyright: false, zoom: true, pan: true}),
out = document.getElementById('out');
var p = board.create('point', [1, 2], {opacity:0.3, visible:false});
var q = board.create('point', [3, 2.5], {opacity:0.3, visible:false});
var l = board.create('segment', [p, q], {color:'black', strokeWidth:2, strokeOpacity:1.0});
l.setProperty({firstarrow: true, lastarrow: true});
function toggle() {
/*
l.setProperty({firstarrow:false, lastarrow:true});
l.setProperty({firstarrow:true, lastarrow:true});
l.setProperty({firstarrow:false, lastarrow:true});
*/
l.setProperty({firstarrow:true, lastarrow:true});
}
/* ]]> */
</script>
</body>
</html>
|