标尺线插件
npm run start # 开始运行项目
npm run build # 打包插件代码,同时会创建types
npm run test # 自动化测试
import { App } from 'leafer-ui'
import { Ruler } from 'leafer-x-ruler'
const app = new App({
view: window,
tree: {},
editor: {},
})
const ruler = new Ruler(app)
// 添加自定义主题
ruler.addTheme('custom1', {
backgroundColor: '#6cb0ab',
textColor: '#a45454',
borderColor: '#6f4593',
highlightColor: 'rgba(22,93,255,0.75)'
})
// 切换主题
ruler.changeTheme('custom1')
// 启用、禁用
ruler.enabled = false
属性 |
说明 |
操作方式 |
类型 |
示例值 |
enabled |
启用、禁用 |
get / set |
boolean |
true |
theme |
使用主题名称 |
get / set |
string |
light |
rulerLeafer |
标尺线层Leafer |
get |
Leafer |
- |
config |
标尺设置 |
set |
object |
- |
options |
属性配置 |
set |
object |
- |
方法 |
说明 |
参数类型 |
示例值 |
changeEnabled |
启用、禁用 |
(boolean) |
true |
addTheme |
添加自定义主题 |
(string,object) |
- |
removeTheme |
移除自定义主题 |
(string) |
- |
changeTheme |
切换主题 |
(string) |
- |
forceRender |
强制渲染 |
|
- |