|
@@ -3498,14 +3498,47 @@
|
|
|
var targetLocation = findClosestGrid((ev.clientX), (ev.clientY), false);
|
|
|
var targetGridLocation = targetLocation[1];
|
|
|
var locations = [];
|
|
|
+
|
|
|
+ //Rewrite of the upload file target location, 2022-02-02
|
|
|
+ //Back step the y location of drag point by 1
|
|
|
+ targetGridLocation[1] = targetGridLocation[1] - 1;
|
|
|
+ var nextLocation = JSON.parse(JSON.stringify(targetGridLocation));
|
|
|
+ for (var k =0; k < files.length; k++){
|
|
|
+ if (nextLocation[1] >= gridMaxY && nextLocation[0] >= gridMaxX){
|
|
|
+ //Desktop full. Force put to 0 0
|
|
|
+ nextLocation[0] = 0;
|
|
|
+ nextLocation[1] = 0;
|
|
|
+ locations.push(JSON.parse(JSON.stringify(nextLocation)));
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ //Add 1 to the file y position
|
|
|
+ nextLocation[1] += 1;
|
|
|
+ if (nextLocation[1] >= gridMaxY){
|
|
|
+ //If y overflow, move to next x lane
|
|
|
+ nextLocation[0] += 1;
|
|
|
+ nextLocation[1] = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ //Check if this position is occupied, update next placement location if true
|
|
|
+ while (getObjectFromGridLocation(nextLocation[0], nextLocation[1]) !== undefined){
|
|
|
+ let gridLocation = getLocationFromGridIndex(nextLocation[0], nextLocation[1]);
|
|
|
+ let newAssignmentLocation = findClostestEmptyGridLocation(gridLocation[0],gridLocation[1]);
|
|
|
+ nextLocation = newAssignmentLocation;
|
|
|
+ console.log("Not empty. Updating")
|
|
|
+ }
|
|
|
|
|
|
+ locations.push(JSON.parse(JSON.stringify(nextLocation)));
|
|
|
+ }
|
|
|
+
|
|
|
+ /*
|
|
|
for (var k =0; k < files.length; k++){
|
|
|
var thisLocation = JSON.parse(JSON.stringify(targetGridLocation));
|
|
|
//Add k to y axis of the list.
|
|
|
thisLocation[1] += k;
|
|
|
if (thisLocation[1] >= gridMaxY){
|
|
|
thisLocation[0]++;
|
|
|
- thisLocation[1] = 0;
|
|
|
+ thisLocation[1] = thisLocation[1] % gridMaxY;
|
|
|
}
|
|
|
if (thisLocation[1] >= gridMaxY && thisLocation[0] >= gridMaxX){
|
|
|
//Desktop full. Force put to 0 0
|
|
@@ -3530,6 +3563,7 @@
|
|
|
}
|
|
|
locations.push(thisLocation)
|
|
|
}
|
|
|
+ */
|
|
|
|
|
|
console.log(locations, ev.dataTransfer.files);
|
|
|
|
|
@@ -4009,7 +4043,7 @@
|
|
|
y = y - iconOffsetXY[1];
|
|
|
//Get the grid index from absolute coordinate
|
|
|
var currentGridLocation = getGridIndexFromLocation(x,y);
|
|
|
- console.log(currentGridLocation);
|
|
|
+ //console.log(currentGridLocation);
|
|
|
//Search for the next empty location
|
|
|
var targetLocation = [[-1,-1],[-1,-1]];
|
|
|
for (var i = currentGridLocation[0]; i < desktopGrids.length; i++){
|
|
@@ -4329,25 +4363,28 @@
|
|
|
if (data.error !== undefined){
|
|
|
alert(data.error);
|
|
|
}else{
|
|
|
- refresh(undefined, true);
|
|
|
+ //Delete the file's desktop location
|
|
|
+ deleteFilenameList.forEach(file => {
|
|
|
+ $.ajax({
|
|
|
+ url: "system/desktop/files",
|
|
|
+ data: {del: file},
|
|
|
+ success: function(data){
|
|
|
+ if (data.error !== undefined){
|
|
|
+ console.log(data.error);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ setTimeout(function(){
|
|
|
+ refresh(undefined, true);
|
|
|
+ }, 500);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
|
|
|
- //Delete the file's desktop location
|
|
|
- deleteFilenameList.forEach(file => {
|
|
|
- $.ajax({
|
|
|
- url: "system/desktop/files",
|
|
|
- data: {del: file},
|
|
|
- success: function(data){
|
|
|
- if (data.error !== undefined){
|
|
|
- console.log(data.error);
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- })
|
|
|
+
|
|
|
|
|
|
}else if (keycode == "112"){
|
|
|
//Enter key
|
|
@@ -6233,6 +6270,7 @@
|
|
|
hideAllContextMenus();
|
|
|
}
|
|
|
|
|
|
+ /*
|
|
|
var screenshotBuf = [];
|
|
|
var totalFloatWindowsLeft = 0;
|
|
|
function screenshot(){
|
|
@@ -6254,10 +6292,16 @@
|
|
|
}
|
|
|
})
|
|
|
}else{
|
|
|
- alert("Not Found");
|
|
|
+ //Float window do not allow screenshot
|
|
|
}
|
|
|
-
|
|
|
});
|
|
|
+
|
|
|
+ if (totalFloatWindowsLeft == 0){
|
|
|
+ setTimeout(function(){
|
|
|
+ mergeScreenshotCanvas();
|
|
|
+ }, 500);
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
function mergeScreenshotCanvas(){
|
|
@@ -6292,14 +6336,13 @@
|
|
|
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
function downloadCanvas(canvas){
|
|
|
var aDownloadLink = document.createElement('a');
|
|
|
aDownloadLink.download = `screenshot_${new Date().toLocaleString(undefined, {year: 'numeric', month: '2-digit', day: '2-digit', weekday:"long", hour: '2-digit', hour12: false, minute:'2-digit', second:'2-digit'}).split(":").join("_").split("/").join("-")}.png`;
|
|
|
aDownloadLink.href = canvas.toDataURL();
|
|
|
aDownloadLink.click();
|
|
|
}
|
|
|
+ */
|
|
|
|
|
|
//Function for converting bytes to human readable sizes
|
|
|
function formatBytes(a,b=2){if(0===a)return"0 Bytes";const c=0>b?0:b,d=Math.floor(Math.log(a)/Math.log(1024));return parseFloat((a/Math.pow(1024,d)).toFixed(c))+" "+["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"][d]}
|