Can't pick the mousecolor with brush tool while mousedown

Björnke von Gierke bvg at mac.com
Wed Jul 6 09:22:49 EDT 2011


the described behaviour is maybe not ideal, but it's how things are supposed to work, so it's a lack of features, not a  bug.

If you want full control over the mouse, you probably will need to fake the drawing tool by using the drag command within a repeat loop. However, then you also need to accommodate for the problem that you are drawing in the opposite color, and somehow disalow the brush from becoming a zebra stripes creation tool. See this example for what I mean (drag slowly for problem):

on mouseDown --works only with pointer tool
   put the mouseLoc into theCurrent
   repeat while the mouse is down
      --wait with messages --uncomment if slow, allowing messages can help
      --add check to disallow zebra stripes here
      if the mousecolor is "255,255,255" then
         set the brushcolor to black
      else
         set the brushcolor to white
      end if

      choose brush tool
      drag from theCurrent to the mouseLoc
      put the mouseLoc into theCurrent
      choose browse tool
   end repeat
   pass mouseDown
end mouseDown


On 6 Jul 2011, at 11:01, Tiemo Hollmann TB wrote:

> Hello,
> 
> I want to draw a line on an image with the brush tool. Depending on the
> mousecolor I have to change the brushcolor to get a good contrast. Lets make
> it easy with black and white. On the black parts of the image I want to draw
> a white line and on the white parts of the image I want to draw a black
> line. The thing is, that it must be a nonstop line, which changes
> automatically it's color, depending on the background color of the image. So
> no mousedowns or ups to pick a new mousecolor.
> 
> 
> 
> on mouseEnter
> 
>   choose brush tool
> 
> end mouseEnter
> 
> 
> 
> on mouseMove -- same with mouseStillDown
> 
>      if the mousecolor is "255,255,255" then
> 
>         set the brushcolor to black
> 
>      else
> 
>         set the brushcolor to white
> 
>      end if
> 
> end mouseMove
> 
> 
> 
> The problem is, that I get the mousecolor with the pointer tool (mouseUp and
> mouseDown), but with the brush tool I get the mousecolor only while mouseUp.
> So the color doesn't changes while drawing, only when I pick a new mouseup.
> 
> 
> 
> Has anybody experienced the same behavior and has found a workaround? Or any
> idea what to try? Is it a bug, or am I missing something?
> 
> Thanks
> 
> Tiemo
> 
> 
> 
> 
> 
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list