Code Monkey home page Code Monkey logo

leafer-x-ruler's Introduction

leafer-x-ruler

标尺线插件

show

show转存失败,建议直接上传图片文件

运行

npm run start # 开始运行项目

npm run build # 打包插件代码,同时会创建types

npm run test # 自动化测试

usage

install

npm i leafer-x-ruler  

use

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 强制渲染 -

leafer-x-ruler's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.