summaryrefslogtreecommitdiff
path: root/frontend/site/viewer/viewer.container.js
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2021-03-17 19:15:36 +0100
committerJules Laplace <julescarbon@gmail.com>2021-03-17 19:15:36 +0100
commit31776745681b8a7d03d53b9c7d227762336e6fdf (patch)
treed90148da2d673fd3f8f11c5d8448103bb9368b60 /frontend/site/viewer/viewer.container.js
parentd9fc65fe05f534691597586f25a2f168364ae1cf (diff)
play audio on click and navigate when finished
Diffstat (limited to 'frontend/site/viewer/viewer.container.js')
-rw-r--r--frontend/site/viewer/viewer.container.js37
1 files changed, 23 insertions, 14 deletions
diff --git a/frontend/site/viewer/viewer.container.js b/frontend/site/viewer/viewer.container.js
index 314d243..1c8be43 100644
--- a/frontend/site/viewer/viewer.container.js
+++ b/frontend/site/viewer/viewer.container.js
@@ -38,15 +38,6 @@ class ViewerContainer extends Component {
actions.site.interact()
}
- handleResize() {
- this.setState({
- bounds: {
- width: window.innerWidth,
- height: window.innerHeight,
- }
- })
- }
-
load() {
const { graph_name, page_name } = this.props.match.params
const page_path = ["", graph_name, page_name].join('/')
@@ -61,12 +52,30 @@ class ViewerContainer extends Component {
}
}
+ handleResize() {
+ this.setState({
+ bounds: {
+ width: window.innerWidth,
+ height: window.innerHeight,
+ }
+ })
+ }
+
handleMouseDown(e, tile) {
- console.log(tile)
- if (tile.href.indexOf('http') === 0) {
- window.location.href = tile.href
- } else {
- history.push(tile.href)
+ if (tile.href) {
+ if (tile.href.indexOf('http') === 0) {
+ window.location.href = tile.href
+ return
+ }
+ else if (!tile.settings.navigate_when_audio_finishes) {
+ history.push(tile.href)
+ }
+ }
+ if (tile.settings.audio_on_click_id > 0) {
+ this.props.audio.player.playTile({
+ type: "click",
+ tile,
+ })
}
}