Commit dbcdc88c authored by christianrhansen's avatar christianrhansen

movable cached new cell

parent 4222a404
......@@ -4,17 +4,20 @@
q-window-resize-observable(@resize="updateGridDimensions")
// ------------------------------------------------------------------------------------------------- cached new cell
q-page-sticky.z-top(v-if="newCell", position="top-right")
// ------------------------------------------------------------------------------------------ cached new cell helper
// q-page-sticky.z-top(v-touch-pan="moveCachedCell", v-if="cachedNewCell", position="top-right")
.fixed.z-top(v-touch-pan="moveCachedCell", v-if="cachedNewCell",
:style="{top: touch.position.top - 16 - 16 + 'px', left: touch.position.left - 16 - 16 + 'px'}")
.bg-frosted-glass.text-dark.q-px-md.q-py-sm.q-ma-md.shadow-4
| {{ newCell.type }} Cell:
| {{ cachedNewCell.type }} Cell:
br
| {{ newCell.value }}
| {{ cachedNewCell.value }}
q-btn.bg-dark.text-white.on-right(@click="", round, flat, size="sm")
q-icon(name="clear")
// ------------------------------------------------------------------------------------------------------------ grid
div.cell-grid(
@click="event => {test(event)}",
@dragenter="handleGridDragOver",
@dragover="handleGridDragOver",
@dragleave="handleGridDragEnd",
......@@ -34,6 +37,8 @@
template(v-if="!resizingGrid")
template(v-for="(annotation, index) in annotations")
//----- cell
.cell-item(
v-if="!annotationUIStates[annotation._uuid] || !annotationUIStates[annotation._uuid].beingDragged",
draggable="true",
......@@ -91,6 +96,7 @@
.cell-item.cell-item-tmp(:style="getAnnotationStyle(tmpCell)", :key="`cell-tmp-${index}`")
cell(:cell="tmpCell")
// ---------------------------------------------------------------------------------------------------------------
template(v-else)
.cell-item(:style="getAnnotationStyle({x:0,y:0,width:1,height:1})", key="cell-grid-resizer")
div.cell-item-resize-handle(
......@@ -226,12 +232,13 @@
gridDimensions: { gridWidth: 0, gridHeight: 0, cellWidth: 0, cellHeight: 0 },
contextMenuClickPosition: {},
resizingGrid: false,
mobileSelectedCell: undefined
mobileSelectedCell: undefined,
touch: {position: {top: undefined, left: undefined}}
}
},
computed: {
...mapGetters({
newCell: 'mosys/getNewCell',
cachedNewCell: 'mosys/getNewCell',
user: 'auth/getUserState',
isMobile: 'globalSettings/getIsMobile',
// editingCells: 'mosys/getEditingCells'
......@@ -304,6 +311,22 @@
}
},
methods: {
moveCachedCell (obj) {
// if (obj) console.log(obj.position.top)
this.touch.position = {top: obj.position.top, left: obj.position.left}
console.log(this.touch.position)
},
test (event) {
console.log('--->>>', this.getGridPositionForEvent(event))
this.addMobileCell(event)
},
addMobileCell (event) {
if (this.cachedNewCell) {
console.log('###--- ', this.getGridPositionForEvent(event))
this.$store.commit('mosys/cacheNewCell', undefined)
this.handleGridDrop(event)
}
},
touchMobileCell (event, cell) {
Object.keys(this.annotationUIStates).filter((k) => {
if (k === cell._uuid && this.annotationUIStates[k].editing) console.log(k, cell._uuid)
......@@ -466,6 +489,8 @@
},
async handleGridDrop (event) {
let dropData = event.dataTransfer.getData('text/plain')
console.log('dropData', dropData)
// {"data":{"content":"vvvvvvsdscscdsc"},"config":{},"component":"CellText"}
if (dropData) {
dropData = JSON.parse(dropData)
let annotation = this.annotations.find(a => a.id === dropData.id)
......@@ -520,6 +545,7 @@
this.updateSelectedCells()
},
handleCellDragStart (event, annotation) {
console.log('§§§§§§§§', annotation)
if (!this.annotationUIStates[annotation._uuid].beingResized) {
event.dataTransfer.setData('text/plain', JSON.stringify(annotation))
event.dataTransfer.setDragImage(nullImage, 0, 0)
......
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