Skip to content

Commit 6f585c3

Browse files
committed
Document Picker
1 parent 5c936ed commit 6f585c3

File tree

2 files changed

+49
-13
lines changed

2 files changed

+49
-13
lines changed

docs/source/introduction.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ class, which allows the user to control the camera by zooming, panning, and orbi
3333
around a target. Another example is the :py:class:`~pythreejs.Picker` widget, which allows
3434
for getting the objects and surface coordinates underneath the mouse cursor.
3535

36+
To use controls, pass them to the renderer, e.g.::
37+
38+
Renderer(controls=[OrbitControls(...), ...], ...)
39+
40+
3641

3742
.. _animation:
3843

js/scripts/three-class-config.js

Lines changed: 44 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -260,19 +260,50 @@ module.exports = {
260260
relativePath: './controls/Picker',
261261
superClass: 'Controls',
262262
properties: {
263-
event: new Types.String('click'),
264-
all: new Types.Bool(false),
265-
distance: new Types.Float(null, {nullable: true}),
266-
point: new Types.Vector3(0, 0, 0),
267-
face: new Types.Vector3(0, 0, 0),
268-
faceNormal: new Types.Vector3(0, 0, 0),
269-
faceVertices: new Types.VectorArray(),
270-
faceIndex: new Types.Int(null, {nullable: true}),
271-
modifiers: new Types.Array(),
272-
object: new Types.ThreeType('Object3D', {nullable: true}),
273-
picked: new Types.Array(),
274-
uv: new Types.Vector2(0, 0),
275-
indices: new Types.Array(),
263+
event: new Types.String('click', {
264+
help: 'The DOM MouseEvent type to trigger the pick',
265+
}),
266+
all: new Types.Bool(false, {
267+
help: 'Wether to send info on all object intersections beneath the picked point, or only the first one. See ``picked``.',
268+
}),
269+
distance: new Types.Float(null, {
270+
nullable: true,
271+
help: 'The distance from the camera of the picked point (null if no object picked)',
272+
}),
273+
point: new Types.Vector3(0, 0, 0, {
274+
help: 'The coordinates of the picked point (all zero if no object picked)',
275+
}),
276+
face: new Types.Vector3(0, 0, 0, {
277+
help: 'The vertex indices of the picked face (all zero if no face picked)',
278+
}),
279+
faceNormal: new Types.Vector3(0, 0, 0, {
280+
help: 'The normal vector of the picked face (all zero if no face picked)',
281+
}),
282+
faceVertices: new Types.VectorArray({
283+
help: 'The three vertices that make up the picked face, as vectors (empty if no face picked)',
284+
}),
285+
faceIndex: new Types.Int(null, {
286+
nullable: true,
287+
help: 'The index of the face picked (null if no face picked)',
288+
}),
289+
modifiers: new Types.Array({
290+
help: 'The keyboard modifiers held at the pick event in the following order: [SHIFT, CTRL, ALT, META]',
291+
}),
292+
object: new Types.ThreeType('Object3D', {
293+
nullable: true,
294+
help: 'The picked object (null if no object picked)',
295+
}),
296+
picked: new Types.Array({
297+
help: 'The other fields on the picker will always be for the first object intersection. ' +
298+
'If ``all`` is set true, this field will be an array containing the same information ' +
299+
'for all intersections.',
300+
}),
301+
uv: new Types.Vector2(0, 0, {
302+
help: 'The UV coordinate picked (all zero if invalid pick)',
303+
}),
304+
indices: new Types.Array({
305+
help: 'The vertex indices of the picked face (empty if no face picked)',
306+
}),
276307
},
277308
propsDefinedByThree: [
278309
'distance', 'point', 'face', 'faceNormal', 'faceVertices',

0 commit comments

Comments
 (0)