Skip to content

Commit 764cb2e

Browse files
author
Mark Robinson
committed
Improve panning and zooming graph using svg-pan-zoom library
1 parent 14881db commit 764cb2e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+19257
-2300
lines changed

src/main/resources/static/bower_components/graphviz-d3-renderer/.bower.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"name": "graphviz-d3-renderer",
3-
"version": "0.9.21",
3+
"version": "0.9.24",
44
"dependencies": {
55
"requirejs": "2.1.15",
66
"d3": "3.5.3",
77
"requirejs-web-workers": "~1.0.1",
8-
"viz.js": "~1.4.1"
8+
"viz.js": "~1.5.1"
99
},
1010
"devDependencies": {
1111
"rfactory": "1.1.0",
@@ -46,11 +46,11 @@
4646
"karma.conf.js"
4747
],
4848
"homepage": "https://github.com/mstefaniuk/graph-viz-d3-js",
49-
"_release": "0.9.21",
49+
"_release": "0.9.24",
5050
"_resolution": {
5151
"type": "version",
52-
"tag": "0.9.21",
53-
"commit": "9cba7e58b832f59e51271f8f98367ab676ef206f"
52+
"tag": "0.9.24",
53+
"commit": "9588a63ee3d5ff651b00a6168340a8b7477b9845"
5454
},
5555
"_source": "https://github.com/mstefaniuk/graph-viz-d3-js.git",
5656
"_target": "^0.9.18",

