Skip to content

Commit

Permalink
working on bug in rmarkdown rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
bwlewis committed Feb 7, 2017
1 parent 5f9316e commit aeaa7f6
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion inst/htmlwidgets/scatterplotThree.js
Expand Up @@ -6,13 +6,20 @@ HTMLWidgets.widget(

initialize: function(el, width, height)
{
console.log("initialize " + width + " " + height);
var g = new Widget.scatter();
g.init(el, parseInt(width), parseInt(height));
// set nonzero minimum threejs renderer size to avoid problems
var w = parseInt(width);
var h = parseInt(height);
if(w == 0) w = 500;
if(h == 0) h = 500;
g.init(el, w, h);
return {widget: g, width: parseInt(width), height: parseInt(height)};
},

resize: function(el, width, height, obj)
{
console.log("resize " + width + " " + height);
obj.width = parseInt(width);
obj.height = parseInt(height);
obj.widget.renderer.setSize(width, height);
Expand All @@ -21,6 +28,7 @@ HTMLWidgets.widget(

renderValue: function(el, x, obj)
{
console.log("render value " + obj.width + " " + obj.height);
obj.widget.create_plot(x); // see below
obj.widget.renderer.setSize(obj.width, obj.height);
obj.widget.animate();
Expand Down Expand Up @@ -136,6 +144,15 @@ Widget.scatter = function()
info.style.left = "0px";
el.appendChild(info);

// hack for case:
// subscribe to custom shown event (fired by ioslides to trigger
// shiny reactivity but we can use it as well). this is necessary
// because if a widget starts out as display:none it has height
// and width == 0 and this doesn't change when it becomes visible
EL = el;
HOMER = _this;


el.onmousemove = function(ev)
{
if(ev.preventDefault) ev.preventDefault();
Expand Down

0 comments on commit aeaa7f6

Please sign in to comment.