Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
njgzx
dataease
Commits
394fb46b
提交
394fb46b
authored
6月 21, 2021
作者:
wangjiahao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: 优化拖拽效果 防止多次请求后台数据
上级
f155f3d7
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
85 行增加
和
68 行删除
+85
-68
index.vue
frontend/src/components/DeDrag/index.vue
+74
-56
index.vue
frontend/src/components/canvas/components/Editor/index.vue
+11
-12
没有找到文件。
frontend/src/components/DeDrag/index.vue
浏览文件 @
394fb46b
...
...
@@ -298,6 +298,10 @@ export default {
horizontal
:
{
type
:
Boolean
,
default
:
true
},
changeStyle
:
{
require
:
true
,
type
:
Object
}
},
data
:
function
()
{
...
...
@@ -542,69 +546,21 @@ export default {
this
.
bounds
=
this
.
calcResizeLimits
()
}
this
.
changeHeight
(
val
)
},
changeStyle
(
val
)
{
this
.
beforeDestroyFunction
()
this
.
createdFunction
()
this
.
mountedFunction
()
}
},
created
:
function
()
{
// eslint-disable-next-line 无效的prop:minWidth不能大于maxWidth
if
(
this
.
maxWidth
&&
this
.
minWidth
>
this
.
maxWidth
)
console
.
warn
(
'[Vdr warn]: Invalid prop: minWidth cannot be greater than maxWidth'
)
// eslint-disable-next-line 无效prop:minHeight不能大于maxHeight'
if
(
this
.
maxWidth
&&
this
.
minHeight
>
this
.
maxHeight
)
console
.
warn
(
'[Vdr warn]: Invalid prop: minHeight cannot be greater than maxHeight'
)
this
.
elmX
=
0
this
.
elmY
=
0
this
.
elmW
=
0
this
.
elmH
=
0
this
.
lastCenterX
=
0
this
.
lastCenterY
=
0
this
.
fixedXName
=
''
this
.
fixedYName
=
''
this
.
fixedX
=
0
this
.
fixedY
=
0
this
.
TL
=
{}
this
.
TR
=
{}
this
.
BL
=
{}
this
.
BR
=
{}
this
.
resetBoundsAndMouseState
()
this
.
createdFunction
()
},
mounted
:
function
()
{
// private 冲突检测 和水平设计值保持一致
// this.isConflictCheck = this.horizontal
// this.snap = this.horizontal
// this.snapTolerance = 5
// this.grid = [10, 10]
if
(
!
this
.
enableNativeDrag
)
{
this
.
$el
.
ondragstart
=
()
=>
false
}
const
[
parentWidth
,
parentHeight
]
=
this
.
getParentSize
()
this
.
parentWidth
=
parentWidth
this
.
parentHeight
=
parentHeight
const
[
width
,
height
]
=
getComputedSize
(
this
.
$el
)
this
.
aspectFactor
=
(
this
.
w
!==
'auto'
?
this
.
w
:
width
)
/
(
this
.
h
!==
'auto'
?
this
.
h
:
height
)
if
(
this
.
outsideAspectRatio
)
{
this
.
aspectFactor
=
this
.
outsideAspectRatio
}
this
.
width
=
this
.
w
!==
'auto'
?
this
.
w
:
width
// console.log('width1:' + this.width)
this
.
height
=
this
.
h
!==
'auto'
?
this
.
h
:
height
this
.
right
=
this
.
parentWidth
-
this
.
width
-
this
.
left
this
.
bottom
=
this
.
parentHeight
-
this
.
height
-
this
.
top
// 绑定data-*属性
this
.
settingAttribute
()
// 监听取消操作
addEvent
(
document
.
documentElement
,
'mousedown'
,
this
.
deselect
)
addEvent
(
document
.
documentElement
,
'touchend touchcancel'
,
this
.
deselect
)
// 窗口变化时,检查容器大小
addEvent
(
window
,
'resize'
,
this
.
checkParentSize
)
this
.
mountedFunction
()
},
beforeDestroy
:
function
()
{
removeEvent
(
document
.
documentElement
,
'mousedown'
,
this
.
deselect
)
removeEvent
(
document
.
documentElement
,
'touchstart'
,
this
.
handleUp
)
removeEvent
(
document
.
documentElement
,
'mousemove'
,
this
.
move
)
removeEvent
(
document
.
documentElement
,
'touchmove'
,
this
.
move
)
removeEvent
(
document
.
documentElement
,
'mouseup'
,
this
.
handleUp
)
removeEvent
(
document
.
documentElement
,
'touchend touchcancel'
,
this
.
deselect
)
removeEvent
(
window
,
'resize'
,
this
.
checkParentSize
)
this
.
beforeDestroyFunction
()
},
methods
:
{
// 重置边界和鼠标状态
...
...
@@ -1506,6 +1462,68 @@ export default {
style
.
rotate
=
this
.
rotate
this
.
hasMove
=
true
this
.
$store
.
commit
(
'setShapeStyle'
,
style
)
},
mountedFunction
()
{
// private 冲突检测 和水平设计值保持一致
// this.isConflictCheck = this.horizontal
// this.snap = this.horizontal
// this.snapTolerance = 5
// this.grid = [10, 10]
if
(
!
this
.
enableNativeDrag
)
{
this
.
$el
.
ondragstart
=
()
=>
false
}
const
[
parentWidth
,
parentHeight
]
=
this
.
getParentSize
()
this
.
parentWidth
=
parentWidth
this
.
parentHeight
=
parentHeight
const
[
width
,
height
]
=
getComputedSize
(
this
.
$el
)
this
.
aspectFactor
=
(
this
.
w
!==
'auto'
?
this
.
w
:
width
)
/
(
this
.
h
!==
'auto'
?
this
.
h
:
height
)
if
(
this
.
outsideAspectRatio
)
{
this
.
aspectFactor
=
this
.
outsideAspectRatio
}
this
.
width
=
this
.
w
!==
'auto'
?
this
.
w
:
width
// console.log('width1:' + this.width)
this
.
height
=
this
.
h
!==
'auto'
?
this
.
h
:
height
this
.
right
=
this
.
parentWidth
-
this
.
width
-
this
.
left
this
.
bottom
=
this
.
parentHeight
-
this
.
height
-
this
.
top
// 绑定data-*属性
this
.
settingAttribute
()
// 监听取消操作
addEvent
(
document
.
documentElement
,
'mousedown'
,
this
.
deselect
)
addEvent
(
document
.
documentElement
,
'touchend touchcancel'
,
this
.
deselect
)
// 窗口变化时,检查容器大小
addEvent
(
window
,
'resize'
,
this
.
checkParentSize
)
},
createdFunction
()
{
// eslint-disable-next-line 无效的prop:minWidth不能大于maxWidth
if
(
this
.
maxWidth
&&
this
.
minWidth
>
this
.
maxWidth
)
console
.
warn
(
'[Vdr warn]: Invalid prop: minWidth cannot be greater than maxWidth'
)
// eslint-disable-next-line 无效prop:minHeight不能大于maxHeight'
if
(
this
.
maxWidth
&&
this
.
minHeight
>
this
.
maxHeight
)
console
.
warn
(
'[Vdr warn]: Invalid prop: minHeight cannot be greater than maxHeight'
)
this
.
elmX
=
0
this
.
elmY
=
0
this
.
elmW
=
0
this
.
elmH
=
0
this
.
lastCenterX
=
0
this
.
lastCenterY
=
0
this
.
fixedXName
=
''
this
.
fixedYName
=
''
this
.
fixedX
=
0
this
.
fixedY
=
0
this
.
TL
=
{}
this
.
TR
=
{}
this
.
BL
=
{}
this
.
BR
=
{}
this
.
resetBoundsAndMouseState
()
},
beforeDestroyFunction
()
{
removeEvent
(
document
.
documentElement
,
'mousedown'
,
this
.
deselect
)
removeEvent
(
document
.
documentElement
,
'touchstart'
,
this
.
handleUp
)
removeEvent
(
document
.
documentElement
,
'mousemove'
,
this
.
move
)
removeEvent
(
document
.
documentElement
,
'touchmove'
,
this
.
move
)
removeEvent
(
document
.
documentElement
,
'mouseup'
,
this
.
handleUp
)
removeEvent
(
document
.
documentElement
,
'touchend touchcancel'
,
this
.
deselect
)
removeEvent
(
window
,
'resize'
,
this
.
checkParentSize
)
}
}
...
...
frontend/src/components/canvas/components/Editor/index.vue
浏览文件 @
394fb46b
...
...
@@ -29,7 +29,7 @@
:class=
"
{'gap_class':canvasStyleData.panel.gap==='yes'}"
:snap="true"
:snap-tolerance="1"
:change-style="customStyle
History
"
:change-style="customStyle"
@refLineParams="getRefLineParams"
>
<component
...
...
@@ -193,6 +193,16 @@ export default {
])
},
watch
:
{
customStyle
:
{
handler
(
newVal
,
oldVla
)
{
// 获取当前宽高(宽高改变后重新渲染画布)
// if (oldVla && newVal !== oldVla) {
// this.showDrag = false
// this.$nextTick(() => (this.showDrag = true))
// }
},
deep
:
true
},
outStyle
:
{
handler
(
newVal
,
oldVla
)
{
this
.
changeScale
()
...
...
@@ -454,17 +464,6 @@ export default {
}
},
changeScale
()
{
// 获取当前宽高(宽高改变后重新渲染画布)
const
style
=
{
width
:
this
.
format
(
this
.
canvasStyleData
.
width
,
this
.
scaleWidth
)
+
'px'
,
height
:
this
.
format
(
this
.
canvasStyleData
.
height
,
this
.
scaleHeight
)
+
'px'
}
if
(
this
.
customStyleHistory
&&
this
.
customStyleHistory
!==
style
)
{
this
.
showDrag
=
false
this
.
$nextTick
(()
=>
(
this
.
showDrag
=
true
))
}
this
.
customStyleHistory
=
style
if
(
this
.
canvasStyleData
.
matrixCount
)
{
this
.
matrixCount
=
this
.
canvasStyleData
.
matrixCount
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论