fix: group drop problem

This commit is contained in:
IchliebedichZhu 2024-03-07 18:10:32 +00:00
parent 2ed61b03c7
commit 8b9a64adfb
3 changed files with 6 additions and 3 deletions

View File

@ -165,12 +165,12 @@ async function drop(e: MouseEvent) {
}
//
setting = await setWidgetData(type, item, setting)
console.log("setting", setting)
//
const canvasEl = document.getElementById('page-design-canvas')
if (!canvasEl) return
const lostX = e.x - canvasEl.getBoundingClientRect().left
const lostY = e.y - canvasEl.getBoundingClientRect().top
console.log('xy, ',lostX, lostY)
//
if (type === 'group') {
let parent: TParentData = {}
@ -190,7 +190,7 @@ async function drop(e: MouseEvent) {
element.left += (lost ? lostX - half.x : e.layerX - half.x) * (100 / store.getters.dZoom)
element.top += (lost ? lostY - half.y : e.layerY - half.y) * (100 / store.getters.dZoom)
})
store.dispatch('addGroup', item)
store.dispatch('addGroup', componentItem)
// addGroup(item)
}
//

View File

@ -212,9 +212,12 @@ export default defineComponent({
.list {
width: 100%;
padding: 3.1rem 0 0 1rem;
gap: 0px !important;
&__item {
overflow: hidden;
background: #f8fafc;
margin-bottom: 8px;
margin-right: 8px;
}
&__img {
cursor: grab;

View File

@ -178,7 +178,7 @@ async function load(id: number, tempId: number, type: number, cb: () => void) {
const { data: content, title, state, width, height } = await api.home[apiName]({ id: id || tempId, type })
if (content) {
const data = JSON.parse(content)
state.stateBollean = !!state
state.stateBollean = (!!state)
state.title = title
store.commit('setShowMoveable', false) //
// this.$store.commit('setDWidgets', [])