-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
index.html
222 lines (219 loc) · 10.6 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta content="width=device-width, initial-scale=1" name="viewport" />
<title>Dragster.js Demo</title>
<link rel="stylesheet" href="dragster.style.css" />
<link rel="apple-touch-icon" sizes="57x57" href="/img/favicons/apple-icon-57x57.png" />
<link rel="apple-touch-icon" sizes="60x60" href="/img/favicons/apple-icon-60x60.png" />
<link rel="apple-touch-icon" sizes="72x72" href="/img/favicons/apple-icon-72x72.png" />
<link rel="apple-touch-icon" sizes="76x76" href="/img/favicons/apple-icon-76x76.png" />
<link rel="apple-touch-icon" sizes="114x114" href="/img/favicons/apple-icon-114x114.png" />
<link rel="apple-touch-icon" sizes="120x120" href="/img/favicons/apple-icon-120x120.png" />
<link rel="apple-touch-icon" sizes="144x144" href="/img/favicons/apple-icon-144x144.png" />
<link rel="apple-touch-icon" sizes="152x152" href="/img/favicons/apple-icon-152x152.png" />
<link rel="apple-touch-icon" sizes="180x180" href="/img/favicons/apple-icon-180x180.png" />
<link rel="icon" type="image/png" sizes="192x192" href="/img/favicons/android-icon-192x192.png" />
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicons/favicon-32x32.png" />
<link rel="icon" type="image/png" sizes="96x96" href="/img/favicons/favicon-96x96.png" />
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicons/favicon-16x16.png" />
<link rel="manifest" href="/img/favicons/manifest.json" />
<meta name="msapplication-TileColor" content="#ffffff" />
<meta name="msapplication-TileImage" content="/img/favicons/ms-icon-144x144.png" />
<meta name="theme-color" content="#ffffff" />
</head>
<body>
<svg
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
style="position: absolute; width: 0; height: 0"
>
<defs>
<symbol id="logo" viewBox="0 0 300 300">
<style>
.bg,
.star,
.star-hole {
fill-rule: nonzero;
stroke-linecap: round;
stroke-linejoin: round;
}
.letter-n,
.letter-p,
.letter-p-hole,
.letter-n-hole {
fill-rule: evenodd;
stroke-width: 2px;
}
.star,
.star-hole {
stroke-width: 2px;
}
.star,
.letter-n,
.letter-p {
fill: #ffffff;
}
.bg,
.star-hole,
.letter-p-hole,
.letter-n-hole {
fill: #b24210;
}
</style>
<g id="container-logo">
<rect width="300" height="300" x="0" y="0" class="bg" />
<g id="container-letter-n">
<rect width="260" height="110" x="20" y="170" class="letter-n" />
<rect width="220" height="90" x="40" y="191" class="letter-n-hole" />
</g>
<g id="container-letter-p">
<path
d="M 150 170 L 150 20 L 280 20 L 280 100 L 170 100 L 170 170 L 150 170 z"
class="letter-p"
/>
<rect width="90" height="40" x="170" y="40" class="letter-p-hole" />
</g>
<g id="container-star">
<path
d="
M 67.553 95.000
L 96.942 110.451
L 91.329 77.725
L 115.106 54.549
L 82.248 49.775
L 67.553 20.000
L 52.858 49.775
L 20.000 54.549
L 43.777 77.725
L 38.164 110.451
L 67.553 95.000 z
"
class="star"
transform-origin="50%,50%"
/>
<circle cx="67.553" cy="70" r="20" class="star-hole" />
</g>
</g>
</symbol>
</defs>
</svg>
<h1>Welcome to Dragster demo page!</h1>
<h2>Dragster - Basic example demo</h2>
<p>
The blocks below can be dragged and dropped in any region except the last one, which is a drag-only region.
The elements from the last region will be copied when dropping on any droppable region.
</p>
<div class="regions" id="container-0">
<div class="dragster-region">
<div class="dragster-block" data-testid="drag-target">1.1</div>
<div class="dragster-block">
<h3>Dragster Block 1.2</h3>
<svg><use xlink:href="#logo"></use></svg>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>
</div>
<div class="dragster-block">1.3</div>
<div class="dragster-block">1.4</div>
</div>
<div class="dragster-region" data-testid="test-drop-copy">
<div class="dragster-block" data-testid="drop-target">
<h3>Dragster Block 2.1</h3>
<svg><use xlink:href="#logo"></use></svg>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>
</div>
<div class="dragster-block">2.2</div>
<div class="dragster-block">2.3</div>
<div class="dragster-block">2.4</div>
</div>
<div class="dragster-region dragster-region--drag-only" data-testid="no-drop">
<div class="dragster-block" data-testid="copy-only-target">3.1</div>
<div class="dragster-block">3.2</div>
<div class="dragster-block">3.3</div>
<p>Elements cannot be dropped here. They are copied from here.</p>
</div>
</div>
<h2>Dragster - Draggable elements inside a draggable element demo</h2>
<p>
The example below is a bit more advanced. It shows the possibility of implementing a drag'n'drop
functionality inside a draggable element.
</p>
<div class="regions" id="container-1">
<div class="dragster-region">
<div class="dragster-block">4.1</div>
<div class="dragster-block">
<h3>Dragster Block 4.2</h3>
<svg><use xlink:href="#logo"></use></svg>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>
</div>
<div class="dragster-block">4.3</div>
<div class="dragster-block">4.4</div>
</div>
<div class="dragster-region">
<div class="dragster-block">Dragster Block 5.1</div>
<div class="dragster-block">
<h3>5.2 Second region - independent</h3>
<div class="regions" id="container-2">
<div class="dragster-region">
<div class="dragster-block">6.1</div>
<div class="dragster-block">Dragster Block 6.2</div>
<div class="dragster-block">6.3</div>
<div class="dragster-block">6.4</div>
</div>
<div class="dragster-region">
<div class="dragster-block">Dragster Block 7.1</div>
<div class="dragster-block">7.2</div>
<div class="dragster-block">7.3</div>
<div class="dragster-block">7.4</div>
</div>
</div>
</div>
</div>
</div>
<h2>Dragster - Replace elements demo</h2>
<p>In this example you can see replacing elements in action</p>
<div class="regions" id="container-3">
<div class="dragster-region">
<div class="dragster-block">8.1</div>
<div class="dragster-block">
<h3>Dragster Block 8.2</h3>
<svg><use xlink:href="#logo"></use></svg>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>
</div>
<div class="dragster-block">8.3</div>
<div class="dragster-block">8.4</div>
</div>
<div class="dragster-region">
<div class="dragster-block">Dragster Block 9.1</div>
<div class="dragster-block">9.2</div>
</div>
</div>
<script src="dragster-script.js"></script>
<script>
(function () {
const d0 = Dragster({
cloneElements: true,
regionSelector: '#container-0 > .dragster-region',
elementSelector: '#container-0 > .dragster-region > .dragster-block',
dragOnlyRegionsEnabled: true,
});
const d1 = Dragster({
regionSelector: '#container-1 > .dragster-region',
elementSelector: '#container-1 > .dragster-region > .dragster-block',
});
const d2 = Dragster({
cloneElements: false,
regionSelector: '#container-2 > .dragster-region',
elementSelector: '#container-2 > .dragster-region > .dragster-block',
});
const d3 = Dragster({
replaceElements: true,
regionSelector: '#container-3 > .dragster-region',
elementSelector: '#container-3 > .dragster-region > .dragster-block',
});
})();
</script>
</body>
</html>