Point Text position is Automatically Changing

37 views
Skip to first unread message

MUKUND THAKARE

unread,
Mar 10, 2021, 12:54:26 AM3/10/21
to Paper.js
Hello Group !!

I have observed some weird behavior of the point text' s position property.
Please consider the following code - 

const fontSize = 100;
const point = view.center;

const text = new PointText(point);
console.log("Initially",text.position);
text.content = "Say Something";
console.log("After Content",text.position);
text.fontSize = fontSize;
console.log("After fontSize",text.position);
text.leading = fontSize;
console.log("After leading",text.position);
text.justification = 'center';
console.log("After Justification",text.position);

let circle2 = new Path.Circle(text.position,8);
circle2.fillColor = new Color("yellow");

let circle1 = new Path.Circle(point,8);
circle1.fillColor = new Color("red");

I have added multiple console log to check how poinText's position is being changed during the assignment of properties.

Here are some snap of the results - 

positioningmeasures.PNG

Result snap were Red circle is "Initial" position and yellow circle is "final" position .

pointTextimage.PNG


Is this change in position expected ?
Is this a bug in paper.js ?


Thanks !!
Reply all
Reply to author
Forward
0 new messages