Expand and move a task in timeline script

Expand and move a task in timeline script

I have a project where I need to make a timeframe like the one from Tom's Planner (see here)

And since i can't find a plugin to do what i want, i made the decision to make my own plugin.

I made the timeline design based on this but now I need to make an option to expand the task and move it with drag and drop.

Basically to expand the task with +/- x days based on how much i drag the margin on the left/right or to move it up or down with drag and drop.

But i can't find a way to do this.

On what functions do i need to look and how can i know how much the user dragged the margin?

What is the best way to achieve this?

Thanks and sorry if i did something wrong but i'm new to this forum :)