首页 > 基础资料 博客日记
antv/x6 键盘快捷键事件
2023-11-17 18:00:09基础资料围观566次
本篇文章分享antv/x6 键盘快捷键事件,对你有帮助的话记得收藏一下,看Java资料网收获更多编程知识
引用插件
安装
npm install @antv/x6-plugin-selection --save
npm install @antv/x6-plugin-keyboard --save
npm install @antv/x6-plugin-clipboard --save
npm install @antv/x6-plugin-history --save
导入
import { Selection } from '@antv/x6-plugin-selection'
import { Keyboard } from '@antv/x6-plugin-keyboard'
import { Clipboard } from '@antv/x6-plugin-clipboard'
import { History } from '@antv/x6-plugin-history'
取消/重做
this.graph.bindKey(['meta+z', 'ctrl+z'], () => {
if (this.graph.canUndo()) {
this.graph.undo()
}
return false
})
this.graph.bindKey(['meta+y', 'ctrl+y'], () => {
if (this.graph.canRedo()) {
this.graph.redo()
}
return false
})
放大/缩小
this.graph.bindKey(['ctrl+1', 'meta+1'], () => {
const zoom = this.graph.zoom()
if (zoom < 1.5) {
this.graph.zoom(0.1)
}
})
this.graph.bindKey(['ctrl+2', 'meta+2'], () => {
const zoom = this.graph.zoom()
if (zoom > 0.5) {
this.graph.zoom(-0.1)
}
})
复制/剪切/粘贴
this.graph.bindKey(['meta+c', 'ctrl+c'], () => {
const cells = this.graph.getSelectedCells()
if (cells.length) {
this.graph.copy(cells)
}
return false
})
this.graph.bindKey(['meta+x', 'ctrl+x'], () => {
const cells = graph.getSelectedCells()
if (cells.length) {
graph.cut(cells)
}
return false
})
this.graph.bindKey(['meta+v', 'ctrl+v'], () => {
if (!this.graph.isClipboardEmpty()) {
const cells = this.graph.paste({ offset: 32 })
this.graph.cleanSelection()
this.graph.select(cells)
}
return false
})
文章来源:https://blog.csdn.net/qq_35517283/article/details/134428859
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:jacktools123@163.com进行投诉反馈,一经查实,立即删除!
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:jacktools123@163.com进行投诉反馈,一经查实,立即删除!
标签:
上一篇:ASP.NET限流器的简单实现
下一篇:uniapp: 实现pdf预览功能
相关文章
最新发布
- springboot~3.x项目中使用集成测试
- Java测试类、工具类与JavaBean对比解析
- SpringBoot-日志
- springboot~http2的支持
- 解疑释惑 - 日志体系之 slf4j + logback 组合(一)
- Web server failed to start. Port 8080 was already in use. 端口被占用
- Springboot 项目配置多数据源
- 伙伴匹配系统(移动端 H5 网站(APP 风格)基于Spring Boot 后端 + Vue3 - 05
- 剑指offer-23、搜索⼆叉树的后序遍历序列
- 一个表示金额的数字是 100000000L,这是多少米?