Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
njgzx
dataease
Commits
df133624
提交
df133624
authored
10月 13, 2021
作者:
wangjiahao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: 去掉无用的注释
上级
e0b3e6a2
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
0 行增加
和
329 行删除
+0
-329
drag.js
frontend/src/components/DeDrag/drag.js
+0
-0
drag.less
frontend/src/components/DeDrag/drag.less
+0
-112
drag.vue
frontend/src/components/DeDrag/drag.vue
+0
-0
index.vue
frontend/src/components/canvas/components/Editor/index.vue
+0
-78
base.vue
frontend/src/views/panel/drag/base.vue
+0
-139
没有找到文件。
frontend/src/components/DeDrag/drag.js
deleted
100644 → 0
浏览文件 @
e0b3e6a2
差异被折叠。
点击展开。
frontend/src/components/DeDrag/drag.less
deleted
100644 → 0
浏览文件 @
e0b3e6a2
.dragAndResize
{
position: relative;
user-select: none;
*
{
box-sizing: border-box;
margin: 0;
padding: 0;
}
.item
{
position: absolute;
width: 100px;
height: 100px;
cursor: move;
border: 1px solid;
background-color: #fff;
.resizeHandle
{
position: absolute;
right: 2px;
bottom: 2px;
width: 0;
height: 0;
cursor: nw-resize;
opacity: .5;
border-bottom: 10px solid black;
border-left: 10px solid transparent;
}
}
.moveAnimation
{
transition: top 80ms ease;
}
.canNotDrag
{
cursor: default!important;
}
.cloneNode
{
z-index: 3;
transition: none;
background-color: #bec1c9;
opacity: 0.5;
}
.movingItem
{
position: absolute;
border: none;
&:before
{
position: absolute;
z-index: 2;
top: 0;
left: 0;
width: 100%;
height: 100%;
content: 'movingItem';
background-color: #3d66e7;
}
}
.positionBox
{
position: fixed;
top: 0;
right: 100px;
overflow: auto;
width: 500px;
height: 500px;
border: 1px solid;
}
.coords
{
position: fixed;
right: 100px;
bottom: 200px;
overflow: auto;
width: 200px;
height: 200px;
border: 1px solid;
}
}
frontend/src/components/DeDrag/drag.vue
deleted
100644 → 0
浏览文件 @
e0b3e6a2
差异被折叠。
点击展开。
frontend/src/components/canvas/components/Editor/index.vue
浏览文件 @
df133624
...
@@ -1429,32 +1429,6 @@ export default {
...
@@ -1429,32 +1429,6 @@ export default {
infoBox
.
moveItem
=
item
infoBox
.
moveItem
=
item
infoBox
.
moveItemIndex
=
index
infoBox
.
moveItemIndex
=
index
// infoBox.cloneItem = null
// infoBox.nowItemNode = null
// 通过.item 样式class 来获取最外层的de-drag 最外层的定位
// if (target.attr('class') && target.attr('class').indexOf('item') !== -1) {
// infoBox.nowItemNode = target
// // infoBox.cloneItem = target.clone()
// } else {
// infoBox.nowItemNode = target.parents('.item')
// // infoBox.cloneItem = infoBox.nowItemNode.clone()
// }
// infoBox.cloneItem.addClass('cloneNode')
// 使用deDrag 自己的shadow 进行阴影定位
// $(this.$el).append(infoBox.cloneItem)
// if (infoBox.cloneItem.position()) {
// infoBox.orignX = infoBox.cloneItem.position().left // 克隆对象原始X位置
// infoBox.orignY = infoBox.cloneItem.position().top
// } else {
// infoBox.orignX = 0 // 克隆对象原始X位置
// infoBox.orignY = 0
// infoBox.startX = 0
// infoBox.startY = 0
// }
infoBox
.
orignX
=
0
// 克隆对象原始X位置
infoBox
.
orignX
=
0
// 克隆对象原始X位置
infoBox
.
orignY
=
0
infoBox
.
orignY
=
0
infoBox
.
startX
=
0
infoBox
.
startX
=
0
...
@@ -1464,8 +1438,6 @@ export default {
...
@@ -1464,8 +1438,6 @@ export default {
infoBox
.
oldY
=
item
.
y
infoBox
.
oldY
=
item
.
y
infoBox
.
oldSizeX
=
item
.
sizex
infoBox
.
oldSizeX
=
item
.
sizex
infoBox
.
oldSizeY
=
item
.
sizey
infoBox
.
oldSizeY
=
item
.
sizey
// infoBox.orignWidth = infoBox.cloneItem.prop('offsetWidth')
// infoBox.orignHeight = infoBox.cloneItem.prop('offsetHeight')
},
},
onMouseUp
(
e
)
{
onMouseUp
(
e
)
{
const
vm
=
this
const
vm
=
this
...
@@ -1498,18 +1470,11 @@ export default {
...
@@ -1498,18 +1470,11 @@ export default {
const
startY
=
infoBox
.
startY
const
startY
=
infoBox
.
startY
const
oldSizeX
=
infoBox
.
oldSizeX
const
oldSizeX
=
infoBox
.
oldSizeX
const
oldSizeY
=
infoBox
.
oldSizeY
const
oldSizeY
=
infoBox
.
oldSizeY
// const orignWidth = infoBox.orignWidth
// const orignHeight = infoBox.orignHeight
const
moveXSize
=
e
.
pageX
-
startX
// X方向移动的距离
const
moveXSize
=
e
.
pageX
-
startX
// X方向移动的距离
const
moveYSize
=
e
.
pageY
-
startY
// Y方向移动的距离
const
moveYSize
=
e
.
pageY
-
startY
// Y方向移动的距离
const
addSizex
=
(
moveXSize
)
%
vm
.
cellWidth
>
(
vm
.
cellWidth
/
4
*
1
)
?
parseInt
(((
moveXSize
)
/
vm
.
cellWidth
+
1
))
:
parseInt
(((
moveXSize
)
/
vm
.
cellWidth
))
const
addSizex
=
(
moveXSize
)
%
vm
.
cellWidth
>
(
vm
.
cellWidth
/
4
*
1
)
?
parseInt
(((
moveXSize
)
/
vm
.
cellWidth
+
1
))
:
parseInt
(((
moveXSize
)
/
vm
.
cellWidth
))
const
addSizey
=
(
moveYSize
)
%
vm
.
cellHeight
>
(
vm
.
cellHeight
/
4
*
1
)
?
parseInt
(((
moveYSize
)
/
vm
.
cellHeight
+
1
))
:
parseInt
(((
moveYSize
)
/
vm
.
cellHeight
))
const
addSizey
=
(
moveYSize
)
%
vm
.
cellHeight
>
(
vm
.
cellHeight
/
4
*
1
)
?
parseInt
(((
moveYSize
)
/
vm
.
cellHeight
+
1
))
:
parseInt
(((
moveYSize
)
/
vm
.
cellHeight
))
//
// const nowX = oldSizeX + addSizex > 0 ? oldSizeX + addSizex : 1
// const nowY = oldSizeY + addSizey > 0 ? oldSizeY + addSizey : 1
let
nowX
=
Math
.
round
((
item
.
style
.
width
*
this
.
scalePointWidth
)
/
this
.
matrixStyle
.
width
)
let
nowX
=
Math
.
round
((
item
.
style
.
width
*
this
.
scalePointWidth
)
/
this
.
matrixStyle
.
width
)
let
nowY
=
Math
.
round
((
item
.
style
.
height
*
this
.
scalePointHeight
)
/
this
.
matrixStyle
.
height
)
let
nowY
=
Math
.
round
((
item
.
style
.
height
*
this
.
scalePointHeight
)
/
this
.
matrixStyle
.
height
)
nowX
=
nowX
>
0
?
nowX
:
1
nowX
=
nowX
>
0
?
nowX
:
1
...
@@ -1523,16 +1488,6 @@ export default {
...
@@ -1523,16 +1488,6 @@ export default {
})
})
}
}
})(
addSizex
,
addSizey
),
10
)
})(
addSizex
,
addSizey
),
10
)
// let nowWidth = orignWidth + moveXSize
// nowWidth = nowWidth
<=
vm
.
baseWidth
?
vm
.
baseWidth
:
nowWidth
// let nowHeight = orignHeight + moveYSize
// nowHeight = nowHeight
<=
vm
.
baseHeight
?
vm
.
baseHeight
:
nowHeight
// // 克隆元素实时改变大小
// cloneItem.css({
// width: nowWidth,
// height: nowHeight
// })
},
},
onDragging
(
e
,
item
)
{
onDragging
(
e
,
item
)
{
const
infoBox
=
this
.
infoBox
const
infoBox
=
this
.
infoBox
...
@@ -1545,40 +1500,12 @@ export default {
...
@@ -1545,40 +1500,12 @@ export default {
vm
.
dragging
.
call
(
null
,
e
,
moveItem
,
moveItem
.
_dragId
)
vm
.
dragging
.
call
(
null
,
e
,
moveItem
,
moveItem
.
_dragId
)
vm
.
$set
(
moveItem
,
'isPlayer'
,
true
)
vm
.
$set
(
moveItem
,
'isPlayer'
,
true
)
// this.$set(moveItem, "show", false);
// const nowItemIndex = infoBox.moveItemIndex
// const cloneItem = infoBox.cloneItem
// const startX = infoBox.startX
// const startY = infoBox.startY
// const orignX = infoBox.orignX
// const orignY = infoBox.orignY
const
oldX
=
infoBox
.
oldX
const
oldX
=
infoBox
.
oldX
const
oldY
=
infoBox
.
oldY
const
oldY
=
infoBox
.
oldY
// const moveXSize = e.pageX - startX // X方向移动的距离
// const moveYSize = e.pageY - startY // Y方向移动的距离
//
// const nowCloneItemX = orignX + moveXSize
// const nowCloneItemY = orignY + moveYSize
// temp 临时测试
// let newX = parseInt((nowCloneItemX + (cloneItem.width() / 12) - vm.baseMarginLeft) / vm.cellWidth + 1)
// let newY = parseInt((nowCloneItemY + (cloneItem.height() / 12) - vm.baseMarginTop) / vm.cellHeight + 1)
let
newX
=
Math
.
round
((
item
.
style
.
left
*
this
.
scalePointWidth
)
/
this
.
matrixStyle
.
width
)
+
1
let
newX
=
Math
.
round
((
item
.
style
.
left
*
this
.
scalePointWidth
)
/
this
.
matrixStyle
.
width
)
+
1
let
newY
=
Math
.
round
((
item
.
style
.
top
*
this
.
scalePointHeight
)
/
this
.
matrixStyle
.
height
)
+
1
let
newY
=
Math
.
round
((
item
.
style
.
top
*
this
.
scalePointHeight
)
/
this
.
matrixStyle
.
height
)
+
1
// if (this.dragComponentInfo) {
// newX = Math.round(this.dragComponentInfo.x) + 1
// newY = Math.round(this.dragComponentInfo.y) + 1
// } else {
// newX = Math.round((item.style.left * this.scalePointWidth) / this.matrixStyle.width) + 1
// newY = Math.round((item.style.top * this.scalePointHeight) / this.matrixStyle.height) + 1
// }
newX
=
newX
>
0
?
newX
:
1
newX
=
newX
>
0
?
newX
:
1
newY
=
newY
>
0
?
newY
:
1
newY
=
newY
>
0
?
newY
:
1
// console.log('infoBox==>' + JSON.stringify(this.infoBox))
// console.log('infoBox:startX' + startX + ';startY' + startY + 'orignX' + orignX + 'orignY' + orignY + 'oldX' + oldX + 'oldY' + oldY + 'new:newX=' + newX + ';newY=' + newY)
debounce
((
function
(
newX
,
oldX
,
newY
,
oldY
)
{
debounce
((
function
(
newX
,
oldX
,
newY
,
oldY
)
{
return
function
()
{
return
function
()
{
// console.log('move1')
// console.log('move1')
...
@@ -1594,11 +1521,6 @@ export default {
...
@@ -1594,11 +1521,6 @@ export default {
}
}
}
}
})(
newX
,
oldX
,
newY
,
oldY
),
10
)
})(
newX
,
oldX
,
newY
,
oldY
),
10
)
// cloneItem.css({
// left: nowCloneItemX + 'px',
// top: nowCloneItemY + 'px'
// })
},
},
endMove
(
e
)
{
endMove
(
e
)
{
...
...
frontend/src/views/panel/drag/base.vue
deleted
100644 → 0
浏览文件 @
e0b3e6a2
<
template
>
<div
id=
"demo"
>
<!--
<button
@
click=
"getList"
>
getList
</button>
-->
<div
class=
"head"
>
<router-link
to=
"/"
class=
"arrow"
>
←
</router-link>
<span>
基本应用
</span>
</div>
<power-drag
ref=
"cyGridster"
:your-list=
"myList"
:base-margin-left=
"baseMarginLeft"
:base-margin-top=
"baseMarginTop"
:base-width=
"baseWidth"
:base-height=
"baseHeight"
>
<!--
<div
v-for=
"(item,index) in myList"
:slot=
"'slot'+index"
>
</div>
-->
<div
draggable=
"true"
style=
"width: 200px;height: 200px;background: #1b6d85"
>
this is test
</div>
</power-drag>
</div>
</
template
>
<
script
>
import
drag
from
'@/components/DeDrag/drag.vue'
import
mock
from
'mockjs'
import
_
from
'lodash'
export
default
{
name
:
'App'
,
components
:
{
'power-drag'
:
drag
},
data
()
{
const
list
=
mock
.
mock
({
// "myList|10": [{
// "id|+1": 1,
// x: '@integer(1,5)',
// y: '@integer(1,5)',
// sizex: '@integer(1,3)',
// sizey: '@integer(1,3)',
// }]
myList
:
[{
'id'
:
3
,
'x'
:
6
,
'y'
:
2
,
'sizex'
:
1
,
'sizey'
:
1
},
{
'id'
:
5
,
'x'
:
4
,
'y'
:
2
,
'sizex'
:
2
,
'sizey'
:
1
},
{
'id'
:
7
,
'x'
:
1
,
'y'
:
2
,
'sizex'
:
1
,
'sizey'
:
1
},
{
'id'
:
9
,
'x'
:
7
,
'y'
:
2
,
'sizex'
:
1
,
'sizey'
:
1
}]
})
return
{
myList
:
list
.
myList
,
baseWidth
:
0
,
baseHeight
:
0
}
},
created
()
{
// 屏幕适配,使得当前布局能在所有分辨率下适用,示例是在1366*638分辨率下完成
const
screenWidth
=
window
.
innerWidth
const
screenHeight
=
window
.
innerHeight
this
.
baseWidth
=
90.8333
*
(
screenWidth
/
1366
)
this
.
baseHeight
=
100
*
(
screenHeight
/
638
)
this
.
baseMarginLeft
=
0
this
.
baseMarginTop
=
0
this
.
$nextTick
(
function
()
{
$
(
'.dragAndResize'
).
css
(
'width'
,
'calc(100% - '
+
(
this
.
baseMarginLeft
)
+
'px)'
)
})
},
mounted
()
{
const
gridster
=
this
.
$refs
[
'cyGridster'
]
// 获取gridster实例
gridster
.
init
()
// 在适当的时候初始化布局组件
},
methods
:
{
getList
()
{
const
gridster
=
this
.
$refs
[
'cyGridster'
]
// 获取gridster实例
console
.
log
(
JSON
.
stringify
(
gridster
.
getList
()))
}
}
}
</
script
>
<
style
lang=
'less'
scoped
>
body {
overflow-x: hidden;
& * {
box-sizing: border-box;
}
}
#demo {
width: 100%;
padding: 1.5em 0 1.5em 0;
.head {
border-bottom: 1px dashed;
width: 100%;
padding-left: 20px;
height: 50px;
a {
text-decoration: none;
color: black;
}
}
.arrow {
font-size: 20px;
position: relative;
margin-right: 10px;
top: 2px;
}
}
</
style
>
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论