Skip to content

Commit 1284cca

Browse files
jourdainxhlulu
andauthored
Add picking support (#38)
* Update to [email protected] * update generated files * Update to [email protected] * update generated files * improve pyvista-terrain demo with picking * add support for multi-array fields * udpate generated files * Apply black to demos * Change default to None instead of empty array This ensures we are safe from mutations * npm run build * Bump version Co-authored-by: xhlulu <[email protected]>
1 parent daca5c1 commit 1284cca

28 files changed

+380
-98
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: dashVtk
22
Title: React based declarative usage of vtk.js for Dash
3-
Version: 0.0.6
3+
Version: 0.0.7
44
Description: React based declarative usage of vtk.js for Dash
55
Depends: R (>= 3.0.2)
66
Imports:

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "DashVtk"
33
uuid = "1b08a953-4be3-4667-9a23-818b1eccd4c7"
44
authors = ["Kitware Inc <[email protected]> and Plotly Technologies <[email protected]>"]
5-
version = "0.0.6"
5+
version = "0.0.7"
66

77
[deps]
88
Dash = "1b08a953-4be3-4667-9a23-3db579824955"

R/internal.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
.dashVtk_js_metadata <- function() {
22
deps_metadata <- list(`dash_vtk` = structure(list(name = "dash_vtk",
3-
version = "0.0.6", src = list(href = NULL,
3+
version = "0.0.7", src = list(href = NULL,
44
file = "deps"), meta = NULL,
55
script = 'dash_vtk.min.js',
66
stylesheet = NULL, head = NULL, attachment = NULL, package = "dashVtk",
77
all_files = FALSE), class = "html_dependency"),
88
`dash_vtk` = structure(list(name = "dash_vtk",
9-
version = "0.0.6", src = list(href = NULL,
9+
version = "0.0.7", src = list(href = NULL,
1010
file = "deps"), meta = NULL,
1111
script = 'dash_vtk.min.js.map',
1212
stylesheet = NULL, head = NULL, attachment = NULL, package = "dashVtk",

R/vtkGeometryRepresentation.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
# AUTO GENERATED FILE - DO NOT EDIT
22

3-
vtkGeometryRepresentation <- function(children=NULL, id=NULL, actor=NULL, mapper=NULL, property=NULL, colorMapPreset=NULL, colorDataRange=NULL) {
3+
vtkGeometryRepresentation <- function(children=NULL, id=NULL, actor=NULL, mapper=NULL, property=NULL, colorMapPreset=NULL, colorDataRange=NULL, showCubeAxes=NULL, cubeAxesStyle=NULL) {
44

5-
props <- list(children=children, id=id, actor=actor, mapper=mapper, property=property, colorMapPreset=colorMapPreset, colorDataRange=colorDataRange)
5+
props <- list(children=children, id=id, actor=actor, mapper=mapper, property=property, colorMapPreset=colorMapPreset, colorDataRange=colorDataRange, showCubeAxes=showCubeAxes, cubeAxesStyle=cubeAxesStyle)
66
if (length(props) > 0) {
77
props <- props[!vapply(props, is.null, logical(1))]
88
}
99
component <- list(
1010
props = props,
1111
type = 'GeometryRepresentation',
1212
namespace = 'dash_vtk',
13-
propNames = c('children', 'id', 'actor', 'mapper', 'property', 'colorMapPreset', 'colorDataRange'),
13+
propNames = c('children', 'id', 'actor', 'mapper', 'property', 'colorMapPreset', 'colorDataRange', 'showCubeAxes', 'cubeAxesStyle'),
1414
package = 'dashVtk'
1515
)
1616

R/vtkView.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
# AUTO GENERATED FILE - DO NOT EDIT
22

3-
vtkView <- function(children=NULL, id=NULL, style=NULL, className=NULL, background=NULL, interactorSettings=NULL, cameraPosition=NULL, cameraViewUp=NULL, cameraParallelProjection=NULL, triggerRender=NULL, triggerResetCamera=NULL) {
3+
vtkView <- function(children=NULL, id=NULL, style=NULL, className=NULL, background=NULL, interactorSettings=NULL, cameraPosition=NULL, cameraViewUp=NULL, cameraParallelProjection=NULL, triggerRender=NULL, triggerResetCamera=NULL, pickingModes=NULL, clickInfo=NULL, hoverInfo=NULL) {
44

5-
props <- list(children=children, id=id, style=style, className=className, background=background, interactorSettings=interactorSettings, cameraPosition=cameraPosition, cameraViewUp=cameraViewUp, cameraParallelProjection=cameraParallelProjection, triggerRender=triggerRender, triggerResetCamera=triggerResetCamera)
5+
props <- list(children=children, id=id, style=style, className=className, background=background, interactorSettings=interactorSettings, cameraPosition=cameraPosition, cameraViewUp=cameraViewUp, cameraParallelProjection=cameraParallelProjection, triggerRender=triggerRender, triggerResetCamera=triggerResetCamera, pickingModes=pickingModes, clickInfo=clickInfo, hoverInfo=hoverInfo)
66
if (length(props) > 0) {
77
props <- props[!vapply(props, is.null, logical(1))]
88
}
99
component <- list(
1010
props = props,
1111
type = 'View',
1212
namespace = 'dash_vtk',
13-
propNames = c('children', 'id', 'style', 'className', 'background', 'interactorSettings', 'cameraPosition', 'cameraViewUp', 'cameraParallelProjection', 'triggerRender', 'triggerResetCamera'),
13+
propNames = c('children', 'id', 'style', 'className', 'background', 'interactorSettings', 'cameraPosition', 'cameraViewUp', 'cameraParallelProjection', 'triggerRender', 'triggerResetCamera', 'pickingModes', 'clickInfo', 'hoverInfo'),
1414
package = 'dashVtk'
1515
)
1616

dash_vtk/GeometryRepresentation.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,17 @@ class GeometryRepresentation(Component):
2020
- mapper (dict; optional): Properties to set to the actor
2121
- property (dict; optional): Properties to set to the actor.property
2222
- colorMapPreset (string; default 'erdc_rainbow_bright'): Preset name for the lookup table color map
23-
- colorDataRange (list of numbers; default [0, 1]): Data range use for the colorMap"""
23+
- colorDataRange (list of numbers; default [0, 1]): Data range use for the colorMap
24+
- showCubeAxes (boolean; optional): Show/Hide Cube Axes for the given representation
25+
- cubeAxesStyle (dict; optional): Configure cube Axes style by overriding the set of properties defined
26+
https://github.com/Kitware/vtk-js/blob/HEAD/Sources/Rendering/Core/CubeAxesActor/index.js#L703-L719"""
2427
@_explicitize_args
25-
def __init__(self, children=None, id=Component.UNDEFINED, actor=Component.UNDEFINED, mapper=Component.UNDEFINED, property=Component.UNDEFINED, colorMapPreset=Component.UNDEFINED, colorDataRange=Component.UNDEFINED, **kwargs):
26-
self._prop_names = ['children', 'id', 'actor', 'mapper', 'property', 'colorMapPreset', 'colorDataRange']
28+
def __init__(self, children=None, id=Component.UNDEFINED, actor=Component.UNDEFINED, mapper=Component.UNDEFINED, property=Component.UNDEFINED, colorMapPreset=Component.UNDEFINED, colorDataRange=Component.UNDEFINED, showCubeAxes=Component.UNDEFINED, cubeAxesStyle=Component.UNDEFINED, **kwargs):
29+
self._prop_names = ['children', 'id', 'actor', 'mapper', 'property', 'colorMapPreset', 'colorDataRange', 'showCubeAxes', 'cubeAxesStyle']
2730
self._type = 'GeometryRepresentation'
2831
self._namespace = 'dash_vtk'
2932
self._valid_wildcard_attributes = []
30-
self.available_properties = ['children', 'id', 'actor', 'mapper', 'property', 'colorMapPreset', 'colorDataRange']
33+
self.available_properties = ['children', 'id', 'actor', 'mapper', 'property', 'colorMapPreset', 'colorDataRange', 'showCubeAxes', 'cubeAxesStyle']
3134
self.available_wildcard_properties = []
3235

3336
_explicit_args = kwargs.pop('_explicit_args')

dash_vtk/View.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,21 @@ class View(Component):
6262
- cameraViewUp (list; default [0, 1, 0]): Initial camera position from an object in [0,0,0]
6363
- cameraParallelProjection (boolean; default False): Use parallel projection (default: false)
6464
- triggerRender (number; default 0): Property use to trigger a render when changing.
65-
- triggerResetCamera (number; default 0): Property use to trigger a resetCamera when changing."""
65+
- triggerResetCamera (number; default 0): Property use to trigger a resetCamera when changing.
66+
- pickingModes (list of strings; optional): List of picking listeners to bind. The supported values are `click` and `hover`. By default it is disabled (empty array).
67+
- clickInfo (dict; optional): Read-only prop. To use this, make sure that `pickingModes` contains `click`.
68+
This prop is updated when an element in the map is clicked. This contains
69+
the picking info describing the object being clicked on.
70+
- hoverInfo (dict; optional): Read-only prop. To use this, make sure that `pickingModes` contains `hover`.
71+
This prop is updated when an element in the map is hovered. This contains
72+
the picking info describing the object being hovered."""
6673
@_explicitize_args
67-
def __init__(self, children=None, id=Component.UNDEFINED, style=Component.UNDEFINED, className=Component.UNDEFINED, background=Component.UNDEFINED, interactorSettings=Component.UNDEFINED, cameraPosition=Component.UNDEFINED, cameraViewUp=Component.UNDEFINED, cameraParallelProjection=Component.UNDEFINED, triggerRender=Component.UNDEFINED, triggerResetCamera=Component.UNDEFINED, **kwargs):
68-
self._prop_names = ['children', 'id', 'style', 'className', 'background', 'interactorSettings', 'cameraPosition', 'cameraViewUp', 'cameraParallelProjection', 'triggerRender', 'triggerResetCamera']
74+
def __init__(self, children=None, id=Component.UNDEFINED, style=Component.UNDEFINED, className=Component.UNDEFINED, background=Component.UNDEFINED, interactorSettings=Component.UNDEFINED, cameraPosition=Component.UNDEFINED, cameraViewUp=Component.UNDEFINED, cameraParallelProjection=Component.UNDEFINED, triggerRender=Component.UNDEFINED, triggerResetCamera=Component.UNDEFINED, pickingModes=Component.UNDEFINED, clickInfo=Component.UNDEFINED, hoverInfo=Component.UNDEFINED, **kwargs):
75+
self._prop_names = ['children', 'id', 'style', 'className', 'background', 'interactorSettings', 'cameraPosition', 'cameraViewUp', 'cameraParallelProjection', 'triggerRender', 'triggerResetCamera', 'pickingModes', 'clickInfo', 'hoverInfo']
6976
self._type = 'View'
7077
self._namespace = 'dash_vtk'
7178
self._valid_wildcard_attributes = []
72-
self.available_properties = ['children', 'id', 'style', 'className', 'background', 'interactorSettings', 'cameraPosition', 'cameraViewUp', 'cameraParallelProjection', 'triggerRender', 'triggerResetCamera']
79+
self.available_properties = ['children', 'id', 'style', 'className', 'background', 'interactorSettings', 'cameraPosition', 'cameraViewUp', 'cameraParallelProjection', 'triggerRender', 'triggerResetCamera', 'pickingModes', 'clickInfo', 'hoverInfo']
7380
self.available_wildcard_properties = []
7481

7582
_explicit_args = kwargs.pop('_explicit_args')

dash_vtk/dash_vtk.min.js

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dash_vtk/dash_vtk.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dash_vtk/metadata.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,20 @@
334334
"computed": false
335335
}
336336
},
337+
"showCubeAxes": {
338+
"type": {
339+
"name": "bool"
340+
},
341+
"required": false,
342+
"description": "Show/Hide Cube Axes for the given representation"
343+
},
344+
"cubeAxesStyle": {
345+
"type": {
346+
"name": "object"
347+
},
348+
"required": false,
349+
"description": "Configure cube Axes style by overriding the set of properties defined\nhttps://github.com/Kitware/vtk-js/blob/HEAD/Sources/Rendering/Core/CubeAxesActor/index.js#L703-L719"
350+
},
337351
"children": {
338352
"type": {
339353
"name": "union",
@@ -1169,6 +1183,30 @@
11691183
"computed": false
11701184
}
11711185
},
1186+
"pickingModes": {
1187+
"type": {
1188+
"name": "arrayOf",
1189+
"value": {
1190+
"name": "string"
1191+
}
1192+
},
1193+
"required": false,
1194+
"description": "List of picking listeners to bind. The supported values are `click` and `hover`. By default it is disabled (empty array)."
1195+
},
1196+
"clickInfo": {
1197+
"type": {
1198+
"name": "object"
1199+
},
1200+
"required": false,
1201+
"description": "Read-only prop. To use this, make sure that `pickingModes` contains `click`.\nThis prop is updated when an element in the map is clicked. This contains\nthe picking info describing the object being clicked on."
1202+
},
1203+
"hoverInfo": {
1204+
"type": {
1205+
"name": "object"
1206+
},
1207+
"required": false,
1208+
"description": "Read-only prop. To use this, make sure that `pickingModes` contains `hover`.\nThis prop is updated when an element in the map is hovered. This contains\nthe picking info describing the object being hovered."
1209+
},
11721210
"children": {
11731211
"type": {
11741212
"name": "union",

0 commit comments

Comments
 (0)