|
@@ -256,6 +256,7 @@ export default {
|
|
e.preventDefault()
|
|
e.preventDefault()
|
|
|
|
|
|
const style = {...this.defaultStyle}
|
|
const style = {...this.defaultStyle}
|
|
|
|
+ console.log('style >', style)
|
|
|
|
|
|
// 组件宽高比
|
|
// 组件宽高比
|
|
const proportion = style.width / style.height
|
|
const proportion = style.width / style.height
|
|
@@ -284,13 +285,12 @@ export default {
|
|
e.target.offsetHeight / this.scale / 2
|
|
e.target.offsetHeight / this.scale / 2
|
|
)
|
|
)
|
|
}
|
|
}
|
|
-
|
|
|
|
// 获取对称点的坐标
|
|
// 获取对称点的坐标
|
|
const symmetricPoint = {
|
|
const symmetricPoint = {
|
|
x: center.x - (curPoint.x - center.x),
|
|
x: center.x - (curPoint.x - center.x),
|
|
y: center.y - (curPoint.y - center.y)
|
|
y: center.y - (curPoint.y - center.y)
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ console.log('symmetricPoint >>', symmetricPoint)
|
|
// 是否需要保存快照
|
|
// 是否需要保存快照
|
|
let needSave = false
|
|
let needSave = false
|
|
let isFirst = true
|
|
let isFirst = true
|
|
@@ -308,6 +308,7 @@ export default {
|
|
x: (moveEvent.clientX - Math.round(editorRectInfo.left)) / this.scale,
|
|
x: (moveEvent.clientX - Math.round(editorRectInfo.left)) / this.scale,
|
|
y: (moveEvent.clientY - Math.round(editorRectInfo.top)) / this.scale
|
|
y: (moveEvent.clientY - Math.round(editorRectInfo.top)) / this.scale
|
|
}
|
|
}
|
|
|
|
+ console.log('curPosition >>', curPosition)
|
|
calculateComponentPositionAndSize(
|
|
calculateComponentPositionAndSize(
|
|
point,
|
|
point,
|
|
style,
|
|
style,
|
|
@@ -350,7 +351,6 @@ export default {
|
|
handleMouseDownOnShape(event) {
|
|
handleMouseDownOnShape(event) {
|
|
this.$nextTick(() => eventBus.emit('componentClick'))
|
|
this.$nextTick(() => eventBus.emit('componentClick'))
|
|
const elementRect = event.target.getBoundingClientRect();
|
|
const elementRect = event.target.getBoundingClientRect();
|
|
- console.log('>>> ', {top: elementRect.top, left: elementRect.right})
|
|
|
|
EditorUtils.showEditorMenu(elementRect)
|
|
EditorUtils.showEditorMenu(elementRect)
|
|
globalStore().setInEditorStatus(true)
|
|
globalStore().setInEditorStatus(true)
|
|
globalStore().setClickComponentStatus(true)
|
|
globalStore().setClickComponentStatus(true)
|
|
@@ -383,6 +383,7 @@ export default {
|
|
let hasMove = false
|
|
let hasMove = false
|
|
const move = (moveEvent) => {
|
|
const move = (moveEvent) => {
|
|
hasMove = true
|
|
hasMove = true
|
|
|
|
+ EditorUtils.hideEditorMenu()
|
|
const curX = moveEvent.clientX
|
|
const curX = moveEvent.clientX
|
|
const curY = moveEvent.clientY
|
|
const curY = moveEvent.clientY
|
|
const editorRectInfo = this.editor
|
|
const editorRectInfo = this.editor
|
|
@@ -390,6 +391,7 @@ export default {
|
|
Math.max(0, (curY - startY) / this.scale + startTop),
|
|
Math.max(0, (curY - startY) / this.scale + startTop),
|
|
editorRectInfo.offsetHeight - adjuster.offsetHeight
|
|
editorRectInfo.offsetHeight - adjuster.offsetHeight
|
|
)
|
|
)
|
|
|
|
+ console.log(' ===>>>> ', curY, startY, startTop, editorRectInfo.offsetHeight, adjuster.offsetHeight, pos.top)
|
|
pos.left = Math.min(
|
|
pos.left = Math.min(
|
|
Math.max(0, (curX - startX) / this.scale + startLeft),
|
|
Math.max(0, (curX - startX) / this.scale + startLeft),
|
|
editorRectInfo.offsetWidth - adjuster.offsetWidth
|
|
editorRectInfo.offsetWidth - adjuster.offsetWidth
|
|
@@ -403,7 +405,6 @@ export default {
|
|
// 后面两个参数代表鼠标移动方向
|
|
// 后面两个参数代表鼠标移动方向
|
|
// curY - startY > 0 true 表示向下移动 false 表示向上移动
|
|
// curY - startY > 0 true 表示向下移动 false 表示向上移动
|
|
// curX - startX > 0 true 表示向右移动 false 表示向左移动
|
|
// curX - startX > 0 true 表示向右移动 false 表示向左移动
|
|
- console.log('curX, curY', curX, curY)
|
|
|
|
eventBus.emit('move', {
|
|
eventBus.emit('move', {
|
|
isDownward: curY - startY > 0,
|
|
isDownward: curY - startY > 0,
|
|
isRightward: curX - startX > 0,
|
|
isRightward: curX - startX > 0,
|
|
@@ -419,6 +420,8 @@ export default {
|
|
eventBus.emit('unmove')
|
|
eventBus.emit('unmove')
|
|
document.removeEventListener('mousemove', move)
|
|
document.removeEventListener('mousemove', move)
|
|
document.removeEventListener('mouseup', up)
|
|
document.removeEventListener('mouseup', up)
|
|
|
|
+ const elementRect = e.target.getBoundingClientRect();
|
|
|
|
+ EditorUtils.showEditorMenu(elementRect)
|
|
}
|
|
}
|
|
|
|
|
|
document.addEventListener('mousemove', move)
|
|
document.addEventListener('mousemove', move)
|