diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2021-04-01 17:30:37 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2021-04-01 17:30:37 +0200 |
| commit | 7e344419330855dbbf10896c39e91b4e6861dd57 (patch) | |
| tree | a8baae6cb875a3e8dad47bc4d8392738445f00fd /frontend/app/views/tile/components/tile.form.js | |
| parent | 5cafa9d43b769e6f60740f59293ddf3588e7b8ad (diff) | |
displaying custom cursors on the frontend
Diffstat (limited to 'frontend/app/views/tile/components/tile.form.js')
| -rw-r--r-- | frontend/app/views/tile/components/tile.form.js | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/frontend/app/views/tile/components/tile.form.js b/frontend/app/views/tile/components/tile.form.js index 372cd1d..b50af2f 100644 --- a/frontend/app/views/tile/components/tile.form.js +++ b/frontend/app/views/tile/components/tile.form.js @@ -54,6 +54,7 @@ class TileForm extends Component { modified: false, pageList: [], popupList: [], + cursors: {}, } constructor(props){ @@ -88,7 +89,13 @@ class TileForm extends Component { ...POPUP_LIST_TOP_OPTIONS, ...Object.keys(page.editor.popups).map(popup_group => ({ name: popup_group, label: popup_group })) ] - this.setState({ pageList, popupList }) + let cursors = this.props.graph.show.res.uploads + .filter(upload => upload.tag === 'cursor') + .reduce((a,b) => { + a[b.id] = b + return a + }, {}) + this.setState({ pageList, popupList, cursors }) if (isNew) { const newTile = TILE_CONSTRUCTORS.image({ id: "new", @@ -110,6 +117,10 @@ class TileForm extends Component { errorFields: new Set([]), }) } + if (this.props.page.editor.pickedCursor !== prevProps.page.editor.pickedCursor) { + console.log("cursor >>", this.props.page.editor.pickedCursor.id) + this.handleSettingsSelect('custom_cursor_id', this.props.page.editor.pickedCursor.id) + } } componentWillUnmount() { @@ -175,6 +186,9 @@ class TileForm extends Component { [name]: value, } }) + if (name === 'cursor' && value === 'custom') { + this.props.pageActions.toggleCursorList(true) + } } handleAlignment(name, value) { @@ -315,6 +329,7 @@ class TileForm extends Component { <TileHyperlinkForm tile={temporaryTile} errorFields={errorFields} parent={this} pageList={this.state.pageList} popupList={this.state.popupList} + cursors={this.state.cursors} /> <TileMiscForm tile={temporaryTile} errorFields={errorFields} parent={this} /> <TileSoundForm tile={temporaryTile} errorFields={errorFields} parent={this} /> |
