Commit 3cab2044 authored by anton's avatar anton

Fix grid display

parent f1fd8e44
Pipeline #29592 passed with stage
in 5 minutes and 12 seconds
......@@ -3,7 +3,7 @@
div.cell-grid-container(ref="gridContainer", @scroll="onScroll")
q-window-resize-observable(@resize="updateGridDimensions")
div.cell-grid(:style="gridStyle")
template(v-for="(annotation, index) in annotations")
template(v-for="(annotation, index) in data.annotations")
.cell-item(:style="getAnnotationStyle(annotation)")
cell(:annotation="annotation", display="display")
......@@ -75,10 +75,10 @@
if (this.$route.query.x) this.$router.push({ query: {} })
},
async loadGrid (uuid) {
this.grid = await this.$store.dispatch('maps/get', uuid)
if (this.grid.stylesheet) {
if (this.grid.stylesheet.id) {
let stylesheetURL = this.grid.stylesheet.id
this.data = await this.$store.dispatch('mosys/getGrid', uuid)
if (this.data.grid.stylesheet) {
if (this.data.grid.stylesheet.id) {
let stylesheetURL = this.data.grid.stylesheet.id
if (stylesheetURL.indexOf(process.env.STORAGE_HOST) === 0) {
if (localStorage.getItem('access_token')) {
stylesheetURL += stylesheetURL.indexOf('?') > -1 ? '&' : '?'
......@@ -87,19 +87,12 @@
}
this.stylesheetUrl = stylesheetURL
}
else if (this.grid.stylesheet.value) {
this.styles = [this.grid.stylesheet.value]
else if (this.data.grid.stylesheet.value) {
this.styles = [this.data.grid.stylesheet.value]
}
}
this.updateGridDimensions()
const { items } = await this.$store.dispatch('annotations/find', {
'body.type': 'Cell',
'body.purpose': 'linking',
'target.id': this.grid.id
})
this.annotations = items
if (this.$route.query.x) this.scrollToGridCoordinates(parseInt(this.$route.query.x))
else this.scrollToGridCoordinates(0)
if (this.$route.query.datetime) this.broadcastDateTime(this.$route.query.datetime)
......@@ -115,16 +108,16 @@
this.$root.$emit('grid-datetime', datetime)
},
updateGridDimensions (size) {
if (!this.grid) return
if (!this.data.grid) return
let elWidth = size ? size.width : this.$el.offsetWidth
// let elHeight = size ? size.height : this.$el.offsetHeight
let cellSizeRatio = this.grid.config.ratio
let cellSizeRatio = this.data.grid.config.ratio
// let gridHeight = elHeight
let gridHeight = this.$el.offsetHeight
let cellHeight = gridHeight / this.grid.config.rows
let cellHeight = gridHeight / this.data.grid.config.rows
let cellWidth = elWidth / Math.round(elWidth / (cellHeight * cellSizeRatio))
let gridWidth = cellWidth * this.grid.config.columns
let gridWidth = cellWidth * this.data.grid.config.columns
let cellsPerWidth = elWidth / cellWidth
// let cellWidthMini = elWidth / this.grid.config.columns
// let gridHeightMini = cellWidthMini / cellSizeRatio
......@@ -175,7 +168,7 @@
*/
},
getAnnotationStyle (annotation) {
const parsed = annotation.target.selector.parse()
const parsed = annotation.target.selector._value
return {
'grid-column-start': parsed.xywh[0],
'grid-column-end': `span ${parsed.xywh[2]}`,
......
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