The following code inserts the text always at (0,0).
Code: Select all
var pos = event.getModelPosition();
var text = new RTextEntity(this.getDocument(),
new RTextData(
new RVector(pos.x,pos.y), // position
new RVector(pos.x,pos.y), // alignment point
2.0, // height
2.0, // text width (ignored for now)
RS.VAlignTop, // alignments
RS.HAlignCenter,
RS.LeftToRight,
RS.Exact,
1.0, // line spacing factor
"10 \u03bc F 100 \u03a9", // some random text for checking
"Arial", // font
false, // bold
false, // italic
0.0, // angle
false // simple text without formatting
)
);
op.addObject(text);