For a pet project of mine, I needed to implement (in MATLAB code, of course!) a repositionable, resizable rectangle. I wanted to be able to drag the rectangle itself, but I also wanted to expose "handles" that would allow me to drag from the sides or from the corners, and to control, or constrain, the motion.
As a first step, I needed a general function that facilitated "draggability" of MATLAB objects. That's where "Draggable" comes in. Starting, as I usually do, with the File Exchange, I quickly found my way to Francois's file. I downloaded it, encouraged by several 5-star reviews (now including my own!), and was very pleased by how tractable the problem became.
"Draggable" is exceptionally well implemented, and despite having taken it for a significant test drive, I have been unable to find fault with it.
Francois mentioned in his comments that he plans to revisit his code at some point in the future to enable one to apply the functionality simultaneously to multiple handles. I agree that that would make a nice enhancement, though activating objects one-at-a-time wasn't extremely onerous. It would also be nice if there were a "diagonal" constraint--at least for my purposes. But in its current state, I'm very happy to select "Draggable" as this week's Pick of the Week--very nice work, Francois!
Incidentally, my "draggableRect" isn't on the File Exchange yet, but I hope to have it up soon!
Get the MATLAB code
Published with MATLAB® 7.14
To leave a comment, please click here to sign in to your MathWorks Account or create a new one.