Open
Description
Not sure why or how, but when i use this plugin, i get a null pointer exception when accessing 'origin' on first paint of the animation. By using the ?. operator, it works. The codebase i use is complex and i haven't had a chance to create a simple usecase and i don't quite understand the underlying logic much either.
But this bandaid works it seems 😄
function orient(point, origin) {
var x0 = origin?.x;
var y0 = origin?.y;
if (x0 === null) {
return {x: 0, y: -1};
}
if (y0 === null) {
return {x: 1, y: 0};
}
var dx = point.x - x0;
var dy = point.y - y0;
var ln = Math.sqrt(dx * dx + dy * dy);
return {
x: ln ? dx / ln : 0,
y: ln ? dy / ln : -1
};
}
Metadata
Metadata
Assignees
Labels
No labels