Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

SmartGWT 4.1 - issue with rotated Draw Items inside DrawPane

$
0
0
Hi all,

I'm new to the forums as well as quite new to development, but here we go.

A short summary of my issue is that onClick (and not only) handler isn't working correctly on a shape if this has a rotation applied.
onClick handler fires when the mouse is over the initial representation of the shape (at 0 degrees rotation) and not on the new one involving rotation.

How to reproduce:
- SmartGWT version used is 4.1 LGPL edition (SNAPSHOT_v9.1d_2014-01-19/LGPL Development Only (built 2014-01-19))
- Browsers are FF 27.0.1 and IE10

- create a DrawPane
- create a DrawRect rectangle and add click handler
- rotate the rectangle by an angle (45)
- try to click on the shape on any of the corners after rotation = it won't work
- try to click on the same shape's "old" corners = it will work.


Code is pretty simple. Added the onClick handler on the rectangle with a popup message when it fires.
To make it even more clear I used different mouse cursors when over the shape and also the canDrag(true) so you can see that the shape can be moved on the screen by dragging the initial representation (when mouse is outside the shape).

Code:

import com.google.gwt.core.client.EntryPoint;
import com.smartgwt.client.types.Cursor;
import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.drawing.DrawPane;
import com.smartgwt.client.widgets.drawing.DrawRect;
import com.smartgwt.client.widgets.drawing.events.ClickEvent;
import com.smartgwt.client.widgets.drawing.events.ClickHandler;

public class HMIDesignerUI2 implements EntryPoint {

        /**
        * This is the entry point method.
        */
        public void onModuleLoad() {
                DrawPane drawingArea = new DrawPane();
                drawingArea.setWidth(1000);
                drawingArea.setHeight(600);
                drawingArea.setBackgroundColor("#CCCCCC");
                drawingArea.setCanDrag(true);
                drawingArea.setCursor(Cursor.AUTO);
                drawingArea.draw();
               
                DrawRect rectangle = new DrawRect();
                rectangle.setWidth(150);
                rectangle.setHeight(100);
                rectangle.setTop(50);
                rectangle.setLeft(50);
                rectangle.setCursor(Cursor.MOVE);
                rectangle.setLineWidth(3);
                rectangle.setFillColor("red");
                rectangle.setDrawPane(drawingArea);
                rectangle.rotateTo(45);
                rectangle.setCanDrag(true);
                rectangle.addClickHandler(new ClickHandler() {
                       
                        @Override
                        public void onClick(ClickEvent event) {
                                SC.say("Clicked the rectangle");
                        }
                });
                rectangle.draw();
        }
}

In conclusion, is this a bug or is it something I'm doing wrong here?

Thanks a lot for the input!

P.S.: I hope my "not so good" English isn't making this topic a mess :)



LE: sorry for this topic but it can be ignored. Downloaded the latest version and it seems it is working (don't know why it didn't cross my mind so far, such a simple solution to try). Sorry again!

Viewing all articles
Browse latest Browse all 4756

Trending Articles