Extend the Paint example ( with code sample )

31 views
Skip to first unread message

Greg

unread,
May 18, 2013, 12:14:48 AM5/18/13
to caa...@googlegroups.com
Hi,

I am doing a drawing application so I followed the Painting demo as a starting point (http://hyperandroid.github.io/CAAT/documentation/demos/demo28/paint.html).

The first thing I tried was to add a background to my canvas in order to draw on top of it. Here is the code:
The problem with this code is that the drawing happens behing the background image.

My second attempt was to set the background image of my paintActor to an ActorContainer instead of canvas. With this solution I am able to paint on the background image BUT all my other actors (like buttons) loose their mouse events. Again here is another code example:
ps: there is also a CAAT error in the console, I have not been able to understand why...


I have not been able to find a solution to my problem, does anybody knows how I can keep my actors to listen to mouse events?

Thanks,
Gregory

Greg

unread,
May 18, 2013, 3:25:40 PM5/18/13
to caa...@googlegroups.com
I came up with a third solution which is still not optimal. In this solution I draw a circle on mouseMove, it works well if you move your mouse slowly, however you you go fast it will not draw a straight line...

Here is an example: http://codepen.io/gregorym/pen/btorL

Greg

Greg

unread,
May 22, 2013, 9:13:44 PM5/22/13
to caa...@googlegroups.com
I solved my problem by using a Path.
Reply all
Reply to author
Forward
0 new messages