Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

207
Views
Drag move fabric JS controls

Who can help me a little with JS Fabric move / drag function? I want the drag / move function triggered by de left top corner and I tried the code below:

//drag function
const dragOriginal = fabric.Object.prototype.controls.tl;
fabric.Object.prototype.controls.moveObject = new fabric.Control({
    x: -0.5,
    y: -0.5,
    actionHandler: dragOriginal,
    actionName: 'drag',
    cursorStyle:'pointer',
    render: renderIcon,
    cornerSize: 25
});

This gives me the following error in the console

actionHandler is not a function. (In 'actionHandler(e, transform, x, y)', 'actionHandler' is an instance of Object)

Who can help me with this?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I think this is the answer

fabric.Object.prototype.controls.moveObject = new fabric.Control({
    x: -0.5,
    y: -0.5,
    actionHandler: fabric.controlsUtils.dragHandler,//change to this
    actionName: 'drag',
    cursorStyle:'pointer',
    render: renderIcon,
    cornerSize: 25
});

I hope this is were you looking for.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!