numbas / Numbas

A completely browser-based e-assessment/e-learning system, with an emphasis on mathematics
http://www.numbas.org.uk
Apache License 2.0
202 stars 117 forks source link

jsxgraph's arrowheads don't end on the endpoints #796

Closed YannickNeyt closed 3 years ago

YannickNeyt commented 3 years ago

I made a function with the help of jsxgraph: (a and b are numbers like 5 and 12)

var div = Numbas.extensions.jsxgraph.makeBoard('400px','400px',{boundingBox:[-0.01,13.01,13.01,-0.01],grid:true,axis:false});
var board = div.board;
var p1 = board.create('point',[0,b], {fixed:true,visible: false,withLabel:false});
var p2 = board.create('point',[a,b], {fixed:true,visible: false,withLabel:false});
var p3 = board.create('point',[a,0], {fixed:true,visible: false,withLabel:false});
var poly = board.create('polygon',[p1,p2,p3], { borders:{strokeColor:'black'} });
var v0 = board.create('point', [1,0], {fixed:true,visible: false,withLabel:false});
var v1 = board.create('point', [1,1], {fixed:true,visible: false,withLabel:false});
var h0 = board.create('point', [0,1], {fixed:true,visible: false,withLabel:false});
var h1 = board.create('point', [1,1], {fixed:true,visible: false,withLabel:false});      
var seg1 = board.create('segment', [v0,v1], {firstarrow:true,lastarrow:true,withLabel:true, name:'$x$',label:{position:'top',offset:[8,0]}});
var seg2 = board.create('segment', [h0,h1], {firstarrow:true,lastarrow:true,withLabel:true, name:'$x$',label:{position:'top',offset:[-4,12]}});
return div;

But the arrows have unexpected behaviour: image

I saw that this problem already has been addressed in the past: https://github.com/jsxgraph/jsxgraph/issues/322, but I guess it's not fully fixed?

christianp commented 3 years ago

I've updated our JSXGraph to v1.2.1 and it seems to be fixed again.