Skip to content

Commit

Permalink
redraw fix
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnCoene committed Mar 4, 2019
1 parent b1b35a3 commit 958a770
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 19 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* The filter family of functions sees the addition of the `name` argument as well as `sg_filter_undo_p` to undo fitlers (by name).
* `sg_clear` added to clear the graph.
* `sg_change_*_p` family added to change nodes and edges attributes on the fly.
* Event improved.

# sigmajs 0.1.2

Expand Down
27 changes: 8 additions & 19 deletions inst/htmlwidgets/sigmajs.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,33 +53,24 @@ HTMLWidgets.widget({
}
);
} else {
// create
if(!initialized){
initialized = true;
s = new sigma({
graph: x.data,
settings: x.settings
});
}

if(s.clear === true){
s.clear();
}

if(x.kill === true){

s.kill();

if (HTMLWidgets.shinyMode) { // If in Shiny app
// Remove previous occurences of plots in the <div>
sigmaID = document.getElementById(el.id)
while (sigmaID.firstChild) {
//The list is LIVE so it will re-index each call
sigmaID.removeChild(sigmaID.firstChild);
}
s = new sigma({
graph: x.data,
settings: x.settings
});
s.refresh();
}

renderer = s.addRenderer({
container: el.id,
type: x.type

});
}

Expand Down Expand Up @@ -623,8 +614,6 @@ HTMLWidgets.widget({
for(var name in s.renderers)
s.renderers[name].resize(width, height);
},

s: s,

getCamera: function() {
return cam;
Expand Down

0 comments on commit 958a770

Please sign in to comment.