|
222 | 222 | paint: function() { |
223 | 223 | this.drawBGCells(); |
224 | 224 | this.drawGrid(); |
| 225 | + this.drawCaps(); |
225 | 226 | this.drawLines(); |
226 | 227 | this.drawPekes(); |
227 | 228 | }, |
|
235 | 236 | return null; |
236 | 237 | }, |
237 | 238 |
|
| 239 | + getCrossColor: function(cross) { |
| 240 | + var color = null; |
| 241 | + for (var dir in cross.adjborder) { |
| 242 | + var border = cross.adjborder[dir]; |
| 243 | + var newColor = this.getLineColor(border); |
| 244 | + |
| 245 | + if (border.error === 1) { |
| 246 | + return newColor; |
| 247 | + } else if (!color) { |
| 248 | + color = newColor; |
| 249 | + } |
| 250 | + } |
| 251 | + return color; |
| 252 | + }, |
| 253 | + |
| 254 | + drawCaps: function() { |
| 255 | + var g = this.vinc("caps"); |
| 256 | + g.strokeStyle = null; |
| 257 | + |
| 258 | + var basewidth = Math.max(this.bw / 4, 2); |
| 259 | + var xlist = this.range.crosses; |
| 260 | + for (var i = 0; i < xlist.length; i++) { |
| 261 | + var cross = xlist[i]; |
| 262 | + g.vid = "b_cap" + cross.id; |
| 263 | + |
| 264 | + var color = this.getCrossColor(cross); |
| 265 | + |
| 266 | + if (!!color) { |
| 267 | + var px = cross.bx * this.bw, |
| 268 | + py = cross.by * this.bh; |
| 269 | + |
| 270 | + var radius = basewidth / 2; |
| 271 | + g.fillStyle = color; |
| 272 | + g.shapeCircle(px, py, radius); |
| 273 | + } else { |
| 274 | + g.vhide(); |
| 275 | + } |
| 276 | + } |
| 277 | + }, |
| 278 | + |
238 | 279 | drawLines: function() { |
239 | 280 | var g = this.vinc("line"); |
240 | 281 |
|
|
260 | 301 | g.beginPath(); |
261 | 302 | g.moveTo(px, py - this.bh); |
262 | 303 | if (border.line === 1) { |
263 | | - g.lineTo(px - this.bw / 2, py); |
| 304 | + g.lineTo(px - this.bw / 1.5, py); |
264 | 305 | } else { |
265 | | - g.lineTo(px + this.bw / 2, py); |
| 306 | + g.lineTo(px + this.bw / 1.5, py); |
266 | 307 | } |
267 | 308 | g.lineTo(px, py + this.bh); |
268 | 309 | } else { |
269 | 310 | g.beginPath(); |
270 | 311 | g.moveTo(px - this.bw, py); |
271 | 312 | if (border.line === 1) { |
272 | | - g.lineTo(px, py - this.bh / 2); |
| 313 | + g.lineTo(px, py - this.bh / 1.5); |
273 | 314 | } else { |
274 | | - g.lineTo(px, py + this.bh / 2); |
| 315 | + g.lineTo(px, py + this.bh / 1.5); |
275 | 316 | } |
276 | 317 | g.lineTo(px + this.bw, py); |
277 | 318 | } |
|
0 commit comments