From 7e344419330855dbbf10896c39e91b4e6861dd57 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Thu, 1 Apr 2021 17:30:37 +0200 Subject: displaying custom cursors on the frontend --- frontend/app/views/page/components/page.editor.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'frontend/app/views/page/components/page.editor.js') diff --git a/frontend/app/views/page/components/page.editor.js b/frontend/app/views/page/components/page.editor.js index a3e8513..cd61932 100644 --- a/frontend/app/views/page/components/page.editor.js +++ b/frontend/app/views/page/components/page.editor.js @@ -24,6 +24,7 @@ const defaultState = { w: 0, h: 0, }, tile: null, + cursors: {}, } class PageEditor extends Component { @@ -62,7 +63,15 @@ class PageEditor extends Component { document.body.addEventListener('mouseup', this.handleMouseUp) window.addEventListener('resize', this.handleWindowResize) const bounds = this.getBoundingClientRect() - this.setState({ bounds }) + + let cursors = this.props.graph.show.res.uploads + .filter(upload => upload.tag === 'cursor') + .reduce((a,b) => { + a[b.id] = b + return a + }, {}) + + this.setState({ bounds, cursors }) } componentDidUpdate(prevProps) { @@ -196,6 +205,7 @@ class PageEditor extends Component { tile={tile} bounds={this.state.bounds} videoBounds={videoBounds} + cursors={this.state.cursors} box={currentTile && tile.id === currentTile.id && currentBox} onMouseDown={e => this.handleMouseDown(e, tile)} onDoubleClick={e => this.props.pageActions.showEditTileForm(tile.id)} @@ -210,6 +220,7 @@ class PageEditor extends Component { tile={temporaryTile} bounds={this.state.bounds} videoBounds={videoBounds} + cursors={this.state.cursors} box={currentTile && temporaryTile.id === currentTile.id && currentBox} onMouseDown={e => this.handleMouseDown(e, temporaryTile)} onMouseEnter={e => {}} -- cgit v1.2.3-70-g09d2