@@ -36,6 +36,16 @@ let notifContainer = document.querySelector("#notification-section");
36
36
var vh = window . innerHeight / 100 ;
37
37
var vw = window . innerWidth / 100 ;
38
38
39
+ let isTopBarClicked = false ;
40
+
41
+ let div = document . querySelector ( "#div" ) ;
42
+
43
+ let firstPositionX ;
44
+ let firstPositionY ;
45
+
46
+ let lastPositionX ;
47
+ let lastPositionY ;
48
+
39
49
/* from bottom to top WINDOWS START animation */
40
50
startBtn . addEventListener ( "click" , function ( ) {
41
51
searchContainer . style . display = "none" ;
@@ -74,6 +84,8 @@ searchBtn.addEventListener("click", function() {
74
84
75
85
/* windows moving tab */
76
86
topPartTab . addEventListener ( "mousedown" , function ( ) {
87
+
88
+ isTopBarClicked = true ;
77
89
console . log ( "mousedown" ) ;
78
90
document . onmousemove = function ( e ) {
79
91
var x = e . clientX ;
@@ -91,17 +103,17 @@ topPartTab.addEventListener("mousedown", function() {
91
103
windowsTab . style . left = x + "px" ;
92
104
windowsTab . style . top = y + "px" ;
93
105
if ( windowsTab . offsetHeight > 90 * vh ) {
94
- /* alert("la finestra è troppo grande, \nla sua dimensione è: " + windowsTab.offsetHeight + "px" + "\nla dimensione massima è: " + (90 * vh) + "px"); */
95
- windowsTab . style . height = "50vh" ;
106
+ windowsTab . style . height = "70vh" ;
96
107
}
97
108
windowsTab . style . removeProperty ( "transform" ) ;
98
109
}
99
- /* console.log("onmousemove\n" + "x:" + x + " y:" + y + "\n" + "MaxX:" + MaxX); */
100
110
}
111
+
101
112
} ) ;
102
113
103
114
document . addEventListener ( "mouseup" , function ( ) {
104
115
document . onmousemove = null ;
116
+
105
117
} ) ;
106
118
107
119
for ( let i = 0 ; i < appIcon . length ; i ++ ) {
@@ -182,4 +194,59 @@ function openOneWinCloseOther() {
182
194
} else {
183
195
startContainer . classList . toggle ( "on-visible-start" ) ;
184
196
}
185
- }
197
+ }
198
+
199
+ /* new code in beta */
200
+ function dragSelector ( ) {
201
+
202
+ document . addEventListener ( "mousedown" , function ( e1 ) {
203
+ if ( windowsTab . style . display == "grid" ) {
204
+ console . log ( "yessss risolto il bug!!!" )
205
+ } else {
206
+ div . style . display = "block" ;
207
+
208
+ div . style . width = 0 + "px" ;
209
+ div . style . height = 0 + "px" ;
210
+
211
+ firstPositionX = e1 . clientX ;
212
+ firstPositionY = e1 . clientY ;
213
+
214
+ div . style . top = firstPositionY + "px" ;
215
+ div . style . left = firstPositionX + "px" ;
216
+
217
+ div . style . transition = "none" ;
218
+
219
+ document . addEventListener ( "mousemove" , function ( e2 ) {
220
+ lastPositionX = e2 . clientX ;
221
+ lastPositionY = e2 . clientY ;
222
+
223
+ if ( ( firstPositionX - lastPositionX ) < 0 ) {
224
+ div . style . width = Math . round ( lastPositionX - firstPositionX ) + "px" ;
225
+ } else {
226
+ div . style . width = Math . round ( firstPositionX - lastPositionX ) + "px" ;
227
+ div . style . left = lastPositionX + "px" ;
228
+ }
229
+
230
+ if ( ( firstPositionY - lastPositionY ) < 0 ) {
231
+ div . style . height = Math . round ( lastPositionY - firstPositionY ) + "px" ;
232
+ } else {
233
+ div . style . height = Math . round ( firstPositionY - lastPositionY ) + "px" ;
234
+ div . style . top = lastPositionY + "px" ;
235
+ }
236
+
237
+ } ) ;
238
+
239
+ document . addEventListener ( "mouseup" , function ( ) {
240
+ div . style . width = "0px" ;
241
+ div . style . height = "0px" ;
242
+ div . style . transition = "all 0.3s" ;
243
+
244
+ setTimeout ( function ( ) {
245
+ div . style . display = "none" ;
246
+ } , 300 ) ;
247
+ } ) ;
248
+ }
249
+ } ) ;
250
+ }
251
+
252
+ dragSelector ( ) ;
0 commit comments