File tree 5 files changed +43
-4
lines changed
5 files changed +43
-4
lines changed File renamed without changes.
Original file line number Diff line number Diff line change 1
1
import React , { Component } from 'react' ;
2
+ import background_card from '@/logo.svg'
2
3
//拖拽预览组件类
3
4
export default class CardListDragPreview extends Component {
4
5
render ( ) {
5
6
const { cardListLength, cardId } = this . props ;
6
7
let divDom = [ ] ;
7
8
for ( let index = 0 ; index < cardListLength ; index ++ ) {
8
- //第一个显示layer的dom,需要显示图片和数量红色气泡
9
+ //第一个显示layer的dom,需要显示图片
9
10
if ( index === cardListLength - 1 ) {
10
11
const myIndex = index >= 3 ? 3 : index ;
11
12
divDom . push (
@@ -15,6 +16,12 @@ export default class CardListDragPreview extends Component {
15
16
style = { { left : `${ myIndex * 5 } px` , top : `${ myIndex * 5 } px` } }
16
17
>
17
18
< span className = 'layer-card-span' > { cardId } </ span >
19
+ < img
20
+ src = { background_card }
21
+ alt = 'logo'
22
+ width = '107'
23
+ height = '113'
24
+ />
18
25
</ div >
19
26
) ;
20
27
} else if ( index < 3 ) { //layer的dom最多显示四个
Original file line number Diff line number Diff line change @@ -66,6 +66,8 @@ export const layoutCheck = (function () {
66
66
widthOrHeight = item . height ;
67
67
}
68
68
//判断当前卡片的坐标和目标卡片加上宽度/高度是否有重叠,防止重叠产生
69
+ //在vertical情况下,是判断类似拖拽(0,1)宽1高1的方块与(0,0)宽1高2的纵向长方形,此时的交叠,纵向长方形保持不动,
70
+ //在horizontal情况下,是判断类似拖拽(1,0)宽1高1的方块与(0,0)宽2高1的横向长方形,此时的交叠,横向长方形保持不动,
69
71
if (
70
72
layoutItem [ axis ] > item [ axis ] &&
71
73
layoutItem [ axis ] < item [ axis ] + widthOrHeight
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ class MyContent extends Component {
16
16
constructor ( props ) {
17
17
super ( props ) ;
18
18
this . state = {
19
- compactType : 'horizontal ' , //('vertical' | 'horizontal') = 'vertical'
19
+ compactType : 'vertical ' , //('vertical' | 'horizontal') = 'vertical'
20
20
defaultLayout : {
21
21
containerWidth : 1200 ,
22
22
containerHeight : 300 ,
@@ -42,7 +42,6 @@ class MyContent extends Component {
42
42
} ;
43
43
}
44
44
/*
45
- * 工作桌面 用户桌面设置 页面
46
45
* 关于卡片在组内的操作
47
46
*/
48
47
/**
Original file line number Diff line number Diff line change
1
+ /**
2
+ * (0,0) 宽2 高1
3
+ * (1,0) 宽1 高1
4
+ */
1
5
const testData1 = {
2
6
test : {
3
7
a : {
@@ -15,6 +19,10 @@ const testData1 = {
15
19
} ,
16
20
expect : true ,
17
21
} ;
22
+ /**
23
+ * (0,0) 宽1 高1
24
+ * (1,0) 宽1 高1
25
+ */
18
26
const testData2 = {
19
27
test : {
20
28
a : {
@@ -32,8 +40,31 @@ const testData2 = {
32
40
} ,
33
41
expect : false ,
34
42
} ;
43
+ /**
44
+ * (0,0) 宽1 高2
45
+ * (0,1) 宽1 高1
46
+ * 碰撞 解决issue:when 2x2 or 1x2 collosion bug for horizontal
47
+ */
48
+ const testData3 = {
49
+ test : {
50
+ a : {
51
+ gridx : 0 ,
52
+ gridy : 0 ,
53
+ width : 1 ,
54
+ height : 2
55
+ } ,
56
+ b : {
57
+ gridx : 0 ,
58
+ gridy : 1 ,
59
+ width : 1 ,
60
+ height : 1
61
+ }
62
+ } ,
63
+ expect : true ,
64
+ } ;
35
65
36
66
export default [
37
67
testData1 ,
38
- testData2
68
+ testData2 ,
69
+ testData3
39
70
] ;
You can’t perform that action at this time.
0 commit comments