@@ -21,6 +21,8 @@ <h1>Swap collision demo</h1>
2121 with layouts:
2222 < a class ="btn btn-primary " onclick ="load(0) " href ="# "> load 0</ a >
2323 < a class ="btn btn-primary " onclick ="load(1) " href ="# "> load 1</ a >
24+ < a class ="btn btn-primary " onclick ="load(2) " href ="# "> load web1</ a >
25+ < a class ="btn btn-primary " onclick ="loadAdvanced() " href ="# "> load web2</ a >
2426 </ div >
2527 < br > < br >
2628 < div class ="grid-stack "> </ div >
@@ -45,6 +47,19 @@ <h1>Swap collision demo</h1>
4547 { x :1 , y :0 } , { x :1 , y :1 } , { x :1 , y :2 , w :2 } , { x :0 , y :3 , w :3 } , { x :1 , y :4 , h :2 } ,
4648 { x :3 , y :0 , w :3 , h :3 } , { x :6 , y :0 } ,
4749 { x :7 , y :0 , w :3 } , { x :8 , y :1 , w :3 } ,
50+ ] , [
51+ // web1.html demo
52+ { x :0 , y :0 , w :4 , h :2 } ,
53+ { x :4 , y :0 , w :4 , h :4 , id : 'big' } ,
54+ { x :8 , y :0 , w :2 , h :2 } ,
55+ { x :10 , y :0 , w :2 , h :2 } ,
56+ { x :0 , y :2 , w :2 , h :2 } ,
57+ { x :2 , y :2 , w :2 , h :4 } ,
58+ { x :8 , y :2 , w :4 , h :2 } ,
59+ { x :0 , y :4 , w :2 , h :2 } ,
60+ { x :4 , y :4 , w :4 , h :2 } ,
61+ { x :8 , y :4 , w :2 , h :2 } ,
62+ { x :10 , y :4 , w :2 , h :2 }
4863 ] ] ;
4964 items . forEach ( layout => {
5065 let count = 0 ;
@@ -67,23 +82,26 @@ <h1>Swap collision demo</h1>
6782 grid . removeAll ( ) ;
6883 grid . load ( items [ i ] ) ;
6984 }
70-
85+ loadAdvanced = function ( ) {
86+ load ( 2 ) ;
87+ grid . update ( grid . engine . nodes [ 1 ] . el , { locked : true , content :'locked' } ) ;
88+ }
7189 toggleFloat = function ( ) {
7290 grid . float ( ! grid . getFloat ( ) ) ;
7391 floatButton . innerHTML = 'float: ' + grid . getFloat ( ) ;
74- } ;
92+ }
7593 floatButton . innerHTML = 'float: ' + grid . getFloat ( ) ;
7694
7795 toggleMax = function ( ) {
7896 grid . opts . maxRow = grid . engine . maxRow = grid . opts . maxRow ? 0 : 3 ;
7997 maxButton . innerHTML = 'Max: ' + grid . opts . maxRow ;
80- } ;
98+ }
8199 maxButton . innerHTML = 'Max: ' + grid . opts . maxRow ;
82100
83101 toggleBigger = function ( ) {
84102 size = size === 1 ? 2 : 1 ;
85103 setSize ( size ) ;
86- } ;
104+ }
87105 setSize = function ( size ) {
88106 items . sort ( ( a , b ) => a . id - b . id ) ;
89107 items . forEach ( ( n , i ) => {
0 commit comments