I create DrawRect
DrawRect drawRect = new DrawRect();
drawRect.setDrawPane(pane);
drawRect.setLeft(x-25);
drawRect.setTop(y-25);
drawRect.setWidth(50);
drawRect.setHeight(50);
drawRect.setFillColor("#FF0000");
drawRect.setFillOpacity(0.2f);
drawRect.setCanDrag(true);
drawRect.setKnobs(KnobType.RESIZE);
drawRect.draw();
and knobs work good. But when I change zoom on DrawPane
zoomLevel = pane.getZoomLevel();
pane.zoom(zoomLevel+0.001f);
I can not use the knobs because they shift. It looks like this http://clip2net.com/s/4XXJmY
There seem to be an issue in SmartGWT, or certain fixes done in SmartClient are not moved to SmartGWT yet.
There was a previous issue that they fixed on mouse events, but still knobs are not working.
I couldn't use knobs after a zoom either, with smartgwt-4.0d/LGPL/2013-04-25 and GWT 2.4.0.
I've even tried drawRect.showKnobs(KnobType.RESIZE);
inside DrawHandler.onDraw()
which didn't change the behavior.
Both drawRect.getKnobs()
and drawRect.getResizeKnobPoints()
during zoom trigger (button click handler/etc.) had proper values (they didn't change before/after zoom).
During zoom trigger DrawPane.getDrawItems()
showed separate DrawItem
instances for knobs both before and after zoom.
Used following to see how mouse events were affected with zoom.
They seemed to work the same before/after zoom inside the highlighted area in given image.
final Label label = new Label();
label.setWidth100();
label.setHeight(20);
label.setContents("event details");
drawRect.addClickHandler(new com.smartgwt.client.widgets.drawing.events.ClickHandler() {
public void onClick(com.smartgwt.client.widgets.drawing.events.ClickEvent clickEvent) {
label.setContents("mouse click: " + clickEvent.toDebugString() + "; " + new Date().getTime());
}
});
drawRect.addMouseMoveHandler(new MouseMoveHandler() {
public void onMouseMove(MouseMoveEvent mouseMoveEvent) {
label.setContents("mouse move: " + mouseMoveEvent.toDebugString() + "; " + new Date().getTime());
}
});
Probably a good idea to post in SmartClient/SmartGWT forum.
Somewhat related - http://forums.smartclient.com/showthread.php?t=21345&highlight=DrawPane+zooming