|
20 | 20 | * SOFTWARE.
|
21 | 21 | */
|
22 | 22 |
|
| 23 | +/* |
| 24 | + * Edited by michkot 2020: fixed behaviour of colorElement() and restoreElement() when fill/stroke is "none" |
| 25 | + * Edited by edejong 2018: https://github.com/mountainstorm/jquery.graphviz.svg/pull/18 |
| 26 | + */ |
23 | 27 |
|
24 | 28 | +function ($) {
|
25 | 29 | 'use strict'
|
|
59 | 63 | var $a = $(this)
|
60 | 64 | $a.tooltip({
|
61 | 65 | container: $graph,
|
62 |
| - placement: 'auto left', |
| 66 | + placement: 'left', |
63 | 67 | animation: false,
|
64 | 68 | viewport: null
|
65 | 69 | }).on('hide.bs.tooltip', function() {
|
|
232 | 236 | }
|
233 | 237 |
|
234 | 238 | // remove namespace from a[xlink:title]
|
235 |
| - $el.children('a').filter(function () { return $(this).attr('xlink:title') }).each(function () { |
| 239 | + $el.find('a').filter(function () { return $(this).attr('xlink:title') }).each(function () { |
236 | 240 | var $a = $(this)
|
237 | 241 | $a.attr('title', $a.attr('xlink:title'))
|
238 | 242 | $a.removeAttr('xlink:title')
|
|
367 | 371 | $el.find('polygon, ellipse, path').each(function() {
|
368 | 372 | var $this = $(this)
|
369 | 373 | var color = $this.data('graphviz.svg.color')
|
370 |
| - if (color.fill && $this.prop('tagName') != 'path') { |
| 374 | + if (color.fill && color.fill != "none" && $this.prop('tagName') != 'path') { |
371 | 375 | $this.attr('fill', getColor(color.fill, bg)) // don't set fill if it's a path
|
372 | 376 | }
|
373 |
| - if (color.stroke) { |
| 377 | + if (color.stroke && color.stroke != "none") { |
374 | 378 | $this.attr('stroke', getColor(color.stroke, bg))
|
375 | 379 | }
|
376 | 380 | })
|
|
380 | 384 | $el.find('polygon, ellipse, path').each(function() {
|
381 | 385 | var $this = $(this)
|
382 | 386 | var color = $this.data('graphviz.svg.color')
|
383 |
| - if (color.fill) { |
| 387 | + if (color.fill && color.fill != "none") { |
384 | 388 | $this.attr('fill', color.fill) // don't set fill if it's a path
|
385 | 389 | }
|
386 |
| - if (color.stroke) { |
| 390 | + if (color.stroke && color.stroke != "none") { |
387 | 391 | $this.attr('stroke', color.stroke)
|
388 | 392 | }
|
389 | 393 | })
|
|
448 | 452 | var that = this
|
449 | 453 | var options = this.options
|
450 | 454 | $elements.each(function () {
|
451 |
| - $(this).children('a[title]').each(function () { |
| 455 | + $(this).find('a[title]').each(function () { |
452 | 456 | if (show) {
|
453 | 457 | options.tooltips.show.call(this)
|
454 | 458 | } else {
|
|
0 commit comments