Skip to content

Commit

Permalink
WebView: fix jquery.graphviz.svg.js
Browse files Browse the repository at this point in the history
fixed behaviour of colorElement() and restoreElement() when fill/stroke is "none"
PR of: mountainstorm/jquery.graphviz.svg#18
  • Loading branch information
michkot committed Apr 15, 2020
1 parent d0b3052 commit 528c82d
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions content/graphvizSvg/jquery.graphviz.svg.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
* SOFTWARE.
*/

/*
* Edited by michkot 2020: fixed behaviour of colorElement() and restoreElement() when fill/stroke is "none"
* Edited by edejong 2018: https:/mountainstorm/jquery.graphviz.svg/pull/18
*/

+function ($) {
'use strict'
Expand Down Expand Up @@ -59,7 +63,7 @@
var $a = $(this)
$a.tooltip({
container: $graph,
placement: 'auto left',
placement: 'left',
animation: false,
viewport: null
}).on('hide.bs.tooltip', function() {
Expand Down Expand Up @@ -232,7 +236,7 @@
}

// remove namespace from a[xlink:title]
$el.children('a').filter(function () { return $(this).attr('xlink:title') }).each(function () {
$el.find('a').filter(function () { return $(this).attr('xlink:title') }).each(function () {
var $a = $(this)
$a.attr('title', $a.attr('xlink:title'))
$a.removeAttr('xlink:title')
Expand Down Expand Up @@ -367,10 +371,10 @@
$el.find('polygon, ellipse, path').each(function() {
var $this = $(this)
var color = $this.data('graphviz.svg.color')
if (color.fill && $this.prop('tagName') != 'path') {
if (color.fill && color.fill != "none" && $this.prop('tagName') != 'path') {
$this.attr('fill', getColor(color.fill, bg)) // don't set fill if it's a path
}
if (color.stroke) {
if (color.stroke && color.stroke != "none") {
$this.attr('stroke', getColor(color.stroke, bg))
}
})
Expand All @@ -380,10 +384,10 @@
$el.find('polygon, ellipse, path').each(function() {
var $this = $(this)
var color = $this.data('graphviz.svg.color')
if (color.fill) {
if (color.fill && color.fill != "none") {
$this.attr('fill', color.fill) // don't set fill if it's a path
}
if (color.stroke) {
if (color.stroke && color.stroke != "none") {
$this.attr('stroke', color.stroke)
}
})
Expand Down Expand Up @@ -448,7 +452,7 @@
var that = this
var options = this.options
$elements.each(function () {
$(this).children('a[title]').each(function () {
$(this).find('a[title]').each(function () {
if (show) {
options.tooltips.show.call(this)
} else {
Expand Down

0 comments on commit 528c82d

Please sign in to comment.