|
1 | 1 | /*********************************************************************************** |
2 | | - BSD 3-Clause License |
| 2 | +BSD 3-Clause License |
3 | 3 |
|
4 | | - Copyright (c) 2018, https://github.com/alexzhornyak |
5 | | - All rights reserved. |
| 4 | +Copyright (c) 2018, https://github.com/alexzhornyak |
| 5 | +All rights reserved. |
6 | 6 |
|
7 | | - Redistribution and use in source and binary forms, with or without |
8 | | - modification, are permitted provided that the following conditions are met: |
| 7 | +Redistribution and use in source and binary forms, with or without |
| 8 | +modification, are permitted provided that the following conditions are met: |
9 | 9 |
|
10 | | - * Redistributions of source code must retain the above copyright notice, this |
11 | | - list of conditions and the following disclaimer. |
| 10 | + * Redistributions of source code must retain the above copyright notice, this |
| 11 | +list of conditions and the following disclaimer. |
12 | 12 |
|
13 | | - * Redistributions in binary form must reproduce the above copyright notice, |
14 | | - this list of conditions and the following disclaimer in the documentation |
15 | | - and/or other materials provided with the distribution. |
| 13 | + * Redistributions in binary form must reproduce the above copyright notice, |
| 14 | +this list of conditions and the following disclaimer in the documentation |
| 15 | +and/or other materials provided with the distribution. |
16 | 16 |
|
17 | | - * Neither the name of the copyright holder nor the names of its |
18 | | - contributors may be used to endorse or promote products derived from |
19 | | - this software without specific prior written permission. |
| 17 | + * Neither the name of the copyright holder nor the names of its |
| 18 | +contributors may be used to endorse or promote products derived from |
| 19 | +this software without specific prior written permission. |
20 | 20 |
|
21 | | - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
22 | | - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
23 | | - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
24 | | - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
25 | | - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
26 | | - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
27 | | - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
28 | | - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
29 | | - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
30 | | - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
31 | | -***************************************************************************************/ |
| 21 | +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 22 | +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 23 | +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 24 | +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
| 25 | +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 26 | +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| 27 | +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| 28 | +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| 29 | +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 30 | +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 31 | + ***************************************************************************************/ |
32 | 32 |
|
33 | 33 | #include <vcl.h> |
34 | 34 | #pragma hdrstop |
@@ -310,8 +310,7 @@ namespace Editorutils { |
310 | 310 |
|
311 | 311 | const bool bAreNotNested = RectInsideRect(AFromShape->Bounds(), AToShape->Bounds()) == false; |
312 | 312 |
|
313 | | - if ((AConnection->Style == csSides || AConnection->Style == csInvertedSides) && bAreBrothers && bAreDifferent && bAreNotNested) |
314 | | - { |
| 313 | + if ((AConnection->Style == csSides || AConnection->Style == csInvertedSides) && bAreBrothers && bAreDifferent) { |
315 | 314 |
|
316 | 315 | for (int k = 1; k < AConnection->Points->Count(); k++) { |
317 | 316 | TPoint AFixed1(AConnection->Points->Item[k - 1].X, AConnection->Points->Item[k - 1].Y); |
@@ -408,27 +407,31 @@ namespace Editorutils { |
408 | 407 |
|
409 | 408 | /* ÀÍÀËÈÇÈÐÓÅÌ ÏÎËÓ×ÅÍÍÛÅ ÏÅÐÅÑÅ×ÅÍÈß */ |
410 | 409 |
|
411 | | - if (IsTypes.Contains(isFromPrev)) { |
412 | | - switch(AConnection->Style) { |
413 | | - case csSides: |
414 | | - AConnection->Points->Move(k - 1, 0, -ClipArray[isFromPrev].y1clip + ClipArray[isFromPrev].y0clip); |
415 | | - break; |
416 | | - case csInvertedSides: |
417 | | - AConnection->Points->Move(k - 1, ClipArray[isFromPrev].x1clip - ClipArray[isFromPrev].x0clip, 0); |
418 | | - break; |
419 | | - } |
| 410 | + // fix: https://github.com/alexzhornyak/ScxmlEditor-Tutorial/issues/107 |
| 411 | + if (bAreNotNested || k - 1 != 0) { |
| 412 | + if (IsTypes.Contains(isFromPrev)) { |
| 413 | + switch(AConnection->Style) { |
| 414 | + case csSides: |
| 415 | + AConnection->Points->Move(k - 1, 0, -ClipArray[isFromPrev].y1clip + ClipArray[isFromPrev].y0clip); |
| 416 | + break; |
| 417 | + case csInvertedSides: |
| 418 | + AConnection->Points->Move(k - 1, ClipArray[isFromPrev].x1clip - ClipArray[isFromPrev].x0clip, 0); |
| 419 | + break; |
| 420 | + } |
420 | 421 |
|
421 | | - } |
422 | | - if (IsTypes.Contains(isFromCur)) { |
423 | | - switch(AConnection->Style) { |
424 | | - case csSides: |
425 | | - AConnection->Points->Move(k - 1, ClipArray[isFromCur].x1clip - ClipArray[isFromCur].x0clip, 0); |
426 | | - break; |
427 | | - case csInvertedSides: |
428 | | - AConnection->Points->Move(k - 1, 0, -ClipArray[isFromCur].y1clip + ClipArray[isFromCur].y0clip); |
429 | | - break; |
| 422 | + } |
| 423 | + if (IsTypes.Contains(isFromCur)) { |
| 424 | + switch(AConnection->Style) { |
| 425 | + case csSides: |
| 426 | + AConnection->Points->Move(k - 1, ClipArray[isFromCur].x1clip - ClipArray[isFromCur].x0clip, 0); |
| 427 | + break; |
| 428 | + case csInvertedSides: |
| 429 | + AConnection->Points->Move(k - 1, 0, -ClipArray[isFromCur].y1clip + ClipArray[isFromCur].y0clip); |
| 430 | + break; |
| 431 | + } |
430 | 432 | } |
431 | 433 | } |
| 434 | + |
432 | 435 | if (IsTypes.Contains(isToPrev)) { |
433 | 436 | switch(AConnection->Style) { |
434 | 437 | case csSides: |
|
0 commit comments