曲线的实际控制点
This commit is contained in:
parent
cea8361905
commit
d131ecece5
@ -598,6 +598,7 @@ const initWebsocket = () => {
|
||||
requestAnimationFrame(() => {
|
||||
let data = JSON.parse(jsonMsg.content)
|
||||
// console.log(data)
|
||||
// console.log(dayjs().format('HH:mm:ss SSS'))
|
||||
|
||||
let dataList = Object.entries(data).map(([key, value]) => ({
|
||||
macAddress: key,
|
||||
@ -652,7 +653,7 @@ const initWebsocket = () => {
|
||||
|
||||
const throttledUpdateCarList = throttle((currentList, newDataList, mapInfo) => {
|
||||
return updateCarList(currentList, newDataList, mapInfo)
|
||||
}, 100) // 100ms 节流
|
||||
}, 300) // 100ms 节流
|
||||
|
||||
// 优化车辆数据合并逻辑
|
||||
const mergeArraysWithoutDelete = (arr1, arr2) => {
|
||||
|
@ -4738,13 +4738,34 @@ function getRightAngleControlPoints(direction, start, end) {
|
||||
function setCurveRightAngle(direction) {
|
||||
const curve = state.curveContextMenu.currentCurve
|
||||
if (!curve) return
|
||||
const start = { x: curve.startPointX, y: curve.startPointY }
|
||||
const end = { x: curve.endPointX, y: curve.endPointY }
|
||||
const { beginControl, endControl } = getRightAngleControlPoints(direction, start, end)
|
||||
curve.beginControlX = beginControl.x
|
||||
curve.beginControlY = beginControl.y
|
||||
curve.endControlX = endControl.x
|
||||
curve.endControlY = endControl.y
|
||||
|
||||
// 计算控制点
|
||||
const startPoint = { x: curve.startPointX, y: curve.startPointY }
|
||||
const endPoint = { x: curve.endPointX, y: curve.endPointY }
|
||||
const { beginControl, endControl } = getRightAngleControlPoints(direction, startPoint, endPoint)
|
||||
|
||||
// 更新控制点坐标
|
||||
Object.assign(curve, {
|
||||
beginControlX: beginControl.x,
|
||||
beginControlY: beginControl.y,
|
||||
endControlX: endControl.x,
|
||||
endControlY: endControl.y
|
||||
})
|
||||
|
||||
// 计算实际控制点位置
|
||||
const [beginActual, endActual] = [
|
||||
disposeEventPoint(curve.beginControlX, curve.beginControlY),
|
||||
disposeEventPoint(curve.endControlX, curve.endControlY)
|
||||
]
|
||||
|
||||
// 更新实际控制点坐标
|
||||
Object.assign(curve, {
|
||||
actualBeginControlX: beginActual.actualLocationX,
|
||||
actualBeginControlY: beginActual.actualLocationY,
|
||||
actualEndControlX: endActual.actualLocationX,
|
||||
actualEndControlY: endActual.actualLocationY
|
||||
})
|
||||
|
||||
curve.method = 1
|
||||
hideCurveContextMenu()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user