jquery / jquery/jquery-ui

Feature addition: Include an element's size in the draggable interface

Open
#1,978 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Behavior shared with 1.12 Comp: Draggable Comp: Resizable Feature
Dominant language
JavaScript
Stars
11.3k
Forks
5.2k
PR merge metrics
No merged PRs in 30d

Description

Hi all,

First-time contributor so please forgive any errors or faux pas!

I have been working on a project these last few weeks that required a div that is draggable and resizable, and after trying to build it from scratch by myself for wayyyy longer than I should have done, it was still a mess. I decided at that point, more in hope than expectation, to see if jQuery had a way to make it easier and, well, here we are!

What I have been building is an image uploader that then crops the image to the user's wishes, which has meant having a canvas drawing the part of the picture that is covered by the overlaying <div> whenever it is moved or resized. One thing I noticed however is that whilst resizable's ui object returns the position and size, draggable's only returns the position, so the addition of the element's size is what I am looking to add in here. I have the code ready to go (at least according to my local testing) but thought better than just submitting a PR out of the blue. The branch is at https://github.com/gavinsykes/jquery-ui/tree/add-size-data-to-draggable-ui

Any questions, please ask! 😄

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the existing draggable and resizable interfaces, then inspect the contributor's branch at gavinsykes/jquery-ui/tree/add-size-data-to-draggable-ui. Compare the proposed draggable UI data with the resizable UI object and verify that the element's size is included without breaking existing behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, jquery
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.