Dynamic quadratic curves and point transformations #10183
Unanswered
SupremeDeity
asked this question in
Q&A
Replies: 2 comments 14 replies
-
Ok so i had the demo url wrong and it was protected so others wouldn't be able to see but i have fixed that. this.controls.bendControls = new fabric.Control({
cursorStyle: "pointer",
x: (this.midpoint[0]), y: this.midpoint[1],
actionHandler: (eventData) => {
const pointer = this.canvas.getScenePoint(eventData);
const centerPoint = this.getCenterPoint();
const deltaX = pointer.x - centerPoint.x;
const deltaY = pointer.y - centerPoint.y;
this.midpoint = [deltaX, deltaY];
// console.log(displacement)
this.update();
this.canvas.requestRenderAll();
this.canvas.fire("object:modified");
},
}); However this doesn't seem to work very well. My original approach in the link i provided in the message does work but i wanted to see if a much easier approach was available. Other than that there's a bit of issues of how i cant rely on left and top because changing position messes with it. |
Beta Was this translation helpful? Give feedback.
13 replies
-
No worries, i have been busy too anyways thanks for your help, I'll look
more into it a bit later and get back to you
…On Wed, Oct 16, 2024, 12:45 PM Andrea Bogazzi ***@***.***> wrote:
Sorry i have been on paternity leave quite busy here.
There is this tool to add control points to curves in fabricJS:
#9998 <#9998>
I wanted to add a guide but i have no time.
Check this sample was added as a quick test
https://github.com/fabricjs/fabric.js/pull/9998/files#diff-70f24eb979856f3b260b75b17ccd49fa9cbc218efdedaf22d8d934cdb9854ddf
and use your quadratic curve there, check if is what you need.
—
Reply to this email directly, view it on GitHub
<#10183 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AG7G3TSUO44KQ5ZHWQHJMO3Z3YKTDAVCNFSM6AAAAABO4XX6YOVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTAOJVGYZTENA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello!
I am trying to create a curve similar to: Fabric Quadratic Curve demo however there are several differences. Mainly that my line can be moved like an object and i need to pass it through roughjs. I have created a control point in the middle for now. The questions i have are:
Point
class:Here is the current demo (use the line shape): My Curved Line demo
Here is the code: Custom quadratic line code
What i want to achieve is similar to excallidraw:
2024-09-26.16-01-05.mp4
Beta Was this translation helpful? Give feedback.
All reactions