|
4 | 4 |
|
5 | 5 | import dash |
6 | 6 | import dash_bootstrap_components as dbc |
| 7 | +from dash_bootstrap_components._components.Col import Col |
7 | 8 | import dash_html_components as html |
8 | 9 | import dash_core_components as dcc |
9 | 10 |
|
10 | 11 | from dash.dependencies import Input, Output, State |
| 12 | +from dash_html_components.Br import Br |
11 | 13 |
|
12 | 14 | import dash_vtk |
13 | 15 | from dash_vtk.utils import to_mesh_state, preset_as_options |
@@ -173,16 +175,60 @@ def cache_mesh(filepath, di, fieldname=None, point_arrays=[], cell_arrays=[]): |
173 | 175 | ), |
174 | 176 | ] |
175 | 177 | ), |
| 178 | + html.Br(), |
| 179 | + dbc.Alert( |
| 180 | + "Please click on the vehicle to display the cones", |
| 181 | + color="info", |
| 182 | + dismissable=True, |
| 183 | + ), |
176 | 184 | ] |
177 | 185 |
|
| 186 | +external_buttons = html.Div( |
| 187 | + [ |
| 188 | + html.A( |
| 189 | + dbc.Button( |
| 190 | + "Enterprise Demo", color="primary", size="md", className="mr-1", |
| 191 | + ), |
| 192 | + href="https://plotly.com/get-demo/", |
| 193 | + target="_blank", |
| 194 | + ), |
| 195 | + html.A( |
| 196 | + dbc.Button("Source Code", size="md", className="mr-1", color="secondary",), |
| 197 | + href="https://github.com/plotly/dash-sample-apps/tree/main/apps/dash-vehicle-geometry", |
| 198 | + target="_blank", |
| 199 | + ), |
| 200 | + html.A( |
| 201 | + html.Img( |
| 202 | + src=app.get_asset_url("dash-logo.png"), |
| 203 | + alt="MIT Logo", |
| 204 | + height="100%", |
| 205 | + style={"margin-left": "15px"}, |
| 206 | + ), |
| 207 | + href="https://plotly.com/dash/", |
| 208 | + target="_blank", |
| 209 | + ), |
| 210 | + ], |
| 211 | + style={"float": "right", "height": "60px", "padding-bottom": "0px",}, |
| 212 | +) |
| 213 | + |
178 | 214 | # ----------------------------------------------------------------------------- |
179 | 215 | # App UI |
180 | 216 | # ----------------------------------------------------------------------------- |
181 | 217 |
|
182 | 218 | app.layout = dbc.Container( |
183 | 219 | fluid=True, |
184 | 220 | children=[ |
185 | | - html.H2("Vehicle Geometry with OpenFOAM"), |
| 221 | + dbc.Row( |
| 222 | + [ |
| 223 | + dbc.Col( |
| 224 | + [html.H2("Vehicle Geometry with OpenFOAM")], |
| 225 | + width=7, |
| 226 | + style={"padding-top": "10px"}, |
| 227 | + ), |
| 228 | + dbc.Col([external_buttons], width=5), |
| 229 | + ], |
| 230 | + style={"margin-bottom": "1px"}, |
| 231 | + ), |
186 | 232 | html.Hr(), |
187 | 233 | dbc.Row( |
188 | 234 | [ |
@@ -246,7 +292,7 @@ def initial_loading(geometry): |
246 | 292 | return dash_vtk.View( |
247 | 293 | id="vtk-view", |
248 | 294 | children=vehicle_vtk + isosurfs_vtk + [cone_pointer, tooltip], |
249 | | - pickingModes=["hover"], |
| 295 | + pickingModes=["click"], |
250 | 296 | ) |
251 | 297 |
|
252 | 298 |
|
@@ -314,7 +360,7 @@ def update_scene(geometry, isosurfaces, surfcolor): |
314 | 360 |
|
315 | 361 | @app.callback( |
316 | 362 | [Output("tooltip", "children"), Output("pointer", "state"),], |
317 | | - [Input("vtk-view", "hoverInfo"),], |
| 363 | + [Input("vtk-view", "clickInfo"),], |
318 | 364 | ) |
319 | 365 | def probe_data(info): |
320 | 366 | cone_state = {"resolution": 12} |
|
0 commit comments