revue-draggable icon indicating copy to clipboard operation
revue-draggable copied to clipboard

Controlled Position not working

Open CubE135 opened this issue 2 years ago • 2 comments

Describe the bug As i am trying to control the position of a draggable element, it does not seem to work properly. I tried everything i could imagine, read through the source code of the example etc. but i can not get it to work.

To Reproduce Steps to reproduce the behavior:

  1. Use this code: image (Also not working without any style or classes)
  2. Run it
  3. Click on the "I can be clicked" box.
  4. Watch as nothing will happen.

Expected behavior When clicking the "I can be clicked" box, the "I can be dragged" Box should change its position.

Screenshots image

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser Chrome
  • Version 105.0.5195.127

Additional context Im using nuxt, this is my draggable plugin: image

CubE135 avatar Oct 04 '22 16:10 CubE135

Sorry I am a little busy right now but I will get back to you as soon as I can :)

Just to make sure: You're using Vue2 right?

bcakmakoglu avatar Oct 05 '22 17:10 bcakmakoglu

Yes, i am :)

CubE135 avatar Oct 15 '22 17:10 CubE135

Sorry for the very late update, I have been super busy with different projects but I will take a look into this problem now 👍

bcakmakoglu avatar Jan 02 '23 16:01 bcakmakoglu

I can't seem to properly reproduce this issue, could you provide me with a sandbox for this? @CubE135

bcakmakoglu avatar Jan 02 '23 17:01 bcakmakoglu

I can't seem to properly reproduce this issue, could you provide me with a sandbox for this? @CubE135

Sure, here you go: https://codesandbox.io/p/sandbox/draggable-c3jxkw

CubE135 avatar Feb 01 '23 09:02 CubE135

Alright so after a lot of debugging and having forgotten this issue: Can you try replacing the controlledPosition object completely instead of mutating it's x and y value?

So instead of this

controlledPosition.x = 100

Do this

controlledPosition = { ...controlledPosition, x: 100 }

Then it should work as expected 😅

bcakmakoglu avatar Jun 13 '23 07:06 bcakmakoglu

Hey :) As time has gone by, i was able to find a different solution for my problem. But anyways, im glad to hear that you got the issue resolved :)

CubE135 avatar Jun 21 '23 17:06 CubE135