Page 1 of 1

Drawing with Drag through Script

Posted: Wed Sep 05, 2012 11:48 pm
by monicaBUSGk9X
Hello!
I am attempting to automate drawing a line over an image but am unsure how to target the image I'm "dragging" over. Here is what I have thus far:

Code: Select all

on mouseUp
   choose pencil tool
   set the penColor to "red"
   set the lineSize to 10
 
   drag from 690,424 to 540,424
   drag from 540,424 to 540,435
   drag from 540,435 to 462,435
   drag from 462,435 to 462,248
   drag from 462,248 to 620,248
  
   choose browse tool
end mouseUp
My image is named "imgDragTarget".

**EDIT I have this script on a button

Thanks in advance!
Cheers,
Monica

Re: Drawing with Drag through Script

Posted: Thu Sep 06, 2012 12:09 am
by mwieder
Monica - that works for me - I get red lines drawn over an image. What's not working?

Re: Drawing with Drag through Script

Posted: Thu Sep 06, 2012 2:21 am
by dunbarx
Hi.

When you say "target" an image, are you thinking about the sort of procedure whereby one can move an object over a list of points in a graphic? (see the "move" command in the dictionary) In your post, you had an actual list of points that you, er, drew from.

Without such an explicit list of vertices, I don't think you can find anything to "follow". I would be fascinated to think that a routine could be written that would "read", say, the black pixels in a simple image (not a graphic), and move an object over some processed pathway derived from such a thing.

Craig Newman

Re: Drawing with Drag through Script

Posted: Thu Sep 13, 2012 11:40 pm
by monicaBUSGk9X
Hi Guys,
Thanks for writing! I'll clarify...
Am going to have an image that may need to be resized (to zoom in or zoom out of it) with a pinch and zoom.
Can I have the points and line drawn "scale" relative to the image?

Thanks again
Monica

Re: Drawing with Drag through Script

Posted: Fri Sep 14, 2012 6:23 am
by dunbarx
Hi.

You can certainly link the rect of a graphic to the rect of an image:

set the rect of yourGraphic to the rect of yourImage.

Or somesuch.

In this way the vertices will scale as well, and if you are using the "move" command to have an object trace a path, then you should be set.

Provided I understand your intentions at all.

Craig Newman