0

I am working on Polygon Dragging , also Resizing of Polygon. I can draw rectangle using org.eclipse.draw2d.RectangleFigure and I am able to Drag it, I added MouseMotionListener and MouseListener to org.eclipse.draw2d.RectangleFigure.

but

while trying same thing for Polygon. it does not work. mouseDragged event gets called when i try to drag the polygon, but it does not move.

Sumant
  • 496
  • 1
  • 6
  • 20

1 Answers1

0

If you use a org.eclipse.draw2d.PolygonShape instead of a org.eclipse.draw2d.Polygon it should work as you expect it to.

Frettman
  • 2,251
  • 1
  • 13
  • 9
  • Yes, it works. but polygon is not complete. here is the code for setting the points. although i am adding 4 points. it draws just 3 lines. 4th line is missing in the polygon. poly.setStart(new Point(609, 163)); poly.addPoint(new Point(562, 249));poly.addPoint(new Point(684, 244));poly.addPoint(new Point(696, 144)); – Sumant Jan 24 '12 at 11:28
  • It sounds like you're using a `PolylineShape` which behaves differently from the `PolygonShape` in that respect. Either use a `PolygonShape` or add your start point also as end point in your `PolylineShape`. – Frettman Jan 24 '12 at 13:56
  • Thanks. that is fixed. Next Thing I am failing to do is, If I use PolygonShape, I have to give the bounds too. for Polygon no need to setBounds. But Polygon can not be moved or resized. PolygonShape can be moved or resized. – Sumant Jan 25 '12 at 11:15