Browse Source

bugfix: stopping event from bubbling up on item drag and drop

module/document
Stephan Richter 2 weeks ago
parent
commit
1acf54f58a
  1. 9
      frontend/src/routes/stock/Locations.svelte

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

@ -43,6 +43,13 @@
new_location_name = ''; new_location_name = '';
} }
function onDrop(ev, new_loc){
ev.preventDefault();
ev.stopPropagation();
move_dragged_to(new_loc);
return false;
}
async function onSet(new_location_name){ async function onSet(new_location_name){
const data = { const data = {
name: new_location_name, name: new_location_name,
@ -96,7 +103,7 @@
<li onclick={e => toggleChildren(e, location)} <li onclick={e => toggleChildren(e, location)}
class="{location.locations?'expanded':'collapsed'} {location.highlight?'highlight':null}" class="{location.locations?'expanded':'collapsed'} {location.highlight?'highlight':null}"
ondragover={e => drag_over(e,location)} ondragover={e => drag_over(e,location)}
ondrop={e => move_dragged_to(location)} ondrop={e => onDrop(e,location)}
ondragleave={e => delete location.highlight}> ondragleave={e => delete location.highlight}>
<span class="name">{location.name}</span> <span class="name">{location.name}</span>
{#if location.locations} {#if location.locations}

Loading…
Cancel
Save