You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

105 lines
2.8 KiB
TypeScript

/*
* @Author: donghao donghao@supervision.ltd
* @Date: 2024-08-14 11:26:47
* @LastEditors: donghao donghao@supervision.ltd
* @LastEditTime: 2024-08-22 11:25:32
* @FilePath: \General-AI-Platform-Web-Client\src\views\deviceSetting\hooks\usePointObject.ts
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
export const usePointObject = () => {
function getPointObject(record, objectOptions) {
const { width, height } = objectOptions;
const { picture } = record;
// TODO: 获取点位对象
return JSON.stringify({
version: "5.3.0",
objects: [
{
type: "rect",
version: "5.3.0",
originX: "left",
originY: "top",
left: 0,
top: 0,
width: width,
height: height,
fill: "", // rgba(21, 77, 221, 0.1)
stroke: null,
strokeWidth: 0,
strokeDashArray: null,
strokeLineCap: "butt",
strokeDashOffset: 0,
strokeLineJoin: "miter",
strokeUniform: false,
strokeMiterLimit: 4,
scaleX: 1,
scaleY: 1,
angle: 0,
flipX: false,
flipY: false,
opacity: 1,
shadow: null,
visible: true,
backgroundColor: "",
fillRule: "nonzero",
paintFirst: "fill",
globalCompositeOperation: "source-over",
skewX: 0,
skewY: 0,
rx: 0,
ry: 0,
id: "workspace",
selectable: false,
hasControls: false,
selection: false
},
{
type: "image",
version: "5.3.0",
// originX: "left",
// originY: "top",
// left: 0,
// top: 0,
fill: "rgb(0,0,0)",
stroke: null,
strokeWidth: 0,
strokeDashArray: null,
strokeLineCap: "butt",
strokeDashOffset: 0,
strokeLineJoin: "miter",
strokeUniform: false,
strokeMiterLimit: 4,
scaleX: 1,
scaleY: 1,
angle: 0,
flipX: false,
flipY: false,
opacity: 1,
shadow: null,
visible: true,
backgroundColor: "",
fillRule: "nonzero",
paintFirst: "fill",
globalCompositeOperation: "source-over",
skewX: 0,
skewY: 0,
cropX: 0,
cropY: 0,
id: "a3ab29c6-7008-49fe-abf3-edc9a47cd460",
selectable: false,
hasControls: false,
selection: false,
evented: false,
crossOrigin: null,
src: picture,
filters: []
}
]
});
}
return {
getPointObject
};
};