vue-draggable-resizable icon indicating copy to clipboard operation
vue-draggable-resizable copied to clipboard

Error when using multiple draggable component. X and Y of element becomes NaN

Open saniro opened this issue 5 years ago • 3 comments

There is an error when you are dragging an element (element 1) on bottom of another element (element 2) then you right click element 2 while dragging element 1. Element 1's x and y becomes NaN and cannot be moved.

saniro avatar Feb 28 '20 07:02 saniro

Can you provide some code please? I'm not able to recreate the issue.

mauricius avatar Mar 01 '20 10:03 mauricius

Hello! I am very sorry for the late reply. I got tangled on my work. Here is my code and a video of its behavoir

<template>
  <div class="container">
    <VueDraggableResizable
      class-name-active="my-active-class"
      v-for="element in elements"
      :key="element.id"
      :x="element.x"
      :y="element.y"
      :w="200"
      :h="200"
      :resizable="false"
      @dragging="(left, top) => dragging(element.id, left, top)"
      @dragstop="(left, top) => dragstop(element.id, left, top)"
      style="border: solid 1px black"
    >
      <p>{{ element.text }}</p>
    </VueDraggableResizable>
  </div>
</template>

<script>
import VueDraggableResizable from 'vue-draggable-resizable'
import { Component, Vue } from 'nuxt-property-decorator'

@Component({
  components: {
    VueDraggableResizable
  }
})
export default class DragDrop extends Vue {
  elements = [
    {
      id: 1,
      x: 0,
      y: 0,
      text: 'Element 1'
    },
    {
      id: 2,
      x: 0,
      y: 0,
      text: 'Element 2'
    }
  ]

  dragging (id, left, top) {
    console.log({id, left, top})
  }

  dragstop (id, left, top) {
    console.log({id, left, top})
  }
}
</script>

DragAndDrop (1)

It only happens when you right click another element while still holding an element.

Thank you!

saniro avatar Mar 10 '20 06:03 saniro

I also have the same issue and I really need this to be fixed asap. Btw thanks for this awesome library.

jecaluag avatar Mar 12 '20 09:03 jecaluag