import { fabric } from 'fabric'; export function getRandomPosition() { return 100 + Math.floor(Math.random() * 30); } /** 根据camera位置得到fav icon的位置 */ export function getFavPositionByCamera(target?: fabric.Object | null) { if (!target || !target.oCoords) return null; return { left: target.oCoords?.tr.x, top: target.oCoords?.tr.y }; } export function createSelectedPositionHash(target) { if (!target) return ''; return ( target.cameraId + String(target.oCoords.tr.x) + '_' + String(target.oCoords.tr.y) + '_' + String(target.angle) ); }