Commit 500a3109 authored by Dario Seyb's avatar Dario Seyb

double click to center view on clicked point

parent 5370c2c2
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
import pythreejs as three
import numpy as np
from ipywidgets import HTML, Text
from traitlets import link, dlink, Bool
from IPython.display import display
from .indexed_attribute import *
from .mesh_helper import calculateFaceNormals, calculatePointNormals
......@@ -20,10 +22,17 @@ class Context(object):
self.scene.background = background_color
self.orbit_controls = three.OrbitControls(
self.click_picker = three.Picker(controlling=self.scene, root=self.scene, event='dblclick')
self.renderer = three.Renderer(, background=background_color, background_opacity=1,
scene=self.scene, controls=[self.orbit_controls],
scene=self.scene, controls=[self.orbit_controls, self.click_picker],
width=width, height=height, antialias=True )
def on_picked(change): = change['new']
self.click_picker.observe(on_picked, names=['point'])
def draw_sphere(self):
mesh_obj = three.Mesh(three.SphereBufferGeometry(20, 16, 16),
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment