简体   繁体   中英

JSXGraph - Move point along with label

Is it possible to move point while dragging its label ? In this fiddle while dragging the point, its label moves along.

    var board = JXG.JSXGraph.initBoard('jsxgbox', { axis: true});

    var p1 = board.create('point', [-3,-1], {name: "Drag Me",label:{fixed:false}});

For the time being, it is not possible to move a point by dragging it's label. An alternative approach is to create a point without label and a separate text element containing the label text. Then put both elements in a group:

var board = JXG.JSXGraph.initBoard('jsxgbox', {
    axis: true
});

var p1 = board.create('point', [-3,-1], {name: "", label:{visible:false}});
var t1 = board.create('text', [-2.8, -0.8, "Drag me"]);
var g1 = board.create('group', [p1, t1]);

See http://jsfiddle.net/c28bpzLq/4/ for an example.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM