曲线的实际控制点

This commit is contained in:
yyy 2025-07-10 09:37:47 +08:00
parent cea8361905
commit d131ecece5
2 changed files with 30 additions and 8 deletions

View File

@ -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) => {

View File

@ -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()
}