diff --git a/src/ui/editor/MakeLine.vue b/src/ui/editor/MakeLine.vue index 9186a75..2368591 100644 --- a/src/ui/editor/MakeLine.vue +++ b/src/ui/editor/MakeLine.vue @@ -52,16 +52,28 @@ export default { }, listenerChange(list, index, cb) { const activeStyle = list[index].style; + const screenWidth = this.$parent.$el.offsetWidth + const screenHeight = this.$parent.$el.offsetHeight // 上边缘 if (Math.abs(activeStyle.top) <= value) { activeStyle.top = 0; cb && cb(list[index], index); } + // 下边缘 + if (Math.abs(activeStyle.top+activeStyle.height - screenHeight) <= value) { + activeStyle.top = screenHeight - activeStyle.height; + cb && cb(list[index], index); + } // 左边缘 if (Math.abs(activeStyle.left) <= value) { activeStyle.left = 0; cb && cb(list[index], index); } + // 右边缘 + if (Math.abs(activeStyle.left+activeStyle.width-screenWidth) <= value) { + activeStyle.left = screenWidth - activeStyle.width; + cb && cb(list[index], index); + } if (list.length==1) { return }