I have a various objects on the stage which have handles placed around the bounds of each object. I want to resize the object by pressing and dragging on a handle like you would when resizing in Photoshop. I envision this by pressing on a handle, reset the mouseX, mouseY coordinates to 0,0 and when dragging the handle the Mouse x,y value increases or decreases. I was wanting to use that value and add it to the objects width or height. For example: Mouse moves 2px and the value output is 2px and so on.
Object.height += //mouseY equation starting from 0 when pressed
2
Answers
Thanks, that worked with a bit of tweaking.
you can store the
MouseX
andMouseY
in variables when the mouse button is down and the cursor is on the handler then subtract them from the new correspondingMouseX
andMouseY
when the mouse button is up.Now you can add these values to your height and width of your objects.