Re: Canvas drawn objects mouse events

2012-11-29 Thread Alfredo Quiroga-Villamil
We are just a couple of weeks from having GA by the way and some of the
things we are adding are just amazing. Take a look for instance at this
transform.

http://www.emitrom-lienzo.appspot.com/#ExplorerPlaceImpl:transform_3_points

For the user of our API ... one line of code for that complicated
transform.  Behind the scenes ... a lot of stuff going on.

- All shapes are grouped.
- All shapes are draggable.

The level of sophistication you'll find it's simply amazing and we are just
finishing off 1.0 GA. The package is very light and has no dependencies.


On Thu, Nov 29, 2012 at 5:13 PM, Alfredo Quiroga-Villamil  wrote:

> I don't want to discourage you from trying your own implementation but you
> might want to take a look at Lienzo and see if it works for what you need.
> It's 100% built on GWT and lighting fast. It should do all the things you
> will need and likely more. It's released under Apache.
>
> Explorer:
>
> http://www.emitrom-lienzo.appspot.com/
>
> Download:
>
> http://www.emitrom.com/lienzo/download
>
> Best regards,
>
> Alfredo
>
>
> On Thu, Nov 29, 2012 at 1:29 PM, Matt Fair  wrote:
>
>> I have the following code:
>>
>> public void draw(Context2d context) {
>>
>> context.beginPath();
>> context.rect(x, y, width, height);
>> context.fill();
>> context.closePath();
>> context.stroke();
>>
>> }
>>
>> I would like to add a mouse event for when the mouse moves over the
>> rectangle.  What's the best way to do this?  I was able to do it if I in
>> the mouse move event for the canvas and with an if statement I checked to
>> see if the mouse moved within the coordinates of the rectangle.
>>
>> canvas.addMouseMoveHandler(new MouseMoveHandler() {
>>
>>   public void onMouseMove(MouseMoveEvent event) {
>>
>> mouseX = event.getRelativeX(canvas.getElement());
>> mouseY = event.getRelativeY(canvas.getElement());
>>
>> if(insideRectangle(mouseX, mouseY)) {
>>
>> // fire mouse event for rectangle
>>
>> }
>>
>>   }
>>
>> });
>>
>> However, I am worry about working with a bunch of objects and speed doing
>> it this way.  Is there a way to add a mouseMoveHandler directly to the
>> rectangle?
>>
>> Thanks,
>>
>> Matt
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Google Web Toolkit" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/google-web-toolkit/-/ZcJTa9KelVEJ.
>> To post to this group, send email to google-web-toolkit@googlegroups.com.
>> To unsubscribe from this group, send email to
>> google-web-toolkit+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/google-web-toolkit?hl=en.
>>
>
>
>
> --
> Alfredo Quiroga-Villamil
>
> AOL/Yahoo/Gmail/MSN IM:  lawwton
>
>
>


-- 
Alfredo Quiroga-Villamil

AOL/Yahoo/Gmail/MSN IM:  lawwton

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Canvas drawn objects mouse events

2012-11-29 Thread Alfredo Quiroga-Villamil
I don't want to discourage you from trying your own implementation but you
might want to take a look at Lienzo and see if it works for what you need.
It's 100% built on GWT and lighting fast. It should do all the things you
will need and likely more. It's released under Apache.

Explorer:

http://www.emitrom-lienzo.appspot.com/

Download:

http://www.emitrom.com/lienzo/download

Best regards,

Alfredo


On Thu, Nov 29, 2012 at 1:29 PM, Matt Fair  wrote:

> I have the following code:
>
> public void draw(Context2d context) {
>
> context.beginPath();
> context.rect(x, y, width, height);
> context.fill();
> context.closePath();
> context.stroke();
>
> }
>
> I would like to add a mouse event for when the mouse moves over the
> rectangle.  What's the best way to do this?  I was able to do it if I in
> the mouse move event for the canvas and with an if statement I checked to
> see if the mouse moved within the coordinates of the rectangle.
>
> canvas.addMouseMoveHandler(new MouseMoveHandler() {
>
>   public void onMouseMove(MouseMoveEvent event) {
>
> mouseX = event.getRelativeX(canvas.getElement());
> mouseY = event.getRelativeY(canvas.getElement());
>
> if(insideRectangle(mouseX, mouseY)) {
>
> // fire mouse event for rectangle
>
> }
>
>   }
>
> });
>
> However, I am worry about working with a bunch of objects and speed doing
> it this way.  Is there a way to add a mouseMoveHandler directly to the
> rectangle?
>
> Thanks,
>
> Matt
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-web-toolkit/-/ZcJTa9KelVEJ.
> To post to this group, send email to google-web-toolkit@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-toolkit+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>



-- 
Alfredo Quiroga-Villamil

AOL/Yahoo/Gmail/MSN IM:  lawwton

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Canvas drawn objects mouse events

2012-11-29 Thread Matt Fair
 

I have the following code:

public void draw(Context2d context) {

context.beginPath();
context.rect(x, y, width, height);
context.fill();
context.closePath();
context.stroke();

}

I would like to add a mouse event for when the mouse moves over the 
rectangle.  What's the best way to do this?  I was able to do it if I in 
the mouse move event for the canvas and with an if statement I checked to 
see if the mouse moved within the coordinates of the rectangle.  

canvas.addMouseMoveHandler(new MouseMoveHandler() {

  public void onMouseMove(MouseMoveEvent event) {

mouseX = event.getRelativeX(canvas.getElement());
mouseY = event.getRelativeY(canvas.getElement());

if(insideRectangle(mouseX, mouseY)) {

// fire mouse event for rectangle

}

  }

});

However, I am worry about working with a bunch of objects and speed doing 
it this way.  Is there a way to add a mouseMoveHandler directly to the 
rectangle?

Thanks,

Matt

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/ZcJTa9KelVEJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.