Browse Source

右边缘和下边缘吸附

master
1549469775 4 years ago
parent
commit
a1e0d54c69
  1. 12
      src/ui/editor/MakeLine.vue

12
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
}

Loading…
Cancel
Save