Issue 89051 - inserting points in polygon not working correctly
Summary: inserting points in polygon not working correctly
Status: ACCEPTED
Alias: None
Product: Writer
Classification: Application
Component: editing (show other issues)
Version: OOo 2.4.0
Hardware: All Windows XP
: P3 Trivial (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-05-06 08:42 UTC by simonbr
Modified: 2017-05-20 11:17 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: Moderate


Attachments
Writer document illustrating the issue (9.71 KB, application/vnd.oasis.opendocument.text)
2008-05-06 08:43 UTC, simonbr
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description simonbr 2008-05-06 08:42:37 UTC
In Writer, if you want to add points to a polygon, you get a different shape
than expected. 

I think what is *supposed* to happen is that after the point is created, the
location of the point follows the mouse cursor until the mouse button is
released, so you can place the newly created point as desired. 

What happens instead is that the location of the existing, adjacent point is
modified.

See the attached document. 

In Draw this works correctly.
Comment 1 simonbr 2008-05-06 08:43:51 UTC
Created attachment 53403 [details]
Writer document illustrating the issue
Comment 2 michael.ruess 2008-05-06 10:36:46 UTC
MRU->OD: if you try to add a point to  a polygon in Writer, not the new points
position can be determined correctly, the position of the next point will be
modified. in Draw this works as expected.
Comment 3 Pedro Giffuni 2013-02-02 14:18:12 UTC
As described by Ivan Timofeev
http://lists.freedesktop.org/archives/libreoffice/2011-November/020038.html

___

When inserting a point there is a call to
SdrDragView::ImpBegInsObjPoint (svx/source/svdraw/svddrgv.cxx).

Inside it:

- we remember the number of new point in a polypolygon:
mnInsPointNum = pMarkedPath->NbcInsPoint*;

- we call AdjustMarkHdl that calls SetMarkHandles. Inside
SetMarkHandles we add all handles - including custom ones (anchors in
Writer) and then sort handles. So, mnInsPointNum (see previous step)
becomes invalid (in Writer).

- we use [invalid] mnInsPointNum to get handle by its index *in
SdrHdlList* (var aHdl) using remembered index *in polygon*:
BegDragObj(rPnt, pOut, aHdl.GetHdl(mnInsPointNum), 0);

So, we can use mnInsPointNum only if custom (and other) handles had
placed *after* point handles in SdrHdlList.
___

Possible solution:

Rearrange the following lines of the SetMarkHandles method
(svx/source/svdraw/svdmrkv.cxx#873):

        // add custom handles (used by other apps, e.g. AnchorPos)
        AddCustomHdl();
        // sort handles
        aHdl.Sort();

to:

        // sort handles
        aHdl.Sort();
        // add custom handles (used by other apps, e.g. AnchorPos)
        AddCustomHdl();
Comment 4 SVN Robot 2013-02-08 16:40:46 UTC
"pfg" committed SVN revision 1444118 into trunk:
i89051 - inserting points in polygon not working correctly.
Comment 5 Pedro Giffuni 2013-02-08 16:44:03 UTC
(In reply to comment #4)
> "pfg" committed SVN revision 1444118 into trunk:
> i89051 - inserting points in polygon not working correctly.

I committed the workaround but the proper fix, according to
the quoted posting should probably be:

- Tweak sorting of handles somehow: look at method Compare
(svx/source/svdraw/svdhdl.cxx)
Comment 6 Marcus 2017-05-20 11:17:44 UTC
Reset assigne to the default "issues@openoffice.apache.org".