|Re: SnapTo : How to find nearest snap to point [message #227888 is a reply to message #227685]
||Tue, 12 December 2006 18:49
Originally posted by: awm_abu.yahoo.com|
I also have another question.
I have been trying to fix the problem described below by having each place
holder rectangle increase in size so that even if the top right of the
rectangle I am moving does not touch any of my place holder rectangles then
it has to touch the extended ones as they fill all the available space.
Anyway I was debugging what I am trying to do and I found that the
SnapToHelper is not always called when I thought it would be.
More particularly if I move my rectangle by a very small amount then the
SnapToHelper isn't called at all.
Anyone know why this happens or more particularly how I can change the
precision to a smaller amount ?
"Alan" <email@example.com> wrote in message
> Hello all,
> I am having a snapto issue which I was hoping that someone here could help
> me with.
> The attached file should show the problem easier than any textual
> Basically I have drawn a grid like layout on the Freeform layer for a
> fixed layout diagram.
> Blocks are created on the diagram and will fit into one of the holders you
> I am using snapto so that the blocks can only be placed in the holders.
> However when trying to use the holder rectangle to help me with snapto I
> am having a problem.
> The code below is basically saying that if the top left hand corner of the
> block I am moving
> is in one of my holder rectangles then snap it so its fits in holder.
> The problem is that, as you can see from the image attached, that it is
> possible that the top left hand
> corner does not fit in any of my holder rectangles as the space between
> them is sufficient for this to happen.
> So what I need to do I guess is find the nearest one.
> I was thinking that I was probably not the first person to have this issue
> and was hoping someone could help me out ?
> Thanks a lot.
> for(int i =0; i < blockPositionRecs.length && !finished; i++)
> if(blockPositionRecs[i].contains(baseRect.x, baseRect.y))
> match = blockPositionRecs[i];
> finished = true;
> System.out.println("\n\nMatch found - " + match);
Powered by FUDForum
. Page generated in 0.02457 seconds