From a83009308dcc2d3e2d7f326333efd6e18857e106 Mon Sep 17 00:00:00 2001 From: bwlewis Date: Wed, 31 Jan 2018 01:56:44 -0500 Subject: [PATCH] Partial fix for issue #72 at least the image is retained; but now the rescaled perspective is somewhat broken :( --- DESCRIPTION | 2 +- inst/htmlwidgets/globe.js | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 7f27a2e..bb7a273 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -3,7 +3,7 @@ Type: Package Title: Interactive 3D Scatter Plots, Networks and Globes Description: Create interactive 3D scatter plots, network plots, and globes using the 'three.js' visualization library (). -Version: 0.3.1 +Version: 0.3.2 Date: 2017-08-11 Authors@R: c( person("B. W.", "Lewis", role=c("aut","cre"), email="blewis@illposed.net"), diff --git a/inst/htmlwidgets/globe.js b/inst/htmlwidgets/globe.js index e724198..7a04c1e 100644 --- a/inst/htmlwidgets/globe.js +++ b/inst/htmlwidgets/globe.js @@ -30,7 +30,7 @@ HTMLWidgets.widget( stuff.renderer.setSize( width, height ); stuff.width = width; stuff.height = height; - stuff.camera.projectionMatrix = new THREE.Matrix4().makePerspective(stuff.camera.fov, stuff.renderer.domElement.width/stuff.renderer.domElement.height, stuff.camera.near, stuff.camera.far); +// stuff.camera.projectionMatrix = new THREE.Matrix4().makePerspective(stuff.camera.fov, stuff.renderer.domElement.width/stuff.renderer.domElement.height, stuff.camera.near, stuff.camera.far); // XXX FIX ME stuff.camera.lookAt(stuff.scene.position); stuff.renderer.render( stuff.scene, stuff.camera ); }, @@ -60,7 +60,8 @@ HTMLWidgets.widget( var img, geometry, tex, earth; var down = false; var sx = 0, sy = 0; - tex = THREE.ImageUtils.loadTexture(x.img, {}, function() {render();}); +// tex = THREE.ImageUtils.loadTexture(x.img, {}, function() {render();}); + tex = new THREE.TextureLoader().load(x.img); var vertexShader = [ 'uniform vec3 viewVector;', @@ -272,7 +273,7 @@ HTMLWidgets.widget( if(GL) stuff.camera.fov -= event.wheelDeltaY * 0.02; else stuff.camera.fov -= event.wheelDeltaY * 0.0075; stuff.camera.fov = Math.max( Math.min( stuff.camera.fov, fovMAX ), fovMIN ); - stuff.camera.projectionMatrix = new THREE.Matrix4().makePerspective(stuff.camera.fov, stuff.renderer.domElement.width/stuff.renderer.domElement.height, stuff.camera.near, stuff.camera.far); +// stuff.camera.projectionMatrix = new THREE.Matrix4().makePerspective(stuff.camera.fov, stuff.renderer.domElement.width/stuff.renderer.domElement.height, stuff.camera.near, stuff.camera.far); // XXX FIX ME render(); } el.onmousewheel = function(ev) {ev.preventDefault();};