Hello to all,

I am coding a graphic editor in Java, similar to the example provided with the library. When I move a cell by dragging it, the preview (I have mxGraphHandler.livePreview = false) shifts by a variable amount, which I suspect depends on the presence of child cells. Finally when i drop, the cell is moved to a location different from that of the preview, by the same shift. In other words, the positionning of the cell is correct, but not the preview.

I found that comment in mxGraph.getPreviewLocation() which seems to be related to my problem :

// LATER: Drag image _size_ depends on the initial position and may sometimes // not align with the grid when dragging. This is because the rounding of the width // and height at the initial position may be different than that at the current // position as the left and bottom side of the shape must align to the grid lines. // Only fix is a full repaint of the drag cells at each new mouse location.

but I dont understand the first word of it. How could the image size depend on the location ? How do I implement the fix ? If I set livePreview to true, it is even worse, the cells do not align to the grid any more. This does not happen in GraphEditor of course, and Drag and drop works fine for stencils in my app too.

Any help would be really appreciated!

asked 13 Aug '12, 09:03

ced31k's gravatar image

accept rate: 0%

Hello, I have notice the same problem and would be very interesting by fiew help too. Thanks,


answered 14 Nov '12, 05:12

RomA380's gravatar image

accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: 13 Aug '12, 09:03

Seen: 1,278 times

Last updated: 14 Nov '12, 05:12