1.0.12 • Published 3 months ago

ce-zrender-render v1.0.12

Weekly downloads
-
License
ISC
Repository
github
Last release
3 months ago

ce-zrender-render

一个cemeta zrender商品图渲染库

安装

pnpm i ce-zrender-render

快速开始

// 导包
import CeZrenderRender from 'ce-zrender-render'
//实例化
const ceZrenderRender = new CeZrenderRender(HTMLElement, currentRenderCanvasConfig, {...options})

// 点击画布内容此函数会被执行
 ceZrenderRender.pubSub.subscribe("group", (group, params) => {
       // ...
    });

API

参数说明

HTMLElement

属性说明类型默认值
HTMLElementdiv标签HTMLDivElement-

currentRenderCanvasConfig

属性说明类型默认值
currentRenderCanvasConfig模版参数类型(IRelativeConfigIFixedConfig )-
  • ⚠️ 这俩个类型来自ce-zrender-render/dist/zrenderOptions包下
    import { IRelativeConfig,IFixedConfig } from 'ce-zrender-render/dist/zrenderOptions';

options

属性说明类型默认值
globalStandardLineStatus是否显示引导线booleantrue
globalMousewheelStatus是否允许画布内容通过滚动鼠标进行缩放booleantrue
globalZStatus点击画布内容是否增加z层级booleanfalse
renderPosition渲染画布内容方式: "fixed" 绝对定位 x,y从画布(0,0)点计算 "relative" 相对定位 x,y从画布组(0,0)点计算(fixedrelative)relative
canvasWidth画布宽度,默认获取当前节点 clientWidthnumberdom.clientWidth
canvasHeight画布高度,默认获取当前节点 clientHeightnumberdom.clientHeight
fileWidth文件实际宽度,用来和canvasWidth计算X轴的比例,默认获取当前节点 clientWidthnumberdom.clientWidth
fileHeight文件实际高度,用来和canvasWidth计算X轴的比例,默认获取当前节点 clientHeightnumberdom.clientHeight

事件

属性说明类型
updateBackgroundGroup更新背景图updateBackgroundGroup(styleProps?: zrender.ImageStyleProps): void;
pubSub.subscribe点击画布内容此函数会被执行subscribe(type: 'group', cb: (group: Group, params: IModuleProps) => void): void
updateStandardLineGlobalStatus是否显示引导线updateStandardLineGlobalStatus(ignoreStatus: boolean): void;
updateModule更新模块,例如(fontSize:20)updateModule(module: zrender.Group, name: string, k: string, v: string | number): void;
updateMousewheelStatus修改是否允许画布内容通过滚动鼠标进行缩放updateMousewheelStatus(mousewheelStatus: boolean): void;
save生成图片save(type: TSaveType): void;
redo重制画布redo(): void;
1.0.11

3 months ago

1.0.12

3 months ago

1.0.10

3 months ago

1.0.9

3 months ago

1.0.8

3 months ago

1.0.7

3 months ago

1.0.6

3 months ago

1.0.5

3 months ago

1.0.4

3 months ago

1.0.3

3 months ago

1.0.2

3 months ago

1.0.1

3 months ago

1.0.0

3 months ago