Tools & Drawing inside image
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 106
- Joined: Wed May 31, 2006 9:56 pm
- Contact:
Tools & Drawing inside image
Is there an example out there for this? I want to provide buttons for selecting the pencil, brush, or eraser tool. Then the user selects and draws inside the rectangle of an image. But I want the tool to switch to browse when the cursor exits the image so other options can be accessed, and back to the selected tool on re-entering the image. I have some examples working but would like to see if there are other approaches to this.
Tools & Drawing inside image
Hi Ron,
I think the best way is a toolPaint substack you open as palette
All the best
Jean-Marc
I think the best way is a toolPaint substack you open as palette
All the best
Jean-Marc
Hi
I think this is what you mean.
In the image script write:
In the buttons' script write:
grc
I think this is what you mean.
In the image script write:
Code: Select all
on mouseLeave # mouseLeave is sent when the mouse leaves the area where the image is
choose browse tool
end mouseLeave
Code: Select all
on mouseUp
choose paint tool # or whatever tool you want
end mouseUp
-
- VIP Livecode Opensource Backer
- Posts: 977
- Joined: Sat Apr 08, 2006 7:47 am
- Contact:
Make a separate stack, and add a series of buttons to it to switch the current tool, and then the user can draw in the actual drawing stack.
To switch to the rectangular selection tool, use the script To switch to he spray can, use the script See the choose command and tool global property entries in the Revolution dictionary for a full list.
HTH,
Jan Schenkel.
To switch to the rectangular selection tool, use the script
Code: Select all
on mouseUp
choose select tool
end mouseUp
Code: Select all
on mouseUp
choose spray can tool
end mouseUp
HTH,
Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com
www.quartam.com
-
- Posts: 106
- Joined: Wed May 31, 2006 9:56 pm
- Contact:
Browse/Pointer
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:
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:
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:
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)
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.
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
I can then change the selection tool command to:
Code: Select all
global CurrentToolUse
put "pencil" into CurrentToolUse
-----------------
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
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 was just wondering if there were a different technique that I might consider.
Code: Select all