equal
deleted
inserted
replaced
114 // don't process too short segments or those which are too close to map borders |
114 // don't process too short segments or those which are too close to map borders |
115 if (p1.x = NTPX) |
115 if (p1.x = NTPX) |
116 or (dab < minDistance * 3) |
116 or (dab < minDistance * 3) |
117 or (mp.x < leftX + mapBorderMargin) |
117 or (mp.x < leftX + mapBorderMargin) |
118 or (mp.x > rightX - mapBorderMargin) |
118 or (mp.x > rightX - mapBorderMargin) |
119 or (mp.y < LongInt(topY) + mapBorderMargin) |
119 or (mp.y < topY + mapBorderMargin) |
120 or (mp.y > LongInt(LAND_HEIGHT) - mapBorderMargin) |
120 or (mp.y > LongInt(LAND_HEIGHT) - mapBorderMargin) |
121 then |
121 then |
122 begin |
122 begin |
123 newPoint:= p1; |
123 newPoint:= p1; |
124 exit; |
124 exit; |
144 end; |
144 end; |
145 |
145 |
146 if b <> 0 then |
146 if b <> 0 then |
147 begin |
147 begin |
148 // top border |
148 // top border |
149 ix:= (LongInt(topY) + mapBorderMargin - mp.y) * a div b + mp.x; |
149 ix:= (topY + mapBorderMargin - mp.y) * a div b + mp.x; |
150 d:= DistanceI(mp.y - topY - mapBorderMargin, mp.x - ix).Round; |
150 d:= DistanceI(mp.y - topY - mapBorderMargin, mp.x - ix).Round; |
151 t2:= b * (mp.y - mapBorderMargin) + a * (mp.x - ix); |
151 t2:= b * (mp.y - mapBorderMargin) + a * (mp.x - ix); |
152 if t2 > 0 then distL:= min(d, distL) else distR:= min(d, distR); |
152 if t2 > 0 then distL:= min(d, distL) else distR:= min(d, distR); |
153 |
153 |
154 // bottom border |
154 // bottom border |