Skip to content

Commit 72fd6de

Browse files
committed
WebView: fix jquery.graphviz.svg.js
fixed behaviour of colorElement() and restoreElement() when fill/stroke is "none" PR of: mountainstorm/jquery.graphviz.svg#18
1 parent d50779e commit 72fd6de

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

content/graphvizSvg/jquery.graphviz.svg.js

+11-7
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
* SOFTWARE.
2121
*/
2222

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+
*/
2327

2428
+function ($) {
2529
'use strict'
@@ -59,7 +63,7 @@
5963
var $a = $(this)
6064
$a.tooltip({
6165
container: $graph,
62-
placement: 'auto left',
66+
placement: 'left',
6367
animation: false,
6468
viewport: null
6569
}).on('hide.bs.tooltip', function() {
@@ -232,7 +236,7 @@
232236
}
233237

234238
// 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 () {
236240
var $a = $(this)
237241
$a.attr('title', $a.attr('xlink:title'))
238242
$a.removeAttr('xlink:title')
@@ -367,10 +371,10 @@
367371
$el.find('polygon, ellipse, path').each(function() {
368372
var $this = $(this)
369373
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') {
371375
$this.attr('fill', getColor(color.fill, bg)) // don't set fill if it's a path
372376
}
373-
if (color.stroke) {
377+
if (color.stroke && color.stroke != "none") {
374378
$this.attr('stroke', getColor(color.stroke, bg))
375379
}
376380
})
@@ -380,10 +384,10 @@
380384
$el.find('polygon, ellipse, path').each(function() {
381385
var $this = $(this)
382386
var color = $this.data('graphviz.svg.color')
383-
if (color.fill) {
387+
if (color.fill && color.fill != "none") {
384388
$this.attr('fill', color.fill) // don't set fill if it's a path
385389
}
386-
if (color.stroke) {
390+
if (color.stroke && color.stroke != "none") {
387391
$this.attr('stroke', color.stroke)
388392
}
389393
})
@@ -448,7 +452,7 @@
448452
var that = this
449453
var options = this.options
450454
$elements.each(function () {
451-
$(this).children('a[title]').each(function () {
455+
$(this).find('a[title]').each(function () {
452456
if (show) {
453457
options.tooltips.show.call(this)
454458
} else {

0 commit comments

Comments
 (0)