fix:修复对齐功能

main
liu.shiyi 1 year ago
parent 08d64cdc12
commit d733f33675

@ -257,13 +257,13 @@ export default {
}) })
// xy // xy
const maxXW = Math.max.apply(Math, activeChartList.map(item => { return item.x + item.w })) const maxXW = Math.max.apply(Math, activeChartList.map(item => { return item.x + item.w }))
const maxYH = Math.max.apply(Math, activeChartList.map(item => { return item.y + item.h }))
let maxX = Math.max.apply(Math, activeChartList.map(item => { return item.x })) let maxX = Math.max.apply(Math, activeChartList.map(item => { return item.x }))
let maxY = Math.max.apply(Math, activeChartList.map(item => { return item.y }))
const minX = Math.min.apply(Math, activeChartList.map(item => { return item.x })) const minX = Math.min.apply(Math, activeChartList.map(item => { return item.x }))
const maxYH = Math.max.apply(Math, activeChartList.map(item => { return item.y + item.h }))
const maxY = Math.max.apply(Math, activeChartList.map(item => { return item.y }))
const minY = Math.min.apply(Math, activeChartList.map(item => { return item.y })) const minY = Math.min.apply(Math, activeChartList.map(item => { return item.y }))
const centerW = maxXW - minX const centerW = maxXW - minX
const centerH = maxY - minY const centerH = maxYH - minY
switch (command) { switch (command) {
case 'left': case 'left':
activeChartList.forEach((chart) => { activeChartList.forEach((chart) => {
@ -323,6 +323,7 @@ export default {
activeChartList = activeChartList.sort(this.compare('y')) activeChartList = activeChartList.sort(this.compare('y'))
// eslint-disable-next-line no-case-declarations // eslint-disable-next-line no-case-declarations
const minYH = activeChartList[0].y + activeChartList[0].h const minYH = activeChartList[0].y + activeChartList[0].h
maxY = Math.max.apply(Math, activeChartList.map(item => { return item.y }))
// eslint-disable-next-line no-case-declarations // eslint-disable-next-line no-case-declarations
let totalH = 0 let totalH = 0
for (let i = 1; i < activeChartList.length - 1; i++) { for (let i = 1; i < activeChartList.length - 1; i++) {

Loading…
Cancel
Save