{"action":"created","issue":{"url":"https://api.github.com/repos/jupyter-widgets/pythreejs/issues/215","repository_url":"https://api.github.com/repos/jupyter-widgets/pythreejs","labels_url":"https://api.github.com/repos/jupyter-widgets/pythreejs/issues/215/labels{/name}","comments_url":"https://api.github.com/repos/jupyter-widgets/pythreejs/issues/215/comments","events_url":"https://api.github.com/repos/jupyter-widgets/pythreejs/issues/215/events","html_url":"https://github.com/jupyter-widgets/pythreejs/issues/215","id":358835218,"node_id":"MDU6SXNzdWUzNTg4MzUyMTg=","number":215,"title":"Embedded widget's controls are broken","user":{"login":"jpanetta","id":15096451,"node_id":"MDQ6VXNlcjE1MDk2NDUx","avatar_url":"https://avatars1.githubusercontent.com/u/15096451?v=4","gravatar_id":"","url":"https://api.github.com/users/jpanetta","html_url":"https://github.com/jpanetta","followers_url":"https://api.github.com/users/jpanetta/followers","following_url":"https://api.github.com/users/jpanetta/following{/other_user}","gists_url":"https://api.github.com/users/jpanetta/gists{/gist_id}","starred_url":"https://api.github.com/users/jpanetta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jpanetta/subscriptions","organizations_url":"https://api.github.com/users/jpanetta/orgs","repos_url":"https://api.github.com/users/jpanetta/repos","events_url":"https://api.github.com/users/jpanetta/events{/privacy}","received_events_url":"https://api.github.com/users/jpanetta/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-09-10T23:50:07Z","updated_at":"2018-09-11T09:36:58Z","closed_at":null,"author_association":"NONE","body":"When I export my renderer to a standalone HTML document using `ipywidgets.embed`, the `OrbitControls` and `TrackballControls` are broken. The scene renders properly, but the moment you interact with it, the camera parameters blow up.\r\n\r\n<details><summary>Example code (see attached `tri_embed.html`)</summary>\r\n\r\n```\r\nfrom pythreejs import *\r\nfrom ipywidgets import embed\r\n\r\nscene = Scene(children=[AmbientLight(intensity=0.5)])\r\n\r\nvertices = BufferAttribute(array=np.array(\r\n        [[-1.0, -1.0,  0.0],\r\n         [ 1.0, -1.0,  0.0],\r\n         [ 1.0,  1.0,  0.0]], dtype=np.float32), normalized=False)\r\nindex = BufferAttribute(array=np.array(\r\n        [[0, 1, 2]], dtype=np.uint16).ravel(), normalized=False)\r\ngeom = BufferGeometry(attributes={\r\n        'position': vertices,\r\n        'index': index,\r\n    })\r\n\r\nsurf=Mesh(geometry=geom, material=MeshLambertMaterial(color='red', side='DoubleSide'))\r\nscene.add(surf)\r\n\r\nc = PerspectiveCamera(position=[0, 0, 3], up=[0, 1, 0])\r\ncontrols = OrbitControls(controlling=c)\r\nr = Renderer(camera=c, scene=scene, controls=[controls])\r\nembed.embed_minimal_html('tri_embed.html', views=r)\r\n```\r\n</details>\r\n<br>\r\n\r\nApparently, the main problem is the `OrbitControls.maxDistance` variable is changed from its initial value of `Infinity` (`examples/controls/OrbitControls.js:32`) to `null`, which breaks the eye vector calculation. This change to `null` happens in `assignDirect`, called from `syncToThreeObj`, so perhaps this is when the defaults specified in `OrbitControls.autogen.js:20` are pushed to three.js--but I still don't have a clear picture of the steps taken to initialize/restore the three.js data structures.\r\n\r\nWhen I manually change this `maxDistance` back to `Infinity` in the JS debugger, the controls *mostly* work (probably some other state is being overwritten, but I'll need to do some more debugging).\r\n\r\nOn a related note: is there a good way for me to point the standalone HTML file at my local development copy of the pythreejs code? It seems to always fall back to a CDN copy of `juptyer-threejs`, which prevents me from attempting to fix these issues.\r\n\r\nAlso, is it normal for it to take a couple minutes to run a Jupyter build after each change to the pythreejs source? I followed the current [developer install instructions](https://pythreejs.readthedocs.io/en/latest/develop-install.html).\r\n\r\n[tri_embed.html.zip](https://github.com/jupyter-widgets/pythreejs/files/2368805/tri_embed.html.zip)\r\n"},"comment":{"url":"https://api.github.com/repos/jupyter-widgets/pythreejs/issues/comments/420211475","html_url":"https://github.com/jupyter-widgets/pythreejs/issues/215#issuecomment-420211475","issue_url":"https://api.github.com/repos/jupyter-widgets/pythreejs/issues/215","id":420211475,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMDIxMTQ3NQ==","user":{"login":"maartenbreddels","id":1765949,"node_id":"MDQ6VXNlcjE3NjU5NDk=","avatar_url":"https://avatars0.githubusercontent.com/u/1765949?v=4","gravatar_id":"","url":"https://api.github.com/users/maartenbreddels","html_url":"https://github.com/maartenbreddels","followers_url":"https://api.github.com/users/maartenbreddels/followers","following_url":"https://api.github.com/users/maartenbreddels/following{/other_user}","gists_url":"https://api.github.com/users/maartenbreddels/gists{/gist_id}","starred_url":"https://api.github.com/users/maartenbreddels/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maartenbreddels/subscriptions","organizations_url":"https://api.github.com/users/maartenbreddels/orgs","repos_url":"https://api.github.com/users/maartenbreddels/repos","events_url":"https://api.github.com/users/maartenbreddels/events{/privacy}","received_events_url":"https://api.github.com/users/maartenbreddels/received_events","type":"User","site_admin":false},"created_at":"2018-09-11T09:36:58Z","updated_at":"2018-09-11T09:36:58Z","author_association":"MEMBER","body":"I usually link say `jupyter-three.js`, `ipyvolume.js` etc to my dev directory/files, so they are always using the latest version."}}
{"actor":{"display_login":"maartenbreddels"}}