Those basic commands make sense, but I have a problem when I am developing and I pass over the image it puts me into browse rather than pointer mode. Also, selecting & unselecting the image triggers the script. The commands on mouseLeave and on mouseEnter also seem to be dependent on whether there is content drawn at the point where the mouse is located, e.g. MouseEnter and mouseLeave messages are sent as I go over parts in the drawing with the browse tool.
I also want to automatically go back to the previously selected tool when the users return to the drawing image, so they do not need to reselect the tool. So this almost works:
Code: Select all
on mouseLeave # mouseLeave is sent when the mouse leaves the area where the image is
global CurrentToolUse
put word one of the tool into CurrentToolUse
choose browse tool
end mouseLeave
on mouseEnter
global CurrentToolUse
choose CurrentToolUse Tool
end mouseEnter
But the brush tool doesn't return until the cursor passes over a part of the actual drawing, not when it enters the image bounds.
I can then change the selection tool command to:
Code: Select all
global CurrentToolUse
put "pencil" into CurrentToolUse
But, it still doesn't change until it crosses a piece of the drawing content. It seems like once you draw inside an image, only the actual drawing part can be used to select the image. Is there a way around that?
-----------------
I just tried filling the image with a very light gray ( "#FEFEFE") and then using a brush of that color as an eraser tool. That seems to work fine. The tools change as soon as they enter the image. It still looks OK.
---------------------
I had been using this sort of command for selection buttons:
Code: Select all
on mouseUp
set the uCurrentDrawingTool of group 1 to "pencil"
end mouseUp
And this in the Group: (there are reasons it is more complicated, for example, I need to track and record the time in each tool)
Code: Select all
global gNextCheckMouseWithinMsgID
on checkMouseWithin
if (the mouseLoc is within the rect of me and the uCurrentDrawingTool of me is not "") then
choose (the uCurrentDrawingTool of me) tool
else
choose browse tool
end if
send "checkMouseWithin" to me in 100 millisecs
put the result into gNextCheckMouseWithinMsgID
end checkMouseWithin
I also have a script that makes a png file of the user's drawing image every 5 seconds and I get an occasional crash that I think relates to its working on such things in the background. Also, seems to happen when the user is making a rapid drawing stroke and continues moving beyond the drawing image rectangle edges.
I was just wondering if there were a different technique that I might consider.