From fddda77523955bb0324517bdc43d40d00d2e9c8f Mon Sep 17 00:00:00 2001 From: vineethvk11 Date: Fri, 15 Mar 2024 20:32:47 +0530 Subject: [PATCH 1/7] adding ability to customise desktop by arranging items --- src/UI/UIDesktop.js | 25 +++++++++++++++++++++ src/UI/UIItem.js | 14 ++++++++++++ src/globals.js | 2 ++ src/helpers.js | 54 ++++++++++++++++++++++++++++++++++++++++++++- src/initgui.js | 2 ++ 5 files changed, 96 insertions(+), 1 deletion(-) diff --git a/src/UI/UIDesktop.js b/src/UI/UIDesktop.js index 2926f433..adc48ed0 100644 --- a/src/UI/UIDesktop.js +++ b/src/UI/UIDesktop.js @@ -623,8 +623,28 @@ async function UIDesktop(options){ { html: "Sort by", items: [ + { + html: `Auto Arrange`, + icon: is_auto_arrange_enabled ? '✓' : '', + onClick: async function(){ + is_auto_arrange_enabled = !is_auto_arrange_enabled; + store_auto_arrange_preference(is_auto_arrange_enabled); + if(is_auto_arrange_enabled){ + sort_items(el_desktop, $(el_desktop).attr('data-sort_by'), $(el_desktop).attr('data-sort_order')); + set_sort_by(options.desktop_fsentry.uid, $(el_desktop).attr('data-sort_by'), $(el_desktop).attr('data-sort_order')) + clear_desktop_item_positions(el_desktop); + }else{ + set_desktop_item_positions(el_desktop) + } + } + }, + // ------------------------------------------- + // - + // ------------------------------------------- + '-', { html: `Name`, + disabled: !is_auto_arrange_enabled, icon: $(el_desktop).attr('data-sort_by') === 'name' ? '✓' : '', onClick: async function(){ sort_items(el_desktop, 'name', $(el_desktop).attr('data-sort_order')); @@ -633,6 +653,7 @@ async function UIDesktop(options){ }, { html: `Date modified`, + disabled: !is_auto_arrange_enabled, icon: $(el_desktop).attr('data-sort_by') === 'modified' ? '✓' : '', onClick: async function(){ sort_items(el_desktop, 'modified', $(el_desktop).attr('data-sort_order')); @@ -641,6 +662,7 @@ async function UIDesktop(options){ }, { html: `Type`, + disabled: !is_auto_arrange_enabled, icon: $(el_desktop).attr('data-sort_by') === 'type' ? '✓' : '', onClick: async function(){ sort_items(el_desktop, 'type', $(el_desktop).attr('data-sort_order')); @@ -649,6 +671,7 @@ async function UIDesktop(options){ }, { html: `Size`, + disabled: !is_auto_arrange_enabled, icon: $(el_desktop).attr('data-sort_by') === 'size' ? '✓' : '', onClick: async function(){ sort_items(el_desktop, 'size', $(el_desktop).attr('data-sort_order')); @@ -661,6 +684,7 @@ async function UIDesktop(options){ '-', { html: `Ascending`, + disabled: !is_auto_arrange_enabled, icon: $(el_desktop).attr('data-sort_order') === 'asc' ? '✓' : '', onClick: async function(){ const sort_by = $(el_desktop).attr('data-sort_by') @@ -670,6 +694,7 @@ async function UIDesktop(options){ }, { html: `Descending`, + disabled: !is_auto_arrange_enabled, icon: $(el_desktop).attr('data-sort_order') === 'desc' ? '✓' : '', onClick: async function(){ const sort_by = $(el_desktop).attr('data-sort_by') diff --git a/src/UI/UIItem.js b/src/UI/UIItem.js index e90f420f..88228010 100644 --- a/src/UI/UIItem.js +++ b/src/UI/UIItem.js @@ -187,6 +187,13 @@ function UIItem(options){ update_explorer_footer_item_count(el_window); } + // position + if(!is_auto_arrange_enabled && options.position && $(el_item).attr('data-path') !== trash_path){ + el_item.style.position = 'absolute'; + el_item.style.left = options.position.left + 'px'; + el_item.style.top = options.position.top + 'px'; + } + // -------------------------------------------------------- // Dragster // allow dragging of local files on this window, if it's is_dir @@ -335,6 +342,13 @@ function UIItem(options){ } }, stop: function(event, ui){ + if(!is_auto_arrange_enabled && $(el_item).attr('data-path') !== trash_path){ + el_item.style.position = 'absolute'; + el_item.style.left = ui.position.left + 'px'; + el_item.style.top = ui.position.top + 'px'; + $('.ui-draggable-dragging').remove(); + save_item_position($(el_item).attr('data-uid'), ui.position) + } $('.item-selected-clone').remove(); $('.draggable-count-badge').remove(); // re-enable all droppable UIItems that are not a dir diff --git a/src/globals.js b/src/globals.js index f5ff998a..ac9a027a 100644 --- a/src/globals.js +++ b/src/globals.js @@ -174,3 +174,5 @@ window.feature_flags = { // if true, the user will be able to zip and download directories download_directory: true, } + +window.is_auto_arrange_enabled = true; \ No newline at end of file diff --git a/src/helpers.js b/src/helpers.js index a12fb405..1cfe2c75 100644 --- a/src/helpers.js +++ b/src/helpers.js @@ -1295,6 +1295,9 @@ window.refresh_item_container = function(el_item_container, options){ if(item_path !== trash_path && item_path !== appdata_path){ // if this is trash, get original name from item metadata fsentry.name = (metadata && metadata.original_name !== undefined) ? metadata.original_name : fsentry.name; + let position; + if($(el_item_container).hasClass('desktop') && !is_auto_arrange_enabled) + position = await get_item_position(fsentry.uid); UIItem({ appendTo: el_item_container, uid: fsentry.uid, @@ -1317,6 +1320,7 @@ window.refresh_item_container = function(el_item_container, options){ suggested_apps: fsentry.suggested_apps, disabled: is_disabled, visible: visible, + position: position, }); } } @@ -3695,4 +3699,52 @@ window.get_html_element_from_options = async function(options){ h += ``; return h; -} \ No newline at end of file +} + +window.store_auto_arrange_preference = (preference)=>{ + puter.kv.set(`user_preferences.auto_arrange_desktop`, preference); + localStorage.setItem('auto_arrange', preference); +} + +window.get_auto_arrange_preference = async()=>{ + const preferenceValue = await puter.kv.get(`user_preferences.auto_arrange_desktop`); + if (preferenceValue === null) { + console.log("E") + return true; + } else { + return preferenceValue; + } +} + +window.clear_desktop_item_positions = async(el_desktop)=>{ + $(el_desktop).find('.item').each(function(){ + const el_item = $(this)[0]; + $(el_item).css('position', ''); + $(el_item).css('left', ''); + $(el_item).css('top', ''); + }); +} + +window.set_desktop_item_positions = async(el_desktop)=>{ + $(el_desktop).find('.item').each(async function(){ + const position = await get_item_position($(this).attr('data-uid')); + const el_item = $(this)[0]; + if(position){ + $(el_item).css('position', 'absolute'); + $(el_item).css('left', position.left + 'px'); + $(el_item).css('top', position.top + 'px'); + } + }); +} + +window.save_item_position = (itemId, position)=>{ + puter.kv.set(`desktop_item_position_${itemId}`, position); +} + +window.get_item_position = (itemId)=>{ + return puter.kv.get(`desktop_item_position_${itemId}`); +} + +window.delete_item_position = (itemId)=>{ + return puter.kv.del(`desktop_item_position_${itemId}`); +} diff --git a/src/initgui.js b/src/initgui.js index 097dd037..6987e96e 100644 --- a/src/initgui.js +++ b/src/initgui.js @@ -318,6 +318,7 @@ window.initgui = async function(){ // Load desktop, only if we're not embedded in a popup // ------------------------------------------------------------------------------------- if(!window.embedded_in_popup){ + window.is_auto_arrange_enabled = await get_auto_arrange_preference(); puter.fs.stat(desktop_path, async function(desktop_fsentry){ UIDesktop({desktop_fsentry: desktop_fsentry}); }) @@ -669,6 +670,7 @@ window.initgui = async function(){ // Load desktop, if not embedded in a popup // ------------------------------------------------------------------------------------- if(!window.embedded_in_popup){ + window.is_auto_arrange_enabled = await get_auto_arrange_preference(); puter.fs.stat(desktop_path, function (desktop_fsentry) { UIDesktop({ desktop_fsentry: desktop_fsentry }); }) From dfc03be3d26eab1204c764dda7af8a6a1431359f Mon Sep 17 00:00:00 2001 From: vineethvk11 Date: Sat, 16 Mar 2024 11:32:11 +0530 Subject: [PATCH 2/7] optimising by storing desktop item positions as a map in kv store --- src/UI/UIItem.js | 3 ++- src/globals.js | 3 ++- src/helpers.js | 32 +++++++++----------------------- src/initgui.js | 4 ++-- 4 files changed, 15 insertions(+), 27 deletions(-) diff --git a/src/UI/UIItem.js b/src/UI/UIItem.js index 88228010..3c8d547a 100644 --- a/src/UI/UIItem.js +++ b/src/UI/UIItem.js @@ -347,7 +347,8 @@ function UIItem(options){ el_item.style.left = ui.position.left + 'px'; el_item.style.top = ui.position.top + 'px'; $('.ui-draggable-dragging').remove(); - save_item_position($(el_item).attr('data-uid'), ui.position) + desktop_item_positions[$(el_item).attr('data-uid')] = ui.position; + save_desktop_item_positions() } $('.item-selected-clone').remove(); $('.draggable-count-badge').remove(); diff --git a/src/globals.js b/src/globals.js index ac9a027a..330d2007 100644 --- a/src/globals.js +++ b/src/globals.js @@ -175,4 +175,5 @@ window.feature_flags = { download_directory: true, } -window.is_auto_arrange_enabled = true; \ No newline at end of file +window.is_auto_arrange_enabled = true; +window.desktop_item_positions = {}; \ No newline at end of file diff --git a/src/helpers.js b/src/helpers.js index 1cfe2c75..8844b9fb 100644 --- a/src/helpers.js +++ b/src/helpers.js @@ -1295,9 +1295,7 @@ window.refresh_item_container = function(el_item_container, options){ if(item_path !== trash_path && item_path !== appdata_path){ // if this is trash, get original name from item metadata fsentry.name = (metadata && metadata.original_name !== undefined) ? metadata.original_name : fsentry.name; - let position; - if($(el_item_container).hasClass('desktop') && !is_auto_arrange_enabled) - position = await get_item_position(fsentry.uid); + const position = desktop_item_positions[fsentry.uid] ?? undefined; UIItem({ appendTo: el_item_container, uid: fsentry.uid, @@ -3702,18 +3700,14 @@ window.get_html_element_from_options = async function(options){ } window.store_auto_arrange_preference = (preference)=>{ - puter.kv.set(`user_preferences.auto_arrange_desktop`, preference); + puter.kv.set('user_preferences.auto_arrange_desktop', preference); localStorage.setItem('auto_arrange', preference); } -window.get_auto_arrange_preference = async()=>{ - const preferenceValue = await puter.kv.get(`user_preferences.auto_arrange_desktop`); - if (preferenceValue === null) { - console.log("E") - return true; - } else { - return preferenceValue; - } +window.get_auto_arrange_data = async()=>{ + const preferenceValue = await puter.kv.get('user_preferences.auto_arrange_desktop'); + is_auto_arrange_enabled = preferenceValue === null ? true : preferenceValue; + desktop_item_positions = await puter.kv.get('desktop_item_positions'); } window.clear_desktop_item_positions = async(el_desktop)=>{ @@ -3727,7 +3721,7 @@ window.clear_desktop_item_positions = async(el_desktop)=>{ window.set_desktop_item_positions = async(el_desktop)=>{ $(el_desktop).find('.item').each(async function(){ - const position = await get_item_position($(this).attr('data-uid')); + const position = desktop_item_positions[$(this).attr('data-uid')] const el_item = $(this)[0]; if(position){ $(el_item).css('position', 'absolute'); @@ -3737,14 +3731,6 @@ window.set_desktop_item_positions = async(el_desktop)=>{ }); } -window.save_item_position = (itemId, position)=>{ - puter.kv.set(`desktop_item_position_${itemId}`, position); -} - -window.get_item_position = (itemId)=>{ - return puter.kv.get(`desktop_item_position_${itemId}`); -} - -window.delete_item_position = (itemId)=>{ - return puter.kv.del(`desktop_item_position_${itemId}`); +window.save_desktop_item_positions = ()=>{ + puter.kv.set('desktop_item_positions', desktop_item_positions); } diff --git a/src/initgui.js b/src/initgui.js index 6987e96e..f8a01cae 100644 --- a/src/initgui.js +++ b/src/initgui.js @@ -318,7 +318,7 @@ window.initgui = async function(){ // Load desktop, only if we're not embedded in a popup // ------------------------------------------------------------------------------------- if(!window.embedded_in_popup){ - window.is_auto_arrange_enabled = await get_auto_arrange_preference(); + await get_auto_arrange_data() puter.fs.stat(desktop_path, async function(desktop_fsentry){ UIDesktop({desktop_fsentry: desktop_fsentry}); }) @@ -670,7 +670,7 @@ window.initgui = async function(){ // Load desktop, if not embedded in a popup // ------------------------------------------------------------------------------------- if(!window.embedded_in_popup){ - window.is_auto_arrange_enabled = await get_auto_arrange_preference(); + await get_auto_arrange_data(); puter.fs.stat(desktop_path, function (desktop_fsentry) { UIDesktop({ desktop_fsentry: desktop_fsentry }); }) From c63e546a9c92eff596a8a9516db3030a789e8e38 Mon Sep 17 00:00:00 2001 From: vineethvk11 Date: Sun, 17 Mar 2024 09:52:02 +0530 Subject: [PATCH 3/7] minor bug fix in desktop item positions arrangement --- src/helpers.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/helpers.js b/src/helpers.js index 8844b9fb..3737d483 100644 --- a/src/helpers.js +++ b/src/helpers.js @@ -3707,7 +3707,8 @@ window.store_auto_arrange_preference = (preference)=>{ window.get_auto_arrange_data = async()=>{ const preferenceValue = await puter.kv.get('user_preferences.auto_arrange_desktop'); is_auto_arrange_enabled = preferenceValue === null ? true : preferenceValue; - desktop_item_positions = await puter.kv.get('desktop_item_positions'); + const positions = await puter.kv.get('desktop_item_positions') + desktop_item_positions = (positions === null || typeof positions !== 'object') ? {} : positions; } window.clear_desktop_item_positions = async(el_desktop)=>{ From ed663c082419b1062c7cf5aa111edcc94d3a08b9 Mon Sep 17 00:00:00 2001 From: vineethvk11 Date: Mon, 18 Mar 2024 09:14:51 +0530 Subject: [PATCH 4/7] fixing issues in auto arrange while moving items --- src/UI/UIItem.js | 13 +++++++++++-- src/globals.js | 3 ++- src/helpers.js | 8 ++++++++ 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/UI/UIItem.js b/src/UI/UIItem.js index 3c8d547a..343ae553 100644 --- a/src/UI/UIItem.js +++ b/src/UI/UIItem.js @@ -188,7 +188,7 @@ function UIItem(options){ } // position - if(!is_auto_arrange_enabled && options.position && $(el_item).attr('data-path') !== trash_path){ + if(!is_auto_arrange_enabled && options.position && $(el_item).closest('.item-container').attr('data-path') === window.desktop_path){ el_item.style.position = 'absolute'; el_item.style.left = options.position.left + 'px'; el_item.style.top = options.position.top + 'px'; @@ -342,7 +342,9 @@ function UIItem(options){ } }, stop: function(event, ui){ - if(!is_auto_arrange_enabled && $(el_item).attr('data-path') !== trash_path){ + // Allow rearranging only if item is on desktop, not trash container, auto arrange is disabled and item is not dropped into another item + if($(el_item).closest('.item-container').attr('data-path') === window.desktop_path && + !is_auto_arrange_enabled && $(el_item).attr('data-path') !== trash_path && !ui.helper.data('dropped')){ el_item.style.position = 'absolute'; el_item.style.left = ui.position.left + 'px'; el_item.style.top = ui.position.top + 'px'; @@ -378,6 +380,9 @@ function UIItem(options){ if(event.ctrlKey && path.dirname($(ui.draggable).attr('data-path')) === window.trash_path) return; + // Adding a flag to know whether item is rearraged or dropped + ui.helper.data('dropped', true); + const items_to_move = [] // First item @@ -452,6 +457,10 @@ function UIItem(options){ } // Otherwise, move items else if(options.is_dir){ + if($(el_item).closest('.item-container').attr('data-path') === window.desktop_path){ + delete desktop_item_positions[$(el_item).attr('data-uid')]; + save_desktop_item_positions() + } move_items(items_to_move, $(el_item).attr('data-shortcut_to_path') !== '' ? $(el_item).attr('data-shortcut_to_path') : $(el_item).attr('data-path')); } } diff --git a/src/globals.js b/src/globals.js index 330d2007..4f7864e6 100644 --- a/src/globals.js +++ b/src/globals.js @@ -176,4 +176,5 @@ window.feature_flags = { } window.is_auto_arrange_enabled = true; -window.desktop_item_positions = {}; \ No newline at end of file +window.desktop_item_positions = {}; +window.reset_item_positions = true; // The variable decides if the item positions should be reset when the user enabled auto arrange \ No newline at end of file diff --git a/src/helpers.js b/src/helpers.js index 3737d483..55133cff 100644 --- a/src/helpers.js +++ b/src/helpers.js @@ -3718,6 +3718,9 @@ window.clear_desktop_item_positions = async(el_desktop)=>{ $(el_item).css('left', ''); $(el_item).css('top', ''); }); + if(reset_item_positions){ + delete_desktop_item_positions() + } } window.set_desktop_item_positions = async(el_desktop)=>{ @@ -3735,3 +3738,8 @@ window.set_desktop_item_positions = async(el_desktop)=>{ window.save_desktop_item_positions = ()=>{ puter.kv.set('desktop_item_positions', desktop_item_positions); } + +window.delete_desktop_item_positions = ()=>{ + desktop_item_positions = {} + puter.kv.del('desktop_item_positions'); +} \ No newline at end of file From 8ef6167915690069c3101b48dfce7caca73167d0 Mon Sep 17 00:00:00 2001 From: vineethvk11 Date: Mon, 18 Mar 2024 09:29:23 +0530 Subject: [PATCH 5/7] adding language support for auto arrange word --- src/UI/UIDesktop.js | 20 +++++++------------- src/i18n/i18n.js | 4 ++++ 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/UI/UIDesktop.js b/src/UI/UIDesktop.js index c5732a8a..7b74cd8e 100644 --- a/src/UI/UIDesktop.js +++ b/src/UI/UIDesktop.js @@ -625,7 +625,7 @@ async function UIDesktop(options){ html: i18n('sort_by'), items: [ { - html: `Auto Arrange`, + html: i18n('auto_arrange'), icon: is_auto_arrange_enabled ? '✓' : '', onClick: async function(){ is_auto_arrange_enabled = !is_auto_arrange_enabled; @@ -644,9 +644,8 @@ async function UIDesktop(options){ // ------------------------------------------- '-', { - html: `Name`, - disabled: !is_auto_arrange_enabled, html: i18n('name'), + disabled: !is_auto_arrange_enabled, icon: $(el_desktop).attr('data-sort_by') === 'name' ? '✓' : '', onClick: async function(){ sort_items(el_desktop, 'name', $(el_desktop).attr('data-sort_order')); @@ -654,9 +653,8 @@ async function UIDesktop(options){ } }, { - html: `Date modified`, - disabled: !is_auto_arrange_enabled, html: i18n('date_modified'), + disabled: !is_auto_arrange_enabled, icon: $(el_desktop).attr('data-sort_by') === 'modified' ? '✓' : '', onClick: async function(){ sort_items(el_desktop, 'modified', $(el_desktop).attr('data-sort_order')); @@ -664,9 +662,8 @@ async function UIDesktop(options){ } }, { - html: `Type`, - disabled: !is_auto_arrange_enabled, html: i18n('type'), + disabled: !is_auto_arrange_enabled, icon: $(el_desktop).attr('data-sort_by') === 'type' ? '✓' : '', onClick: async function(){ sort_items(el_desktop, 'type', $(el_desktop).attr('data-sort_order')); @@ -674,9 +671,8 @@ async function UIDesktop(options){ } }, { - html: `Size`, - disabled: !is_auto_arrange_enabled, html: i18n('size'), + disabled: !is_auto_arrange_enabled, icon: $(el_desktop).attr('data-sort_by') === 'size' ? '✓' : '', onClick: async function(){ sort_items(el_desktop, 'size', $(el_desktop).attr('data-sort_order')); @@ -688,9 +684,8 @@ async function UIDesktop(options){ // ------------------------------------------- '-', { - html: `Ascending`, - disabled: !is_auto_arrange_enabled, html: i18n('ascending'), + disabled: !is_auto_arrange_enabled, icon: $(el_desktop).attr('data-sort_order') === 'asc' ? '✓' : '', onClick: async function(){ const sort_by = $(el_desktop).attr('data-sort_by') @@ -699,9 +694,8 @@ async function UIDesktop(options){ } }, { - html: `Descending`, - disabled: !is_auto_arrange_enabled, html: i18n('descending'), + disabled: !is_auto_arrange_enabled, icon: $(el_desktop).attr('data-sort_order') === 'desc' ? '✓' : '', onClick: async function(){ const sort_by = $(el_desktop).attr('data-sort_by') diff --git a/src/i18n/i18n.js b/src/i18n/i18n.js index 167500bd..3a4559e0 100644 --- a/src/i18n/i18n.js +++ b/src/i18n/i18n.js @@ -188,6 +188,7 @@ window.translations = { yes_release_it: 'Yes, Release It', you_have_been_referred_to_puter_by_a_friend: "You have been referred to Puter by a friend!", zip: "Zip", + auto_arrange: "Auto Arrange", }, // farsi fa: { @@ -330,6 +331,7 @@ window.translations = { yes_release_it: 'بله، آن را آزاد کن', you_have_been_referred_to_puter_by_a_friend: "شما توسط یک دوست به Puter معرفی شده اید!", zip: "فشرده سازی", + auto_arrange: "تنظیم خودکار", }, // korean ko: { @@ -472,6 +474,7 @@ window.translations = { yes_release_it: '예, 해제합니다', you_have_been_referred_to_puter_by_a_friend: "친구가 Puter로 추천했습니다!", zip: "압축", + auto_arrange: "자동 정렬", }, zh: { access_granted_to: "访问授权给", @@ -613,5 +616,6 @@ window.translations = { yes_release_it: '是的,释放它', you_have_been_referred_to_puter_by_a_friend: "您已经被朋友推荐到 Puter!", zip: "压缩", + auto_arrange: "自动排列" }, } \ No newline at end of file From 3e2ad61189fa2bc7dd1c9d9bc262d2b34dd4a69d Mon Sep 17 00:00:00 2001 From: Nariman Jelveh Date: Sun, 17 Mar 2024 21:16:15 -0700 Subject: [PATCH 6/7] Fix issue with detecting whether `positions` is an object or not --- src/helpers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/helpers.js b/src/helpers.js index fede2949..a318fb73 100644 --- a/src/helpers.js +++ b/src/helpers.js @@ -3623,7 +3623,7 @@ window.get_auto_arrange_data = async()=>{ const preferenceValue = await puter.kv.get('user_preferences.auto_arrange_desktop'); is_auto_arrange_enabled = preferenceValue === null ? true : preferenceValue; const positions = await puter.kv.get('desktop_item_positions') - desktop_item_positions = (positions === null || typeof positions !== 'object') ? {} : positions; + desktop_item_positions = (!positions || typeof positions !== 'object' || Array.isArray(positions)) ? {} : positions; } window.clear_desktop_item_positions = async(el_desktop)=>{ From c495d9f8fd214fb05d232bced19ae9d90c067395 Mon Sep 17 00:00:00 2001 From: Nariman Jelveh Date: Mon, 18 Mar 2024 18:20:05 -0700 Subject: [PATCH 7/7] Allow manual arrangement only if item is being dropped directly on the Desktop --- src/UI/UIItem.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/UI/UIItem.js b/src/UI/UIItem.js index 6780145f..102a0205 100644 --- a/src/UI/UIItem.js +++ b/src/UI/UIItem.js @@ -344,7 +344,10 @@ function UIItem(options){ stop: function(event, ui){ // Allow rearranging only if item is on desktop, not trash container, auto arrange is disabled and item is not dropped into another item if($(el_item).closest('.item-container').attr('data-path') === window.desktop_path && - !is_auto_arrange_enabled && $(el_item).attr('data-path') !== trash_path && !ui.helper.data('dropped')){ + !is_auto_arrange_enabled && $(el_item).attr('data-path') !== trash_path && !ui.helper.data('dropped') && + // Item must be dropped on the Desktop + mouseover_window === undefined){ + el_item.style.position = 'absolute'; el_item.style.left = ui.position.left + 'px'; el_item.style.top = ui.position.top + 'px';