Bug 411059

Summary: Polygon tool makes one extra point at the end of the path
Product: [Applications] krita Reporter: tusooa <tusooa>
Component: Tools/VectorAssignee: tusooa <tusooa>
Status: RESOLVED FIXED    
Severity: normal CC: ghevan, halla
Priority: NOR    
Version: 4.2.5   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description tusooa 2019-08-19 12:36:07 UTC
SUMMARY
The beginning and ending point of a polygon is not the same point, but two points that overlaps each other. If you intend to make a (n)-sided polygon by clicking (n+1) times (last time at the beginning point), it results in a (n+1)-sided polygon.

STEPS TO REPRODUCE
1. Create a document and add a vector layer.
2. Use polygon tool to make a triangle, by clicking three points on the canvas, and then clicking the starting point.
3. Switch to path tool.
4. Move the starting point.

OBSERVED RESULT
The triangle becomes a quadrilateral -- there are four points and four sides.

EXPECTED RESULT
It should still be a triangle.


SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma:
(available in About System)
KDE Plasma Version: 5.16.4
KDE Frameworks Version: 5.60.0
Qt Version: 5.12.2

ADDITIONAL INFORMATION
Comment 1 vanyossi 2019-08-27 01:25:02 UTC
I can confirm this bug, the last point is not merged to the starting point.
Comment 2 Halla Rempt 2019-08-27 12:17:06 UTC
Let's set bugs to ASSIGNED if someone assigns them :-)
Comment 3 tusooa 2019-11-14 16:01:31 UTC
Git commit 4356f2a707ca30633abe39898c568599d15b1718 by Tusooa Zhu.
Committed on 14/11/2019 at 16:00.
Pushed by tusooaw into branch 'master'.

Fix bug in polygon tool that adds an extra point

We remove the end point if it overlaps with the start point
when create the path shape.

M  +8    -3    plugins/tools/tool_polygon/kis_tool_polygon.cc

https://invent.kde.org/kde/krita/commit/4356f2a707ca30633abe39898c568599d15b1718
Comment 4 Halla Rempt 2019-11-15 10:36:13 UTC
Git commit b25b62428036e2e107fd7a8a0d79c9859c177841 by Boudewijn Rempt, on behalf of Tusooa Zhu.
Committed on 15/11/2019 at 10:10.
Pushed by rempt into branch 'krita/4.2'.

Fix bug in polygon tool that adds an extra point

We remove the end point if it overlaps with the start point
when create the path shape.
(cherry picked from commit 4356f2a707ca30633abe39898c568599d15b1718)

M  +8    -3    plugins/tools/tool_polygon/kis_tool_polygon.cc

https://invent.kde.org/kde/krita/commit/b25b62428036e2e107fd7a8a0d79c9859c177841