New eslint rules auto fix (#3058)

* no-implicit-coercion and no-unneeded-ternary

* End every line with a semicolon

* Spacing and formatting

* Enabled semi-spacing

* Applies npm run lint:fix to code after master merge

* Fix merge issues

* Switched operator-linebreak to 'before'

Co-authored-by: Joshi <simplyrender@gmail.com>
This commit is contained in:
Andrew Henry
2020-07-31 12:11:03 -07:00
committed by GitHub
parent 573a63d359
commit a09da30768
739 changed files with 4660 additions and 2339 deletions

View File

@ -129,6 +129,7 @@ export default {
computed: {
showFrameEdit() {
let layoutItem = this.selection.length > 0 && this.selection[0][0].context.layoutItem;
return !this.multiSelect && layoutItem && layoutItem.id === this.item.id;
},
position() {
@ -136,13 +137,20 @@ export default {
if (this.dragging && this.dragPosition) {
({x, y, x2, y2} = this.dragPosition);
}
return {x, y, x2, y2};
return {
x,
y,
x2,
y2
};
},
stroke() {
if (this.itemStyle) {
if (this.itemStyle.border) {
return this.itemStyle.border.replace('1px solid ', '');
}
return '';
} else {
return this.item.stroke;
@ -154,6 +162,7 @@ export default {
let height = Math.max(this.gridSize[1] * Math.abs(y - y2), 1);
let left = this.gridSize[0] * Math.min(x, x2);
let top = this.gridSize[1] * Math.min(y, y2);
return {
left: `${left}px`,
top: `${top}px`,
@ -172,41 +181,67 @@ export default {
if (x2 === x) {
return 5; // Vertical line
}
if (y2 === y) {
return 6; // Horizontal line
}
if (x2 > x) {
if (y2 < y) {
return 1;
}
return 4;
}
if (y2 < y) {
return 2;
}
return 3;
},
linePosition() {
let pos = {};
switch(this.vectorQuadrant) {
switch (this.vectorQuadrant) {
case 1:
case 3:
// slopes up
pos = {x1: '0%', y1: '100%', x2: '100%', y2: '0%'};
pos = {
x1: '0%',
y1: '100%',
x2: '100%',
y2: '0%'
};
break;
case 5:
// vertical
pos = {x1: '0%', y1: '0%', x2: '0%', y2: '100%'};
pos = {
x1: '0%',
y1: '0%',
x2: '0%',
y2: '100%'
};
break;
case 6:
// horizontal
pos = {x1: '0%', y1: '0%', x2: '100%', y2: '0%'};
pos = {
x1: '0%',
y1: '0%',
x2: '100%',
y2: '0%'
};
break;
default:
// slopes down
pos = {x1: '0%', y1: '0%', x2: '100%', y2: '100%'};
pos = {
x1: '0%',
y1: '0%',
x2: '100%',
y2: '100%'
};
break;
}
return pos;
}
},
@ -238,6 +273,7 @@ export default {
if (this.removeSelectable) {
this.removeSelectable();
}
this.openmct.selection.off('change', this.setSelection);
},
methods: {
@ -247,7 +283,12 @@ export default {
document.body.addEventListener('mouseup', this.endDrag);
this.startPosition = [event.pageX, event.pageY];
let {x, y, x2, y2} = this.item;
this.dragPosition = {x, y, x2, y2};
this.dragPosition = {
x,
y,
x2,
y2
};
if (x === x2 || y === y2) {
if (y > y2 || x < x2) {
if (this.dragging === 'start') {
@ -257,6 +298,7 @@ export default {
}
}
}
event.preventDefault();
},
continueDrag(event) {
@ -282,8 +324,14 @@ export default {
if (!this.dragging) {
this.$emit('endMove');
} else {
this.$emit('endLineResize', this.item, {x, y, x2, y2});
this.$emit('endLineResize', this.item, {
x,
y,
x2,
y2
});
}
this.dragPosition = undefined;
this.dragging = undefined;
event.preventDefault();
@ -292,7 +340,12 @@ export default {
let gridDeltaX = Math.round(pxDeltaX / this.gridSize[0]);
let gridDeltaY = Math.round(pxDeltaY / this.gridSize[1]);
let {x, y, x2, y2} = this.item;
let dragPosition = {x, y, x2, y2};
let dragPosition = {
x,
y,
x2,
y2
};
if (this.dragging === 'start') {
dragPosition.x -= gridDeltaX;
@ -307,6 +360,7 @@ export default {
dragPosition.x2 -= gridDeltaX;
dragPosition.y2 -= gridDeltaY;
}
return dragPosition;
},
setSelection(selection) {
@ -318,5 +372,5 @@ export default {
});
}
}
}
};
</script>