I'm currently working on developing draggable objects in Vue.js from scratch, but I've encountered two issues.
- After dragging, the object quickly snaps to the target coordinates without any transition effect.
- I attempted to eliminate the 'Ghosting image' by changing the opacity to 0% while dragging, but it doesn't seem to be effective.
Below is the code snippet I am currently implementing: https://jsfiddle.net/wmsk1npb/
<div id="app">
{{x}}/{{y}} ....... {{coordinates}}
<div class="bubbleMenuContainer" :style="coordinates" draggable="true" @drag="move" @dragend="set">
Test
</div>
</div>
new Vue({
el: '#app',
data: {
x:0,
y:0,
coordinates:{
top: "100px",
left: "100px",
opacity: "100%",
}
},
methods:{
move(event){
this.x = event.clientX;
this.y = event.clientY;
this.coordinates.left = event.clientX + "px";
this.coordinates.top = event.clientY + "px";
this.coordinates.opacity = "0%;"
},
set(event){
this.coordinates.left = event.clientX + "px";
this.coordinates.top = event.clientY + "px";
this.coordinates.opacity = "100%;"
}
}
})
.bubbleMenuContainer{
position: absolute;
border-radius: 100px;
background-color: lightcoral;
width: 30px;
height: 30px;
padding: 10px;
}