fix: 新增标尺

This commit is contained in:
MTrun
2022-03-15 17:49:02 +08:00
parent 33b0c94159
commit 0933486e6f
8 changed files with 108 additions and 6 deletions
@@ -3,6 +3,7 @@ import { PickCreateComponentType } from '@/packages/index.d'
type AttrType = PickCreateComponentType<'attr'>
export const useComponentStyle = (attr: AttrType, index: number) => {
if(!attr) return {}
const componentStyle = {
zIndex: index + 1,
left: `${attr.x}px`,
@@ -12,6 +13,7 @@ export const useComponentStyle = (attr: AttrType, index: number) => {
}
export const useSizeStyle = (attr: AttrType, scale?: number) => {
if(!attr) return {}
return {
width: `${scale ? scale * attr.w : attr.w}px`,
height: `${scale ? scale * attr.h : attr.h}px`