jupyter-widgets / pythreejs

A Jupyter - Three.js bridge
https://pythreejs.readthedocs.io
Other
936 stars 187 forks source link

How do you “truck” (translate left or right) the camera with the keyboard in Jupyter? #228

Open scottlittle opened 5 years ago

scottlittle commented 5 years ago

I was wondering if there is a keyboard shortcut for translation of the origin. I can pan, tilt, and zoom with the mouse, but I would like to truck, etc. (wasd keys in most video games). If this is not possible, then that info is helpful as well.

https://stackoverflow.com/questions/53107873/for-pythreejs-how-do-you-truck-translate-left-or-right-the-camera-with-the

vidartf commented 5 years ago

Answered on SO. If you want to make the keys configurable, we can have this issue track that (contributions welcome 😉).

scottlittle commented 5 years ago

Would it make sense to have a modifier key that would enable translation with the mouse or other keyboard functions? Would love to contribute if I could get to that point, ha.

scottlittle commented 5 years ago

Does // keys: new Types.KeyDict() need to be enabled for the keys to work? The three.js documentation gives this mapping:

controls.keys = {
    LEFT: 37, //left arrow
    UP: 38, // up arrow
    RIGHT: 39, // right arrow
    BOTTOM: 40 // down arrow
}

Those could be exposed to make the controls configurable, correct?

scottlittle commented 5 years ago

I guess, I digress. I am mainly wondering if there is a way to translate the camera in any way by the user. This would be useful for exploring large network graphs, for instance.

scottlittle commented 5 years ago

On a different Mac laptop, I am able to hold down the CTRL or command key for translation of the image. So, I am closing this.

vidartf commented 5 years ago

Currently, the keyboard nav cannot be used since it is not possible to directly focus the canvas element. Whether or not this is a desired possibility is uncertain. E.g., we do not want to inadvertently interfere with mouse-scrolling / cell-selection by focusing when we should not. Reopening to track this until its been thought through fully.