style: 格式化代,修改单词错误

This commit is contained in:
奔跑的面条 2022-08-30 17:28:21 +08:00
parent 31f67232ae
commit f0e860f306
4 changed files with 18 additions and 15 deletions

View File

@ -104,5 +104,5 @@ export class PublicGroupConfigClass extends publicConfig implements CreateCompon
// 标识 // 标识
public id = getUUID() public id = getUUID()
// 基本信息 // 基本信息
public attr = { w: 0, h: 0, x: 0, y: 0, zIndex: -1 } public attr = { w: 0, h: 0, x: 0, y: 0, offsetX: 0, offsetY: 0, zIndex: -1 }
} }

View File

@ -25,7 +25,10 @@ export const chartInitConfig = {
x: 50, x: 50,
y: 50, y: 50,
w: 500, w: 500,
h: 300 h: 300,
// 不建议动 offset
offsetX: 0,
offsetY: 0,
} }
// dialog 图标的大小 // dialog 图标的大小

View File

@ -314,16 +314,16 @@ export const useChartEditStore = defineStore({
} }
}, },
// * 重置组件位置 // * 重置组件位置
resetComponentPostion(item: CreateComponentType | CreateComponentGroupType, isForward: boolean):void{ resetComponentPosition(item: CreateComponentType | CreateComponentGroupType, isForward: boolean): void {
const index = this.fetchTargetIndex(item.id) const index = this.fetchTargetIndex(item.id)
if(index > -1){ if (index > -1) {
const componentInstance = this.getComponentList[index] const componentInstance = this.getComponentList[index]
if(isForward){ if (isForward) {
componentInstance.attr = Object.assign(componentInstance.attr, { componentInstance.attr = Object.assign(componentInstance.attr, {
x: item.attr.x + item.attr.offsetX, x: item.attr.x + item.attr.offsetX,
y: item.attr.y + item.attr.offsetY y: item.attr.y + item.attr.offsetY
}) })
}else{ } else {
componentInstance.attr = Object.assign(componentInstance.attr, { componentInstance.attr = Object.assign(componentInstance.attr, {
x: item.attr.x, x: item.attr.x,
y: item.attr.y y: item.attr.y
@ -332,7 +332,7 @@ export const useChartEditStore = defineStore({
} }
}, },
// * 移动组件 // * 移动组件
moveComponentList(item: CreateComponentType | CreateComponentGroupType){ moveComponentList(item: CreateComponentType | CreateComponentGroupType) {
chartHistoryStore.createMoveHistory([item]) chartHistoryStore.createMoveHistory([item])
}, },
// * 更新组件列表某一项的值 // * 更新组件列表某一项的值
@ -554,9 +554,9 @@ export const useChartEditStore = defineStore({
// 处理移动 // 处理移动
const isMove = HistoryItem.actionType === HistoryActionTypeEnum.MOVE const isMove = HistoryItem.actionType === HistoryActionTypeEnum.MOVE
if(isMove){ if (isMove) {
historyData.forEach(item => { historyData.forEach(item => {
this.resetComponentPostion(item, isForward) this.resetComponentPosition(item, isForward)
}) })
return return
} }
@ -593,12 +593,12 @@ export const useChartEditStore = defineStore({
if (isGroup || isUnGroup) { if (isGroup || isUnGroup) {
if ((isGroup && isForward) || (isUnGroup && !isForward)) { if ((isGroup && isForward) || (isUnGroup && !isForward)) {
const ids: string[] = [] const ids: string[] = []
if(historyData.length > 1) { if (historyData.length > 1) {
historyData.forEach(item => { historyData.forEach(item => {
ids.push(item.id) ids.push(item.id)
}) })
} else { } else {
(historyData[0] as CreateComponentGroupType).groupList.forEach(item => { ;(historyData[0] as CreateComponentGroupType).groupList.forEach(item => {
ids.push(item.id) ids.push(item.id)
}) })
} }
@ -606,7 +606,7 @@ export const useChartEditStore = defineStore({
return return
} }
// 都需使用子组件的id去解组 // 都需使用子组件的id去解组
if(historyData.length > 1) { if (historyData.length > 1) {
this.setUnGroup([(historyData[0] as CreateComponentType).id], undefined, false) this.setUnGroup([(historyData[0] as CreateComponentType).id], undefined, false)
} else { } else {
this.setUnGroup([(historyData[0] as CreateComponentGroupType).groupList[0].id], undefined, false) this.setUnGroup([(historyData[0] as CreateComponentGroupType).groupList[0].id], undefined, false)

View File

@ -111,7 +111,7 @@ export const mousedownBoxSelect = (e: MouseEvent, item?: CreateComponentType | C
selectAttr.x1 = Math.round(startOffsetX - (startScreenX - moveEvent.screenX) / scale) selectAttr.x1 = Math.round(startOffsetX - (startScreenX - moveEvent.screenX) / scale)
selectAttr.y1 = startOffsetY selectAttr.y1 = startOffsetY
selectAttr.x2 = startOffsetX selectAttr.x2 = startOffsetX
selectAttr.y2 = Math.round(startOffsetY + (moveEvent.screenY - startScreenY ) / scale) selectAttr.y2 = Math.round(startOffsetY + (moveEvent.screenY - startScreenY) / scale)
// 左下方向 // 左下方向
} else { } else {
// 左上方向 // 左上方向
@ -223,7 +223,7 @@ export const useMouseHandle = () => {
const startY = e.screenY const startY = e.screenY
// 记录历史位置 // 记录历史位置
let prevComponentInstance:CreateComponentType | CreateComponentGroupType let prevComponentInstance: CreateComponentType | CreateComponentGroupType
chartEditStore.getTargetChart.selectId.forEach(id => { chartEditStore.getTargetChart.selectId.forEach(id => {
if (!targetMap.has(id)) return if (!targetMap.has(id)) return
@ -278,7 +278,7 @@ export const useMouseHandle = () => {
chartEditStore.setMousePosition(0, 0, 0, 0) chartEditStore.setMousePosition(0, 0, 0, 0)
chartEditStore.setEditCanvas(EditCanvasTypeEnum.IS_DRAG, false) chartEditStore.setEditCanvas(EditCanvasTypeEnum.IS_DRAG, false)
// 加入历史栈 // 加入历史栈
if(prevComponentInstance){ if (prevComponentInstance) {
chartEditStore.getTargetChart.selectId.forEach(id => { chartEditStore.getTargetChart.selectId.forEach(id => {
if (!targetMap.has(id)) return if (!targetMap.has(id)) return
const index = chartEditStore.fetchTargetIndex(id) const index = chartEditStore.fetchTargetIndex(id)