| | |
| | | else { |
| | | adjustedRects1.value = [] |
| | | } |
| | | // 进炉前 |
| | | if (data.waitingGlass && data.waitingGlass.length > 0) { |
| | | const newGlassIds = new Set(data.waitingGlass[0].map(rect => rect.glassId)); |
| | | const existingRects = adjustedRectsa.value.filter(rect => newGlassIds.has(rect.glassId)); |
| | |
| | | else if (data.waitingGlass == null) { |
| | | adjustedRectsa.value = [] |
| | | } |
| | | // 已出炉 |
| | | if (data.outGlass && data.outGlass.length > 0) { |
| | | // 提取新的矩形ID |
| | | const newGlassIds = new Set(data.outGlass[0].map(rect => rect.glassId)); |
| | |
| | | // 计算新的矩形 |
| | | const newRects = data.outGlass[0].map(rect => { |
| | | const scaleFactor = 1390/5190; |
| | | const scaleFactory = 750/2800; |
| | | let adjustedWidth, adjustedHeight, adjustedWidtha, adjustedHeighta,widtha,heighta,newY; |
| | | const scaleFactorY = 750/2800; |
| | | let adjustedWidth, adjustedHeight, adjustedWidtha, adjustedHeighta,widtha,heighta;; |
| | | let newX = rect.yCoordinate; |
| | | if (rect.width < rect.height) { |
| | | widtha = rect.height; |
| | |
| | | } |
| | | if (rect.angle === 0) { |
| | | adjustedWidth = widtha * scaleFactor; |
| | | adjustedHeight = heighta * scaleFactory; |
| | | adjustedHeight = heighta * scaleFactorY; |
| | | // adjustedWidtha = widtha; |
| | | // adjustedHeighta = heighta; |
| | | // newX = 5190 - (rect.yCoordinate + widtha); |
| | | newY = 2800 - (rect.xCoordinate + heighta); |
| | | } else { |
| | | newX = 5190 - (rect.yCoordinate + widtha); |
| | | } else { |
| | | adjustedWidth = heighta * scaleFactor; |
| | | adjustedHeight = widtha * scaleFactory; |
| | | // adjustedWidtha = heighta; |
| | | // adjustedHeighta = widtha; |
| | | // newX = 5190 - (rect.yCoordinate + heighta); |
| | | newY = 2800 - (rect.xCoordinate + widtha); |
| | | adjustedHeight = widtha * scaleFactorY; |
| | | // adjustedWidtha = widtha; |
| | | // adjustedHeighta = heighta; |
| | | newX = 5190 - (rect.yCoordinate + heighta); |
| | | } |
| | | return { |
| | | ...rect, // 复制原始对象的其他属性 |
| | | x: newX * scaleFactor, |
| | | y: newY * scaleFactory, |
| | | width: adjustedWidth, |
| | | height: adjustedHeight, |
| | | widtha: rect.width, |
| | | heighta: rect.height, |
| | | ...rect, |
| | | x: newX * scaleFactor, |
| | | y: rect.xCoordinate * scaleFactorY, |
| | | width: adjustedWidth, |
| | | height: adjustedHeight, |
| | | widtha: rect.width, |
| | | heighta: rect.height, |
| | | } |
| | | }); |
| | | }); |
| | | // const newRects = data.outGlass[0].map(rect => { |
| | | // const scaleFactor = 1390/5190; |
| | | // const scaleFactory = 750/2800; |
| | | // let adjustedWidth, adjustedHeight, adjustedWidtha, adjustedHeighta,widtha,heighta,newY; |
| | | // let newX = rect.yCoordinate; |
| | | // if (rect.width < rect.height) { |
| | | // widtha = rect.height; |
| | | // heighta = rect.width; |
| | | // }else { |
| | | // widtha = rect.width; |
| | | // heighta = rect.height; |
| | | // } |
| | | // if (rect.angle === 0) { |
| | | // adjustedWidth = widtha * scaleFactor; |
| | | // adjustedHeight = heighta * scaleFactory; |
| | | // // adjustedWidtha = widtha; |
| | | // // adjustedHeighta = heighta; |
| | | // // newX = 5190 - (rect.yCoordinate + widtha); |
| | | // newY = 2800 - (rect.xCoordinate + heighta); |
| | | // } else { |
| | | // adjustedWidth = heighta * scaleFactor; |
| | | // adjustedHeight = widtha * scaleFactory; |
| | | // // adjustedWidtha = heighta; |
| | | // // adjustedHeighta = widtha; |
| | | // // newX = 5190 - (rect.yCoordinate + heighta); |
| | | // newY = 2800 - (rect.xCoordinate + widtha); |
| | | // } |
| | | // return { |
| | | // ...rect, // 复制原始对象的其他属性 |
| | | // x: newX * scaleFactor, |
| | | // y: newY * scaleFactory, |
| | | // width: adjustedWidth, |
| | | // height: adjustedHeight, |
| | | // widtha: rect.width, |
| | | // heighta: rect.height, |
| | | // } |
| | | // }); |
| | | |
| | | // 合并新旧矩形,并保留 isActive 状态 |
| | | adjustedRectsb.value = existingRects.map(oldRect => { |