设计器快捷调整间距添加日志
This commit is contained in:
parent
1f51ebb7ba
commit
0de36d27d1
@ -72,6 +72,7 @@ Designer.addFunction("selectAll", function(){
|
||||
* 设计器方法:调节垂直间距
|
||||
*/
|
||||
Designer.addFunction("selectVertical", function() {
|
||||
console.log('调节垂直间距')
|
||||
var sublinePos
|
||||
var subline1 = $('#designer_subline1') // 初始位置
|
||||
var subline2 = $('#designer_subline2')
|
||||
@ -120,6 +121,7 @@ Designer.addFunction("selectVertical", function() {
|
||||
cursor: 'move'
|
||||
});
|
||||
container.bind('mousemove.drag',function (e) {
|
||||
console.log('move......')
|
||||
Designer.op.destroy()
|
||||
var newPos = Utils.getRelativePos(e.pageX, e.pageY, canvas);
|
||||
if (newPos.y >= sublinePos) { // 增加
|
||||
@ -164,6 +166,7 @@ Designer.addFunction("selectVertical", function() {
|
||||
} else if (height1 == 0 && height2 != 0) { // 减少
|
||||
moveShapeAndFile('y',sublinePos,0-height2)
|
||||
}
|
||||
console.log('鼠标抬起,完成间距调节')
|
||||
subline1.css({
|
||||
borderColor: '#333',
|
||||
backgroundColor: 'transparent',
|
||||
@ -312,6 +315,7 @@ function filterShapeAndLine(type,sublinePos) {
|
||||
}
|
||||
|
||||
function moveShapeAndFile(type,sublinePos,movedDistance) {
|
||||
console.log('间距调节方法调用')
|
||||
var obj = filterShapeAndLine(type,sublinePos)
|
||||
var movingLines = obj.movingLines
|
||||
var movingShapes = obj.movingShapes
|
||||
@ -587,78 +591,79 @@ function moveLanes(type,sublinePos,movedDistance) {
|
||||
}
|
||||
|
||||
function getCanvasContentEdge() {
|
||||
var pos = {
|
||||
top: 0,
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: 0
|
||||
}
|
||||
var elements = Model.define.elements
|
||||
var xArr = []
|
||||
var yArr = []
|
||||
for (let key in elements) {
|
||||
if (elements[key].points == undefined) { // 形状
|
||||
xArr.push({
|
||||
x: elements[key].props.x,
|
||||
type: 'shape',
|
||||
shapeWidth: elements[key].props.w
|
||||
})
|
||||
yArr.push({
|
||||
y: elements[key].props.y,
|
||||
type: 'shape',
|
||||
shapeHeight: elements[key].props.h
|
||||
})
|
||||
} else {
|
||||
xArr.push({
|
||||
x: elements[key].from.x,
|
||||
type: 'line'
|
||||
})
|
||||
xArr.push({
|
||||
x: elements[key].to.x,
|
||||
type: 'line'
|
||||
})
|
||||
yArr.push({
|
||||
y: elements[key].from.y,
|
||||
type: 'line'
|
||||
})
|
||||
yArr.push({
|
||||
y: elements[key].to.y,
|
||||
type: 'line'
|
||||
})
|
||||
for (let i = 0; i < elements[key].points.length; i++) {
|
||||
xArr.push({
|
||||
x: elements[key].points[i].x,
|
||||
type: 'line'
|
||||
})
|
||||
yArr.push({
|
||||
y: elements[key].points[i].y,
|
||||
type: 'line'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
pos.left = Math.min.apply(Math,xArr.map(item => { return item.x }))
|
||||
pos.top = Math.min.apply(Math,yArr.map(item => { return item.y }))
|
||||
// 特殊处理右和下 若有图形 加上图形的高/宽
|
||||
for (let i = 0; i < xArr.length; i++) {
|
||||
if(xArr[i].type == 'shape') {
|
||||
xArr[i].x += xArr[i].shapeWidth
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < yArr.length; i++) {
|
||||
if(yArr[i].type == 'shape') {
|
||||
yArr[i].y += yArr[i].shapeHeight
|
||||
}
|
||||
}
|
||||
pos.right = Math.max.apply(Math,xArr.map(item => { return item.x }))
|
||||
pos.bottom = Math.max.apply(Math,yArr.map(item => { return item.y }))
|
||||
return pos
|
||||
var pos = {
|
||||
top: 0,
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: 0
|
||||
}
|
||||
var elements = Model.define.elements
|
||||
var xArr = []
|
||||
var yArr = []
|
||||
for (let key in elements) {
|
||||
if (elements[key].points == undefined) { // 形状
|
||||
xArr.push({
|
||||
x: elements[key].props.x,
|
||||
type: 'shape',
|
||||
shapeWidth: elements[key].props.w
|
||||
})
|
||||
yArr.push({
|
||||
y: elements[key].props.y,
|
||||
type: 'shape',
|
||||
shapeHeight: elements[key].props.h
|
||||
})
|
||||
} else {
|
||||
xArr.push({
|
||||
x: elements[key].from.x,
|
||||
type: 'line'
|
||||
})
|
||||
xArr.push({
|
||||
x: elements[key].to.x,
|
||||
type: 'line'
|
||||
})
|
||||
yArr.push({
|
||||
y: elements[key].from.y,
|
||||
type: 'line'
|
||||
})
|
||||
yArr.push({
|
||||
y: elements[key].to.y,
|
||||
type: 'line'
|
||||
})
|
||||
for (let i = 0; i < elements[key].points.length; i++) {
|
||||
xArr.push({
|
||||
x: elements[key].points[i].x,
|
||||
type: 'line'
|
||||
})
|
||||
yArr.push({
|
||||
y: elements[key].points[i].y,
|
||||
type: 'line'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
pos.left = Math.min.apply(Math,xArr.map(item => { return item.x }))
|
||||
pos.top = Math.min.apply(Math,yArr.map(item => { return item.y }))
|
||||
// 特殊处理右和下 若有图形 加上图形的高/宽
|
||||
for (let i = 0; i < xArr.length; i++) {
|
||||
if(xArr[i].type == 'shape') {
|
||||
xArr[i].x += xArr[i].shapeWidth
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < yArr.length; i++) {
|
||||
if(yArr[i].type == 'shape') {
|
||||
yArr[i].y += yArr[i].shapeHeight
|
||||
}
|
||||
}
|
||||
pos.right = Math.max.apply(Math,xArr.map(item => { return item.x }))
|
||||
pos.bottom = Math.max.apply(Math,yArr.map(item => { return item.y }))
|
||||
return pos
|
||||
}
|
||||
|
||||
/**
|
||||
* 设计器方法:调节水平间距
|
||||
*/
|
||||
Designer.addFunction("selectHorizontal", function() {
|
||||
console.log('调节水平间距')
|
||||
var sublinePos
|
||||
var subline1 = $('#designer_subline1') // 初始位置
|
||||
var subline2 = $('#designer_subline2')
|
||||
@ -708,6 +713,7 @@ Designer.addFunction("selectHorizontal", function() {
|
||||
});
|
||||
container.bind('mousemove.drag',function (e) {
|
||||
Designer.op.destroy()
|
||||
console.log('move......')
|
||||
var newPos = Utils.getRelativePos(e.pageX, e.pageY, canvas);
|
||||
if (newPos.x >= sublinePos) { // 增加
|
||||
subline1.css({
|
||||
@ -751,6 +757,7 @@ Designer.addFunction("selectHorizontal", function() {
|
||||
} else if(width1 == 0 && width2 != 0) { // 减少
|
||||
moveShapeAndFile('x',sublinePos,0-width2)
|
||||
}
|
||||
console.log('鼠标抬起,完成间距调节')
|
||||
|
||||
subline1.css({
|
||||
borderColor: '#333',
|
||||
|
||||
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user