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

Help with DragResize* handlers on DrawLine

$
0
0
Hi there,

For
- smartGWT 5.1d - SNAPSHOT_v10.0d_2014-07-18/LGPL Development Only (built 2014-07-18)
- FF 32.0.2

Could you tell me how/when/where the DragResize* events are triggered for a DrawLine?

I have the following class:
Code:

import com.smartgwt.client.types.KnobType;
import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.drawing.DrawLine;
import com.smartgwt.client.widgets.drawing.DrawPane;
import com.smartgwt.client.widgets.drawing.Point;
import com.smartgwt.client.widgets.drawing.events.DragResizeMoveEvent;
import com.smartgwt.client.widgets.drawing.events.DragResizeMoveHandler;
import com.smartgwt.client.widgets.drawing.events.DragResizeStartEvent;
import com.smartgwt.client.widgets.drawing.events.DragResizeStartHandler;
import com.smartgwt.client.widgets.drawing.events.DragResizeStopEvent;
import com.smartgwt.client.widgets.drawing.events.DragResizeStopHandler;

public class TestDrawLineMoveRotateProperties {
        public void drawDesign() {

                DrawPane shapesPane = new DrawPane();
                shapesPane.setTop(50);
                shapesPane.setLeft(50);
                shapesPane.setWidth(500);
                shapesPane.setHeight(480);
                shapesPane.setOverflow(Overflow.HIDDEN);
                shapesPane.setCanDrag(true);
                shapesPane.setBorder("1px solid red");

                final DrawLine testLine = new DrawLine();
                testLine.setStartPoint(new Point(100,70));
                testLine.setEndPoint(new Point(200,70));
                testLine.setDrawPane(shapesPane);
                testLine.setCanDrag(true);
                testLine.draw();

                //    testLine.showKnobs(KnobType.RESIZE);

                testLine.showKnobs(KnobType.STARTPOINT);
                testLine.showKnobs(KnobType.ENDPOINT);
               
                testLine.addDragResizeMoveHandler(new DragResizeMoveHandler() {
                        @Override
                        public void onDragResizeMove(DragResizeMoveEvent event) {
                                SC.logInfo("\tResized by knobs");
                        }
                });
               
                testLine.addDragResizeStartHandler(new DragResizeStartHandler() {
                        @Override
                        public void onDragResizeStart(DragResizeStartEvent event) {
                                SC.logInfo("Start resizing by knobs");
                        }
                });
               
                testLine.addDragResizeStopHandler(new DragResizeStopHandler() {
                        @Override
                        public void onDragResizeStop(DragResizeStopEvent event) {
                                SC.logInfo("End resizing by knobs");
                        }
                });
                shapesPane.draw();
        }
}

None of the events trigger when I use them Knobs.

In the documentation for DragResize events it is noted that
Code:

If canDrag is true and the control knobs include "resize" knobs then this notification method will be fired
but for DrawLine if I try using KnobType.RESIZE I get the following in the console:
Code:

DrawLine:isc_DrawLine_0:DrawItem specfied with knobType:resize but no showResizeKnobs function exists to show the knobs. Ignoring
and the knobs aren't shown (as expected).

Is there something I'm doing wrong?
I have to mention that for other kind of shapes (rectangle/oval/triangle/etc) the above events are triggered, but unlike DrawLine, they support KnobType.RESIZE

Thanks!

Viewing all articles
Browse latest Browse all 4756

Trending Articles