src/main/resources/static/bower_components/graphviz-d3-renderer/bower.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"name": "graphviz-d3-renderer",
3-
"version": "0.9.18",
3+
"version": "0.9.24",
44
"dependencies": {
55
"requirejs": "2.1.15",
66
"d3": "3.5.3",
77
"requirejs-web-workers": "~1.0.1",
8-
"viz.js": "~1.4.1"
8+
"viz.js": "~1.5.1"
99
},
1010
"devDependencies": {
1111
"rfactory": "1.1.0",

src/main/resources/static/bower_components/graphviz-d3-renderer/dist/layout-worker.js

Lines changed: 1179 additions & 1138 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/resources/static/bower_components/graphviz-d3-renderer/dist/renderer.js

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,17 @@ define('styliseur',["d3"], function(d3) {
5757
var styliseur = function () {
5858
this.each(function (d) {
5959
var self = d3.select(this);
60-
var colorInsteadOfStroke = this instanceof SVGTextElement || false;
60+
var fillInsteadOfStroke = this instanceof SVGTextElement || false;
6161
d && d.style && d.style.forEach(function (e) {
6262
switch (e.key) {
6363
case "stroke":
6464
case "fill":
65-
var attribute = e.key==="stroke" && colorInsteadOfStroke ? "color" : e.key;
65+
var attribute = e.key==="stroke" && fillInsteadOfStroke ? "fill" : e.key;
6666
var transparent = e.value.indexOf("#")===0 && e.value.length === 9;
6767
var color = transparent ? e.value.substr(0,7) : e.value;
6868
var opacity = transparent ? parseInt(e.value.substr(7,2),16)/255 : 1;
6969
self.attr(attribute, color);
70-
opacity && self.attr(attribute + "-opacity", opacity);
70+
opacity < 1 && self.attr(attribute + "-opacity", opacity);
7171
break;
7272
case "font-size":
7373
case "font-family":
@@ -313,7 +313,13 @@ define('stage',["d3", "palette", "transitions/default"], function (d3, palette,
313313
return d.id;
314314
});
315315

316-
transitions.nodes(entering.filter(".node"), function () {
316+
entering
317+
.filter(function(d) { return d.url; })
318+
.append("a")
319+
.attr("xlink:href", function(d) {return d.url;})
320+
.attr("xlink:title", function(d) {return d.tooltip;});
321+
322+
transitions.nodes(entering.filter(".node:empty,.node a"), function () {
317323
this.style("opacity", 1.0);
318324
});
319325
transitions.relations(entering.filter(".relation"), function () {
@@ -327,7 +333,15 @@ define('stage',["d3", "palette", "transitions/default"], function (d3, palette,
327333
return order[a.class] - order[b.class];
328334
});
329335

330-
var shapes = groups.selectAll("path").data(function (d) {
336+
var leaves = main
337+
.selectAll("*")
338+
.filter(function(d) {
339+
return this instanceof SVGAElement ||
340+
(this instanceof SVGGElement && !this.querySelector("a"));
341+
});
342+
var shapes = leaves
343+
.selectAll("path")
344+
.data(function (d) {
331345
return d.shapes;
332346
}, function (d, i) {
333347
return [d.shape, i].join('-');
@@ -342,9 +356,11 @@ define('stage',["d3", "palette", "transitions/default"], function (d3, palette,
342356
});
343357
});
344358

345-
var labels = groups.selectAll("text").data(function (d) {
346-
return d.labels;
347-
});
359+
var labels = leaves
360+
.selectAll("text")
361+
.data(function (d) {
362+
return d.labels;
363+
});
348364
labels.enter().append("text");
349365
transitions.labels(labels, labelAttributer);
350366
},
@@ -354,8 +370,6 @@ define('stage',["d3", "palette", "transitions/default"], function (d3, palette,
354370
var scaleFactor = 1;
355371

356372
var svgImage = new Image();
357-
svgImage.src = "data:image/svg+xml;utf8," + svgXml;
358-
359373
var pngImage = new Image();
360374

361375
svgImage.onload = function () {
@@ -364,13 +378,16 @@ define('stage',["d3", "palette", "transitions/default"], function (d3, palette,
364378
canvas.height = svgImage.height * scaleFactor;
365379

366380
var context = canvas.getContext("2d");
367-
context.drawImage(svgImage, 0, 0, canvas.width, canvas.height);
381+
context
382+
.drawImage(
383+
svgImage, 0, 0, canvas.width, canvas.height);
368384

369385
pngImage.src = canvas.toDataURL("image/png");
370386
pngImage.width = svgImage.width;
371387
pngImage.height = svgImage.height;
372388
};
373389

390+
svgImage.src = "data:image/svg+xml;base64," + btoa(svgXml);
374391
return pngImage;
375392
}
376393
};

src/main/resources/static/bower_components/graphviz-d3-renderer/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "graphviz-d3-renderer",
3-
"version": "0.9.18",
3+
"version": "0.9.24",
44
"devDependencies": {
55
"grunt": "~0.4.2",
66
"grunt-bower-task": "~0.4.0",
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"name": "svg-pan-zoom",
3+
"version": "3.4.1",
4+
"homepage": "https://github.com/ariutta/svg-pan-zoom",
5+
"authors": [
6+
"Andrea Leofreddi <[email protected]>",
7+
"Anders Riutta <[email protected]>",
8+
"Zeng Xiaohui",
9+
"Barry Coughlan (https://github.com/bcoughlan)",
10+
"Risingson",
11+
"bumbu alex (http://bumbu.me>)",
12+
"Alexander Pico <[email protected]>",
13+
"Kyran Burraston (http://kyranburraston.co.uk)",
14+
"Risingson (https://github.com/Risingson)",
15+
"Siddhanathan Shanmugam <[email protected]>",
16+
"Karina Simard (https://github.com/ksimard)",
17+
"Christopher Clark <[email protected]>",
18+
"Vladimir Prus (http://vladimirprus.com)",
19+
"Barry Coughlan (https://github.com/bcoughlan)",
20+
"Ionică Bizău (http://ionicabizau.net/)",
21+
"Ciprian Placintă (https://github.com/CiprianPlacinta)",
22+
"Riccardo Santoro (https://github.com/VeNoMiS)",
23+
"César Vidril (https://github.com/Yimiprod)"
24+
],
25+
"description": "JavaScript library for panning and zooming an SVG image from the mouse, touches and programmatically.",
26+
"main": "dist/svg-pan-zoom.js",
27+
"keywords": [
28+
"svg",
29+
"pan",
30+
"zoom"
31+
],
32+
"license": "BSD",
33+
"ignore": [
34+
"**/.*",
35+
"node_modules",
36+
"bower_components",
37+
"test",
38+
"tests"
39+
],
40+
"_release": "3.4.1",
41+
"_resolution": {
42+
"type": "version",
43+
"tag": "3.4.1",
44+
"commit": "ca0f1270402ca9f39a77e19217a58107204cf936"
45+
},
46+
"_source": "https://github.com/ariutta/svg-pan-zoom.git",
47+
"_target": "^3.4.1",
48+
"_originalSource": "svg-pan-zoom",
49+
"_direct": true
50+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
Hi there!
2+
3+
Thanks for submitting an issue to svg-pan-zoom.
4+
5+
To help us help you better, please do the following before submitting an issue:
6+
7+
1. Review the available [documentation](https://github.com/ariutta/svg-pan-zoom/blob/master/README.md) and existing [examples](https://github.com/ariutta/svg-pan-zoom#demos)
8+
1. Check if the same bug/feature request [wasn't previously reported](https://github.com/ariutta/svg-pan-zoom/issues?q=is%3Aissue%20)
9+
1. Make sure you are not asking a usage or debugging question. If you are, use [StackOverflow](http://stackoverflow.com/questions/tagged/svgpanzoom).
10+
1. Fill in the information that corresponds to your type of issue below
11+
1. If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://jsfiddle.net or similar (template: http://jsfiddle.net/bumbu/167usffr/).
12+
1. Delete this intro and any unrelated text :smile: (if you do not we'll assume you haven't read these instructions and automatically close the issue)
13+
14+
15+
Bug report
16+
---
17+
18+
### Expected behaviour
19+
_your text here_
20+
21+
### Actual behaviour
22+
_your text here_
23+
24+
### Steps to reproduce the behaviour
25+
26+
1.
27+
2.
28+
29+
### Configuration
30+
31+
- svg-pan-zoom version: ``
32+
- Browser(s): ``
33+
- Operating system(s): ``
34+
- A relevant example URL:
35+
36+
37+
Feature Request
38+
---
39+
40+
- Feature description
41+
- Reasons for adopting new feature
42+
- Is this a breaking change? (How will this affect existing functionality)
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Copyright 2009-2010 Andrea Leofreddi <[email protected]>
2+
All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without modification,
5+
are permitted provided that the following conditions are met:
6+
7+
* Redistributions of source code must retain the above copyright notice, this
8+
list of conditions and the following disclaimer.
9+
10+
* Redistributions in binary form must reproduce the above copyright notice, this
11+
list of conditions and the following disclaimer in the documentation and/or
12+
other materials provided with the distribution.
13+
14+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
15+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
18+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
21+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

0 commit comments

Comments
 (0)