Coming out of Brush Mode by clicking another button
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Coming out of Brush Mode by clicking another button
Another issue I can't solve, I am in brush mode and I have another button that allows you to come out of brush mode and back into browse mode
choose browse tool
However, the button does not seem to work and stays in brush mode. Because this is for a touch device, I can't use a space bar or enter key to come back out.
choose browse tool
However, the button does not seem to work and stays in brush mode. Because this is for a touch device, I can't use a space bar or enter key to come back out.
Re: Coming out of Brush Mode by clicking another button
Hi again.
Same sort of thing, you have to monitor other LC processes to get out of these things. Put this in the card script:
Should work.
Craig Newman
Same sort of thing, you have to monitor other LC processes to get out of these things. Put this in the card script:
Code: Select all
on mouseMove
if the mouseLoc is within the rect of btn "yourButton" and the mouse is down then choose browse tool
end mouseMove
Craig Newman
Re: Coming out of Brush Mode by clicking another button
Does mouseMove (or touchMove) get sent if the user isn't dragging their finger across the screen? That is, is it sent if the user only taps? I can't remember. If so, then that would be handy in more cases than just this one.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Coming out of Brush Mode by clicking another button
No, if the finger is not on the screen, then there is no TOUCH that could be evaluated!Does mouseMove (or touchMove) get sent if the user isn't dragging their finger across the screen?
And since there is no MOUSE, "mousemove" will also no get sent!
I Just made a small test (on Mac) with a paint tool/brush:
1. "mousemove" will be sent UNLESS the mouse is DOWN = actually painting!
When mouse is DOWN, there is no mousemove message!
2. "mouseenter", "mouseup" etc. doe NOT work with a paint tool active!
I find this strange to say the least...
All this makes it a bit complicated to control painting on mobile, on the desktop
you can get away with an extra PALETTE window for switching tools.
Any idea how this should work on mobile?
Re: Coming out of Brush Mode by clicking another button
Hi Klaus,
make a card and an image "myImage" on the card
set the script of the card to
not tested on mobile
Kind regards
Bernd
Edit: improved code a bit
Actually it should work as on the desktop:Any idea how this should work on mobile?
make a card and an image "myImage" on the card
set the script of the card to
Code: Select all
local sLastLoc
on mouseDown
put the clickloc into sLastLoc
if not (sLastLoc is within the rect of image "myImage") then exit mouseDown
set the pencolor to any item of "red,blue,green,black"
set the linesize to 2
choose curve tool
send "doMove" to me in 10 millisec
end mouseDown
on doMove
if the mouse is up then
choose the browse tool
exit doMove
else
lock screen
put the mouseloc into tLoc
if sLastLoc is within the rect of image "myImage" And tLoc is within the rect of image "myImage" then
drag from sLastLoc to tLoc
put tLoc into sLastLoc
end if
unlock screen
send "doMove" to me in 1 millisec
end if
end doMove
Kind regards
Bernd
Edit: improved code a bit
Re: Coming out of Brush Mode by clicking another button
hi, klaus.Klaus wrote:No, if the finger is not on the screen, then there is no TOUCH that could be evaluated!Does mouseMove (or touchMove) get sent if the user isn't dragging their finger across the screen?
And since there is no MOUSE, "mousemove" will also no get sent!
I Just made a small test (on Mac) with a paint tool/brush:
1. "mousemove" will be sent UNLESS the mouse is DOWN = actually painting!
When mouse is DOWN, there is no mousemove message!
2. "mouseenter", "mouseup" etc. doe NOT work with a paint tool active!
I find this strange to say the least...
All this makes it a bit complicated to control painting on mobile, on the desktop
you can get away with an extra PALETTE window for switching tools.
Any idea how this should work on mobile?
i'm developing a multiplatform app (desktop/mobile) in which user has to use brush/bucket/eraser tool over an image.
and i'm now facing exactly the same issue you described.
i was pretty sure to have found a solution, using the mousemove event to get the "mouse" position (over the image to be painted or not), but, after deeper tests i have to admit my solution is buggy on mobile platform, 'cause of the fancy "mousemove" event.
so, i came here to seek for a solution from masters.
did you get yours, in the meanwhile?
Re: Coming out of Brush Mode by clicking another button
wait… i didn't read with attention last bernd 's post, which offers a nice solution, it seems.
so, probably, something like this could work with brush/eraser:
but for bucket? i'll do some more tests.
so, probably, something like this could work with brush/eraser:
Code: Select all
local sLastLoc
on mouseDown
put the clickloc into sLastLoc
if not (sLastLoc is within the rect of image "myImage") OR (the pTool of me is empty) then exit mouseDown //or whatever else, like "dragPictureOverTheScreen", for example
choose (the pTool of me)
send "doMove" to me in 10 millisec
end mouseDown
on doMove
if the mouse is up then
choose the browse tool
exit doMove
else
lock screen
put the mouseloc into tLoc
if sLastLoc is within the rect of image "myImage" And tLoc is within the rect of image "myImage" then
drag from sLastLoc to tLoc
put tLoc into sLastLoc
end if
unlock screen
send "doMove" to me in 1 millisec
end if
end doMove
//button doBrush script
on mouseUp
if the hilite of me then
set the pTool of this cd to empty
else
set the pTool of this cd to "brush tool"
end if
set the hilite of me to not(the hilite of me)
end mouseUp
Re: Coming out of Brush Mode by clicking another button
bernd, you're a genius.
following your tips, it works like a charm now. both on desktop and mobile.
for anyone interested i paste here an example of the working code.
following your tips, it works like a charm now. both on desktop and mobile.
for anyone interested i paste here an example of the working code.
Code: Select all
//card script
local sLastLoc
on mouseDown
put the clickloc into sLastLoc
if not (sLastLoc is within the rect of image "picture") OR (the pTool of me is empty) then exit mouseDown //or whatever else, like "dragPictureAroundTheScreen", for example
choose (the pTool of me)
send "doMove" to me in 10 millisec
end mouseDown
on doMove
if the mouse is up then
choose the browse tool
exit doMove
else
lock screen
put the mouseloc into tLoc
if sLastLoc is within the rect of image "picture" AND tLoc is within the rect of image "picture" then
drag from sLastLoc to tLoc
put tLoc into sLastLoc
end if
unlock screen
send "doMove" to me in 1 millisec
end if
end doMove
command resetHilite
unhilite btn "brush"
unhilite btn "eraser"
unhilite btn "bucket"
unhilite btn "marker"
if there is a group "brush_marker" then
lock screen
ungroup group "brush_marker"
set the selected of img "brush_img" to false
set the selected of img "marker_img" to false
unlock screen
end if
end resetHilite
/******************************/
//button doBrushTool script
on mouseDown
put the hilite of me into tActive
resetHilite
if tActive then
set the pTool of this cd to empty
else
set the brush to 2
set the brushColor to (random(255),random(255),random(255))
relayer img "marker_img" after img "picture" //marker_img is an empty img with blend = 50. brush "marker" paints here
relayer img "brush_img" after img "marker_img" //brush_img is an empty img. brush paints here
set the pTool of this cd to "brush tool"
end if
set the hilite of me to not(tActive)
end mouseDown
/******************************/
//button doMarkerTool script
on mouseDown
put the hilite of me into tActive
resetHilite
if tActive then
set the pTool of this cd to empty
else
set the brush to 2
set the brushColor to (random(255),random(255),random(255))
relayer img "brush_img" after img "picture" //brush_img is an empty img. brush paints here
relayer img "marker_img" after img "brush_img" //marker_img is an empty img with blend = 50. brush "marker" paints here
set the pTool of this cd to "brush tool"
end if
set the hilite of me to not(tActive)
end mouseDown
/******************************/
//button doBucketTool script
on mouseDown
put the hilite of me into tActive
resetHilite
if tActive then
set the pTool of this cd to empty
else
set the brushColor to (random(255),random(255),random(255))
group img "brush_img" and img "marker_img"
set the name of last group to "brush_marker" //so that bucket paints directly on picture
relayer grp "brush_marker" after img "picture"
set the pTool of this cd to "bucket tool"
end if
set the hilite of me to not(tActive)
end mouseDown
/******************************/
//button doEraserTool script
on mouseDown
put the hilite of me into tActive
resetHilite
if tActive then
set the pTool of this cd to empty
else
set the eraser to 2
set the pTool of this cd to "eraser tool" //in this example it erases the front-most layer, i.e. the layer of the last tool used between brush and marker
end if
set the hilite of me to not(tActive)
end mouseDown
Re: Coming out of Brush Mode by clicking another button
Hi,
glad you got it working.
Kind regards
Bernd
glad you got it working.
I wouldn't go that far.... just ask people who know me a little better, or better yet don't ask thembernd, you're a genius
Kind regards
Bernd