Browse Source

improving drag'n'drop of locations

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
module/document
Stephan Richter 1 week ago
parent
commit
ea616ed2a1
  1. 13
      frontend/src/routes/stock/Locations.svelte

13
frontend/src/routes/stock/Locations.svelte

@ -24,6 +24,11 @@
return false; return false;
} }
function start_drag(e,loc){
e.stopPropagation();
drag_start(loc)
}
function flat(x){ function flat(x){
return JSON.parse(JSON.stringify(x)); return JSON.parse(JSON.stringify(x));
} }
@ -98,12 +103,6 @@
} }
</script> </script>
<style>
.highlight > span{
background: lime;
}
</style>
<ul> <ul>
{#each locations as location} {#each locations as location}
<li onclick={e => toggleChildren(e, location)} <li onclick={e => toggleChildren(e, location)}
@ -112,7 +111,7 @@
ondragover={e => drag_over(e,location)} ondragover={e => drag_over(e,location)}
ondrop={e => onDrop(e,location)} ondrop={e => onDrop(e,location)}
ondragleave={e => delete location.highlight} ondragleave={e => delete location.highlight}
ondragstart={e => drag_start(location)} > ondragstart={e => start_drag(e,location)} >
<span class="name">{location.name}</span> <span class="name">{location.name}</span>
{#if location.locations} {#if location.locations}
<svelte:self locations={location.locations} {drag_start} {move_dragged_to} parent={{location:location.id}} bind:selected /> <svelte:self locations={location.locations} {drag_start} {move_dragged_to} parent={{location:location.id}} bind:selected />

Loading…
Cancel
Save