mirror of
https://github.com/palxiao/poster-design.git
synced 2025-07-15 16:02:19 +08:00
fix: group drop problem
This commit is contained in:
parent
2ed61b03c7
commit
8b9a64adfb
@ -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)
|
||||
}
|
||||
// 设置坐标
|
||||
|
@ -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;
|
||||
|
@ -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', [])
|
||||
|
Loading…
x
Reference in New Issue
Block a user