Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

212
Visualizações
How to make objects draggable like notion.so?
  • I am trying to have dragging feature just like notion.so so when you hover on an element a dragging icon appears then you drag the entire element by dragging the icon.
  • I tried this before with reactjs but it has a lot of limitations which is very long to explina however, I like to do it now without react component using document.event_listener('ondragenter',...).
  • I tried this Note This is a sudo code because I don't mind using rust or javascript any one will be great.
  • the following function make the drag icon appear when hover so you can drag the entire element using the wrapper then remove the wrapper when the mouse hover on other elements

let prev_element = null;
let prev_element_inner_html = null;

fn on_mouse_enter(event){
   if prev_element(){
       let elemnt = document.query_selelctor(`.${prev_element.attributes.class}`)
       // unrape the prev element
       element.inner_html = prev_element_inner_html
   }
   let elemnt = document.query_selelctor(`.${event.target.attributes.class}`)    
   element.inner_html = `<span class="wrapper"><span class="drag_icon></span>${element.inner_html}<span>`  
}

  • Goal I want to check if you have better ideas because this solution is too long and requires me to check the entire dom and `set_attribute('mouseenter',"on_mouse_enter") for each single element.

  • Note I can't use packages or yew or reactjs because my project requires too many other functionalities that require pure rust or pure javascript

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda