Commit 83852e25 authored by anton's avatar anton

Fix updateGridDimensions

parent 1647efb4
......@@ -292,6 +292,7 @@
return actions
},
gridStyle () {
console.log('DIM', this.gridDimensions)
if (!this.gridDimensions || !this.gridDimensions.full) return {}
// TODO: fix mobile grid editor view
const cell = this.gridDimensions.full.cell
......@@ -999,18 +1000,19 @@
return { x: x, y: y, ox: ox, oy: oy }
},
updateGridDimensions (size) {
if (!this.grid || !this.grid.configuration.value) return
const { grid } = this.data
if (!grid || !grid.configuration.value) return
let elWidth = size ? size.width : this.$el.offsetWidth
// let elHeight = size ? size.height : this.$el.offsetHeight
let cellSizeRatio = this.grid.configuration._value.ratio
let cellSizeRatio = grid.configuration._value.ratio
// let gridHeight = elHeight
let gridHeight = this.$el.offsetHeight
let cellHeight = gridHeight / this.grid.configuration._value.rows
let cellHeight = gridHeight / grid.configuration._value.rows
let cellWidth = elWidth / Math.round(elWidth / (cellHeight * cellSizeRatio))
let gridWidth = cellWidth * this.grid.configuration._value.columns
let gridWidth = cellWidth * grid.configuration._value.columns
let cellsPerWidth = elWidth / cellWidth
let cellWidthMini = elWidth / this.grid.configuration._value.columns
let cellWidthMini = elWidth / grid.configuration._value.columns
let gridHeightMini = cellWidthMini / cellSizeRatio
this.gridDimensions = {
full: {
......@@ -1024,7 +1026,7 @@
},
mini: {
width: elWidth,
height: gridHeightMini * this.grid.configuration._value.rows,
height: gridHeightMini * grid.configuration._value.rows,
cell: {
width: cellWidthMini,
height: gridHeightMini
......
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