I pinned the starting point of circle and prevented shape overflowing.
Additionally, I tried to prevent shape overflow while drawing circle by calculating cx, cy, r from formula but failed(Prevented overflow successfully on the Y axis, but not X-axis).
// many codes...
} else if (cy + r > naturalHeight) {
// radius = naturalHeight - cy
const a = 1, b = -2*((A**2+1)*this.anchor[1]-A**2*naturalHeight), c = (A**2+1)*this.anchor[1]**2-A**2*naturalHeight**2;
cy = getRoot(this.anchor[1], oppositeY, getRootCandidates(a, b, c));
console.log("case 4: ", getRootCandidates(a, b, c))
cx = (A===0) ? this.anchor[0] + naturalHeight - cy : (cy-B)/A;
r = naturalHeight - cy;
}
So, I just prevented number of cases with return.
RubberbandCircle.js - line:57
if ((cx-r < 0 || cx + r > naturalWidth) || (cy-r < 0 || cy + r > naturalHeight)) return;
I don't know whether it's normal behavior or not. So, if it is abnormal procedure, I'd appreciate it if you could let me know.
I pinned the starting point of circle and prevented shape overflowing.
Additionally, I tried to prevent shape overflow while drawing circle by calculating
cx
,cy
,r
from formula but failed(Prevented overflow successfully on the Y axis, but not X-axis).So, I just prevented number of cases with
return
.RubberbandCircle.js - line:57
I don't know whether it's normal behavior or not. So, if it is abnormal procedure, I'd appreciate it if you could let me know.