Feat:新增禁止拖动画布的配置选项
This commit is contained in:
parent
ffc7bf5b7e
commit
a1ec72b401
@ -219,5 +219,7 @@ export const defaultOpt = {
|
|||||||
// 可以传递一个函数,返回promise,resolve代表根据换行分割,reject代表忽略换行
|
// 可以传递一个函数,返回promise,resolve代表根据换行分割,reject代表忽略换行
|
||||||
handleIsSplitByWrapOnPasteCreateNewNode: null,
|
handleIsSplitByWrapOnPasteCreateNewNode: null,
|
||||||
// 多少时间内只允许添加一次历史记录,避免添加没有必要的中间状态,单位:ms
|
// 多少时间内只允许添加一次历史记录,避免添加没有必要的中间状态,单位:ms
|
||||||
addHistoryTime: 100
|
addHistoryTime: 100,
|
||||||
|
// 是否禁止拖动画布
|
||||||
|
isDisableDrag: false
|
||||||
}
|
}
|
||||||
|
|||||||
@ -30,12 +30,14 @@ class View {
|
|||||||
})
|
})
|
||||||
// 拖动视图
|
// 拖动视图
|
||||||
this.mindMap.event.on('mousedown', () => {
|
this.mindMap.event.on('mousedown', () => {
|
||||||
|
if (this.mindMap.opt.isDisableDrag) return
|
||||||
this.sx = this.x
|
this.sx = this.x
|
||||||
this.sy = this.y
|
this.sy = this.y
|
||||||
})
|
})
|
||||||
this.mindMap.event.on('drag', (e, event) => {
|
this.mindMap.event.on('drag', (e, event) => {
|
||||||
if (e.ctrlKey) {
|
// 按住ctrl键拖动为多选
|
||||||
// 按住ctrl键拖动为多选
|
// 禁用拖拽
|
||||||
|
if (e.ctrlKey || this.mindMap.opt.isDisableDrag) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (this.firstDrag) {
|
if (this.firstDrag) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user