1 Star 0 Fork 8

wh / vue-sketch-ruler_1

forked from NMS丶No3 / vue-sketch-ruler 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

npm-version license

English | 简体中文

vue-sketch-ruler

一个vue组件的素描标尺

在线demo

点击这里查看

安装

支持全局导入和模块导入

npm install --save vue-sketch-ruler

支持的功能

  • 标尺渲染
  • 缩放内容,重绘标尺
  • 滚动内容,重绘标尺
  • 切换标尺状态,显示或隐藏
  • 参考线管理(增加删除)
  • 切换参考线状态,显示或隐藏

未来支持的功能

  • [] 支持标尺的右键菜单
  • [] 标角支持事件
  • [] 分离css样式,支持导入样式
  • [] 国际化

使用

<template>
    <SketchRule
        :lang="lang"
        :thick="thick"
        :scale="scale"
        :width="582"
        :height="482"
        :startX="startX"
        :startY="startY"
        :shadow="shadow"
        :horLineArr="lines.h"
        :verLineArr="lines.v"
        :cornerActive="true"
        @handleLine="handleLine"
        @onCornerClick="handleCornerClick"
    >
</template>
<script>
import Vue from 'vue';
import SketchRule from "vue-sketch-ruler";
const rectWidth = 160;
const rectHeight = 200;
export default Vue.extend({
    data() {
        return {
            scale: 2, //658813476562495, //1,
            startX: 0,
            startY: 0,
            lines: {
                h: [100, 200],
                v: [100, 200]
            },
            thick: 20,
            lang: "zh-CN",
            isShowRuler: true,
            isShowReferLine: true
        }
    },
    components: {
        SketchRule
    }
});
</script>

参考一个完整的例子,点击这里

api

接口

interface Lines {
    h: number[],
    v:  Array<Number>,
}
interface Shadow {
    x: number,
    y: number,
    width: number,
    height: number
}
interface Palette {
    bgColor: string, // ruler bg color
    longfgColor: string, // ruler longer mark color
    shortfgColor: string, // ruler shorter mark color
    fontColor: string, // ruler font color
    shadowColor: string, // ruler shadow color
    lineColor: string,
    borderColor: string',
    cornerActiveColor: string,
}

属性

属性名称 描述 类型 默认值
lang 初始化的语言 String zh-CN
scale 初始化标尺的缩放 Number 2
thick 标尺的厚度 Number 16
width 放置标尺窗口的宽度 Number -
height 放置标尺窗口的高度 Number -
startX x轴标尺开始的坐标数值 Number 0
startY y轴标尺开始的坐标数值 Number 0
shadow 阴影的参数 Shadow 0
horLineArr 初始化水平标尺上的参考线 Array []
verLineArr 初始化垂直标尺上的参考线 Array []
palette 标尺的样式配置参数 Palette {bgColor: 'rgba(225,225,225, 0)',longfgColor: '#BABBBC',shortfgColor: '#C8CDD0',fontColor: '#7D8694', shadowColor: '#E8E8E8',lineColor: '#EB5648', borderColor: '#DADADC',cornerActiveColor: 'rgb(235, 86, 72, 0.6)',}

Event

事件名称 描述 回调参数
handleLine 在横纵标尺上操作参考线(新增或移除) Lines

引用

一个来自墨刀的react标尺组件 mb-sketch-ruler .

MIT License Copyright (c) 2019 chuxiaoguo Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

用vue组件实现的一个素描标尺。a ruler tool for vue 展开 收起
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wh-1314/vue-sketch-ruler_1.git
git@gitee.com:wh-1314/vue-sketch-ruler_1.git
wh-1314
vue-sketch-ruler_1
vue-sketch-ruler_1
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891