Dump/Restore anchored text issue

23 views
Skip to first unread message

verne...@gmail.com

unread,
Apr 14, 2016, 6:19:32 PM4/14/16
to JSXGraph
Hi All,
I have a problem trying to restore the javascript dump of my board.
I have create a text that is anchored to a line to use it as a label.al works fine but when i dump the graphic i got this javascript code:


board.create("line", ["jxgBoard1P6", "jxgBoard1P7"], {"strokecolor":"#666","strokeopacity":1,"highlightstrokeopacity":1,"fillopacity":1,"highlightfillopacity":1,"strokewidth":1,"highlightstrokewidth":2,"fixed":false,"withlabel":false,"visible":true,"priv":false,"dash":0,"trace":false,"highlight":true,"scalable":true,"draft":false,"islabel":false,"lastarrow":true,"straightfirst":false,"straightlast":false,"point1":{"visible":false,"withLabel":false,"fixed":false,"name":""},"point2":{"visible":false,"withLabel":false,"fixed":false,"name":""},"ticks":{"drawLabels":true,"label":{"offset":[4,-9]},"drawZero":false,"insertTicks":false,"minTicksDistance":50,"minorHeight":4,"majorHeight":-1,"minorTicks":4,"defaultDistance":1,"strokeOpacity":0.3},"label":{"strokeColor":"black","strokeOpacity":1,"highlightStrokeOpacity":0.666666,"highlightStrokeColor":"black","fixed":true,"position":"llft","offset":[10,10]},"name":"axis-h","objectformat":{},"id":"jxgBoard1L8"});


board.create("text", ["jxgBoard1L8"], {"fillcolor":"red","highlightfillcolor":"none","strokeopacity":1,"fillopacity":1,"highlightfillopacity":1,"strokewidth":2,"highlightstrokewidth":2,"fixed":false,"priv":false,"dash":0,"trace":false,"highlight":true,"snaptogrid":false,"scalable":true,"draft":false,"islabel":true,"anchor":"jxgBoard1L8","cssclass":"label-text","highlightcssclass":"label-text","position":"llft","id":"jxgBoard1L8Label","name":"custom-label","isdraggable":true,"objectformat":{"_text":"hdfghdf ghdf ghdfghdfh"},"label":{"strokeColor":"black","strokeOpacity":1,"highlightStrokeOpacity":0.666666,"highlightStrokeColor":"black","fixed":true,"position":"urt","offset":[10,10]}});

When i tried to restore this code in a new empty graph i got this javascript error:

Uncaught Error: JSXGraph: Can't create text with parent types 'object' and 'undefined'.
Possible parent types: [x,y], [z,x,y], [element,transformation]

It is like i cannot create a text object with a line as parent. Is this a bug? I want to clarify that i need to assign a text object as label to a line, and not use the label that the line have by default.

Regards and Thanks for the help
Victor

Alfred Wassermann

unread,
Apr 15, 2016, 5:37:16 AM4/15/16
to JSXGraph, verne...@gmail.com
Dear Victor,
thank you very much for pointing this out. I'll try to fix it very soon.
Best wishes,
Alfred

Alfred Wassermann

unread,
May 2, 2016, 5:42:24 AM5/2/16
to JSXGraph, verne...@gmail.com
Sorry, I forgot to post it to the group. This has been fixed a while ago, the bugfix is contained in the nightly builds.

Best wishes,
Alfred

verne...@gmail.com

unread,
May 2, 2016, 10:15:36 AM5/2/16
to JSXGraph, verne...@gmail.com
Hi Alfred
Thanks So much for the fix, now i have another problem related to this,
The label is exported correctly now, but when i restore it to a blank graphic the text is always restored in the [0,0] position of the line, no matter if i have moved it before to a different position in the javascript exported also is not [0,0].
Do you think how i can position the anchored text i the position it was related to the line? Is it posible?

Alfred Wassermann

unread,
May 3, 2016, 9:14:50 AM5/3/16
to JSXGraph, verne...@gmail.com
Hi Victor,
with one of the nightly builds of the last few days the following example dumps correctly:

    var p1 = board1.create('point', [-3, 5]);
   
var p2 = board1.create('point', [3, -1]);
   
var li = board1.create('line', [p1, p2]);
   
var txt = board1.create('text', [0, 0, 'Hello'], {anchor: li});
   
var txt = board1.create('text', [4, 1, 'Text']);


Can you please check if this dumps correctly in your installation?

Best wishes,
Alfred

Reply all
Reply to author
Forward
0 new messages