Skip to content

Commit

Permalink
fixed single-color point specification noted in issue #76; Added call…
Browse files Browse the repository at this point in the history
…back to render globe map in globejs

map previously didn't render until interaction
  • Loading branch information
bwlewis committed Feb 23, 2018
1 parent 864168e commit 68ec7f7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
14 changes: 1 addition & 13 deletions inst/htmlwidgets/globe.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ HTMLWidgets.widget(
var down = false;
var sx = 0, sy = 0;
// tex = THREE.ImageUtils.loadTexture(x.img, {}, function() {render();});
tex = new THREE.TextureLoader().load(x.img);
tex = new THREE.TextureLoader().load(x.img, function(texture) {render();});

var vertexShader = [
'uniform vec3 viewVector;',
Expand Down Expand Up @@ -306,18 +306,6 @@ HTMLWidgets.widget(
}
};

// We disabled the usual Three.js animation technique in favor of simply
// rendering after mouse updates. This results in a bit of choppiness for
// Canvas renderings, but is compatible with more browsers and with older
// versions of RStudio because it doesn't need requestAnimationFrame.

// animate();
// function animate() {
// renderer.clear();
// requestAnimationFrame( animate );
// render();
// }

function render() {
stuff.renderer.clear();
stuff.camera.lookAt(stuff.scene.position);
Expand Down
2 changes: 1 addition & 1 deletion inst/htmlwidgets/scatterplotThree.js
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ Widget.scatter = function(w, h)
} else if(x.color) {
// only a single color specified
var XC;
if(Array.isArray(x.color)) XC = "#" + new THREE.Color(x.color[0]).getHexString();
if(Array.isArray(x.color)) XC = new THREE.Color("#" + new THREE.Color(x.color[0]).getHexString());
else XC = new THREE.Color(x.color);
_this.datacolor = [];
_this.datacolor.length = x.NROW;
Expand Down

0 comments on commit 68ec7f7

Please sign in to comment.