Skip to content

Commit 25f3ee3

Browse files
committed
Fix small hex edges incorrectly getting counted as text.
1 parent db5a23c commit 25f3ee3

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

‎examples/small-grids.svg‎

Lines changed: 5 additions & 5 deletions
Loading

‎src/canvas.go‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,21 +1008,23 @@ func (c *Canvas) partOfHorizontalLine(i Index) bool {
10081008
func (c *Canvas) partOfDiagonalLine(i Index) bool {
10091009
r := c.runeAt(i)
10101010

1011-
nWest := c.runeAt(i.nWest())
1012-
sEast := c.runeAt(i.sEast())
1013-
nEast := c.runeAt(i.nEast())
1014-
sWest := c.runeAt(i.sWest())
1011+
n := c.runeAt(i.north())
1012+
s := c.runeAt(i.south())
1013+
nw := c.runeAt(i.nWest())
1014+
se := c.runeAt(i.sEast())
1015+
ne := c.runeAt(i.nEast())
1016+
sw := c.runeAt(i.sWest())
10151017

10161018
switch r {
10171019
// Diagonal segments can be connected to joint or other segments.
10181020
case '/':
1019-
return nEast == r || sWest == r || isJoint(nEast) || isJoint(sWest)
1021+
return ne == r || sw == r || isJoint(ne) || isJoint(sw) || n == '\\' || s == '\\'
10201022
case '\\':
1021-
return nWest == r || sEast == r || isJoint(nWest) || isJoint(sEast)
1023+
return nw == r || se == r || isJoint(nw) || isJoint(se) || n == '/' || s == '/'
10221024

10231025
// For everything else just check if we have segments next to us.
10241026
default:
1025-
return nWest == '\\' || nEast == '/' || sWest == '/' || sEast == '\\'
1027+
return nw == '\\' || ne == '/' || sw == '/' || se == '\\'
10261028
}
10271029
}
10281030

0 commit comments

Comments
 (0)