Skip to content

Commit

Permalink
add full screen support for the treeview
Browse files Browse the repository at this point in the history
  • Loading branch information
bmesuere committed Sep 18, 2017
1 parent b1ec7a5 commit 0e1e677
Show file tree
Hide file tree
Showing 8 changed files with 87 additions and 18 deletions.
34 changes: 29 additions & 5 deletions dist/unipept-visualizations.es5.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/unipept-visualizations.es5.js.map

Large diffs are not rendered by default.

34 changes: 29 additions & 5 deletions dist/unipept-visualizations.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/unipept-visualizations.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/unipept-visualizations.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "unipept-visualizations",
"version": "1.4.0",
"version": "1.5.0",
"description": "Unipept visualisation tools",
"main": "index.js",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions src/sunburst/sunburst.js
Original file line number Diff line number Diff line change
Expand Up @@ -491,8 +491,8 @@ export default class Sunburst {
// the delay is because the event fires before we're in fullscreen
// so the height en width functions don't give a correct result
// without the delay
setTimeout(function () {
let size = 740;
setTimeout(() => {
let size = this.settings.width;
if (isFullScreen) {
size = Math.min($(window).height() - 44, $(window).width() - 250);
}
Expand Down
21 changes: 21 additions & 0 deletions src/treeview/treeview.js
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,27 @@ export default function TreeView(element, data, options = {}) {
reroot(root);
};

/**
* Sets the visualisation in full screen mode
*
* @param <boolean> isFullScreen indicates if we're in full screen mode
*/
that.setFullScreen = function setFullScreen(isFullScreen) {
// the delay is because the event fires before we're in fullscreen
// so the height en width functions don't give a correct result
// without the delay
setTimeout(() => {
let [w, h] = [settings.width, settings.height];
if (isFullScreen) {
w = $(window).width();
h = $(window).height() - 44;
}
$(element).children("svg")
.attr("width", w)
.attr("height", h);
}, 1000);
};

// initialize the object
init();

Expand Down

0 comments on commit 0e1e677

Please sign in to comment.