[test] sperate currentdrag from datatransfet
This commit is contained in:
@@ -84,6 +84,7 @@
|
|||||||
let charImages: sortType[] = [];
|
let charImages: sortType[] = [];
|
||||||
let IconRounded = false
|
let IconRounded = false
|
||||||
let openFolders:string[] = []
|
let openFolders:string[] = []
|
||||||
|
let currentDrag: DragData = null
|
||||||
|
|
||||||
const unsub = DataBase.subscribe((db) => {
|
const unsub = DataBase.subscribe((db) => {
|
||||||
let newCharImages: sortType[] = [];
|
let newCharImages: sortType[] = [];
|
||||||
@@ -271,9 +272,8 @@
|
|||||||
const avatarDrop = (ind:DragData, e:DragEv) => {
|
const avatarDrop = (ind:DragData, e:DragEv) => {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
try {
|
try {
|
||||||
const da = JSON.parse(e.dataTransfer.getData("application/json"))
|
if(currentDrag){
|
||||||
if(da.type === "risuDrag"){
|
createFolder(currentDrag,ind)
|
||||||
createFolder(da.index,ind)
|
|
||||||
}
|
}
|
||||||
} catch (error) {}
|
} catch (error) {}
|
||||||
}
|
}
|
||||||
@@ -307,9 +307,9 @@
|
|||||||
}} on:drop={(e) => {
|
}} on:drop={(e) => {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
e.currentTarget.classList.remove('bg-green-500')
|
e.currentTarget.classList.remove('bg-green-500')
|
||||||
const da = JSON.parse(e.dataTransfer.getData("application/json"))
|
const da = currentDrag
|
||||||
if(da.type === "risuDrag"){
|
if(da){
|
||||||
inserter(da.index,{index:0})
|
inserter(da,{index:0})
|
||||||
}
|
}
|
||||||
}} on:dragenter={preventAll} />
|
}} on:dragenter={preventAll} />
|
||||||
{#if menuMode === 0}
|
{#if menuMode === 0}
|
||||||
@@ -377,9 +377,9 @@
|
|||||||
}} on:drop={(e) => {
|
}} on:drop={(e) => {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
e.currentTarget.classList.remove('bg-green-500')
|
e.currentTarget.classList.remove('bg-green-500')
|
||||||
const da = JSON.parse(e.dataTransfer.getData("application/json"))
|
const da = currentDrag
|
||||||
if(da.type === "risuDrag", char.type === 'folder'){
|
if(da && char.type === 'folder'){
|
||||||
inserter(da.index,{index:0,folder:char.id})
|
inserter(da,{index:0,folder:char.id})
|
||||||
}
|
}
|
||||||
}} on:dragenter={preventAll}/>
|
}} on:dragenter={preventAll}/>
|
||||||
{#each char.folder as char2, ind}
|
{#each char.folder as char2, ind}
|
||||||
@@ -422,9 +422,9 @@
|
|||||||
}} on:drop={(e) => {
|
}} on:drop={(e) => {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
e.currentTarget.classList.remove('bg-green-500')
|
e.currentTarget.classList.remove('bg-green-500')
|
||||||
const da = JSON.parse(e.dataTransfer.getData("application/json"))
|
const da = currentDrag
|
||||||
if(da.type === "risuDrag" && char.type === 'folder'){
|
if(da && char.type === 'folder'){
|
||||||
inserter(da.index,{index:ind+1,folder:char.id})
|
inserter(da,{index:ind+1,folder:char.id})
|
||||||
}
|
}
|
||||||
}} on:dragenter={preventAll}/>
|
}} on:dragenter={preventAll}/>
|
||||||
{/each}
|
{/each}
|
||||||
@@ -438,9 +438,9 @@
|
|||||||
}} on:drop={(e) => {
|
}} on:drop={(e) => {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
e.currentTarget.classList.remove('bg-green-500')
|
e.currentTarget.classList.remove('bg-green-500')
|
||||||
const da = JSON.parse(e.dataTransfer.getData("application/json"))
|
const da = currentDrag
|
||||||
if(da.type === "risuDrag"){
|
if(da){
|
||||||
inserter(da.index,{index:ind+1})
|
inserter(da,{index:ind+1})
|
||||||
}
|
}
|
||||||
}} on:dragenter={preventAll} />
|
}} on:dragenter={preventAll} />
|
||||||
{/each}
|
{/each}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import {scrollBehaviourDragImageTranslateOverride} from "mobile-drag-drop/scroll
|
|||||||
dragDropPolyfil({
|
dragDropPolyfil({
|
||||||
// use this to make use of the scroll behaviour
|
// use this to make use of the scroll behaviour
|
||||||
dragImageTranslateOverride: scrollBehaviourDragImageTranslateOverride,
|
dragImageTranslateOverride: scrollBehaviourDragImageTranslateOverride,
|
||||||
|
forceApply: navigator.maxTouchPoints > 0,
|
||||||
holdToDrag: 400
|
holdToDrag: 400
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user