Commit 2edf118c authored by anton's avatar anton

Fix grid metadata handling

parent bf99c133
......@@ -169,7 +169,6 @@
import Cell from './Cell'
import { userHasFeature } from 'mbjs-quasar/src/lib'
import { mapGetters } from 'vuex'
import constants from 'mbjs-data-models/src/constants'
import CellEditor from './CellEditor'
import CellHandler from './CellHandler'
......@@ -477,8 +476,8 @@
moveHandler = this.cellHandler.move,
resizeHandler = this.cellHandler.resize,
tempCell = this.tempCell,
gridRows = this.grid.config.rows,
gridColumns = this.grid.config.columns
gridRows = this.data.configuration.rows,
gridColumns = this.data.configuration.columns
if (obj.isFirst) {
moveHandler.pushed = true
......@@ -734,7 +733,7 @@
if (annotation) {
let
parsed = annotation.target.selector.parse(),
target = this.grid.get2DArea([x, y], parsed.xywh.slice(2))
target = this.data.grid.get2DArea([x, y], parsed.xywh.slice(2))
annotation.target.selector.value = target.selector.value
await this.$store.dispatch('annotations/patch', [annotation.id, {
......@@ -761,32 +760,6 @@
//
// DATA
//
async fetchData () {
if (this.gridUuid) {
this.grid = await this.$store.dispatch('maps/get', this.gridUuid)
console.debug('Grid loaded', this.grid)
if (!this.grid.configuration.value && !this.grid.configuration.id) {
this.grid.configuration.value = {
columns: 10,
rows: 6,
ratio: 16 / 9.0
}
console.debug('Grid configuration initialised with', this.grid.configuration._value)
await this.$store.dispatch('mosys/updateGridMetadataStore', [this.data.grid, this.data.configuration])
}
this.updateGridDimensions()
const
query = {
'target.id': this.grid.id,
'body.purpose': 'linking',
'body.type': `${constants.BASE_URI_TERMS}Cell`
},
{ items } = await this.$store.dispatch('annotations/find', query)
console.debug('annotations query', query)
this.annotations = items
}
},
updateSelectedCells () {
const _this = this
let selectedCells = Object.keys(this.annotationUIStates).filter(k => {
......@@ -833,7 +806,7 @@
let
tempCell = this.tempCell,
annotation = this.annotations.find(a => a.id === cachedNewCell.id),
target = this.grid.get2DArea([tempCell.x, tempCell.y], [tempCell.width, tempCell.height])
target = this.data.grid.get2DArea([tempCell.x, tempCell.y], [tempCell.width, tempCell.height])
const
{ data, config, component } = cachedNewCell,
cell = await this.$store.dispatch('cells/post', { data, config, component })
......@@ -937,7 +910,7 @@
}])
}
}
this.grid.configuration.columns = Math.max(1, this.grid.configuration.columns - 1)
this.data.configuration.columns = Math.max(1, this.data.configuration.columns - 1)
await this.$store.dispatch('mosys/updateGridMetadataStore', [this.data.grid, this.data.configuration])
},
async handleGridContextMenuInsertRowAbove () {
......@@ -952,7 +925,7 @@
}])
}
}
this.grid.configuration.rows++
this.data.configuration.rows++
await this.$store.dispatch('mosys/updateGridMetadataStore', [this.data.grid, this.data.configuration])
},
async handleGridContextMenuDeleteRow () {
......@@ -1036,6 +1009,8 @@
getCellStyle (obj) {
let x, y, w, h
console.log('cell', obj)
// ----- existing cell
if (obj.id) {
const parsed = obj.target.selector._value
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment